mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
simplify / style-tweak conditionals in wheel
This commit is contained in:
parent
f1d5655483
commit
02578dc670
@ -30,7 +30,7 @@ class Wheel(object):
|
|||||||
'''
|
'''
|
||||||
Execute a master control function
|
Execute a master control function
|
||||||
'''
|
'''
|
||||||
if not fun in self.w_funcs:
|
if fun not in self.w_funcs:
|
||||||
return 'Unknown wheel function'
|
return 'Unknown wheel function'
|
||||||
f_call = salt.utils.format_call(self.w_funcs[fun], kwargs)
|
f_call = salt.utils.format_call(self.w_funcs[fun], kwargs)
|
||||||
return self.w_funcs[fun](*f_call.get('args', ()), **f_call.get('kwargs', {}))
|
return self.w_funcs[fun](*f_call.get('args', ()), **f_call.get('kwargs', {}))
|
||||||
|
@ -34,7 +34,7 @@ def list_env(env='base'):
|
|||||||
Return all of the file paths found in an environment
|
Return all of the file paths found in an environment
|
||||||
'''
|
'''
|
||||||
ret = {}
|
ret = {}
|
||||||
if not env in __opts__['file_roots']:
|
if env not in __opts__['file_roots']:
|
||||||
return ret
|
return ret
|
||||||
for f_root in __opts__['file_roots'][env]:
|
for f_root in __opts__['file_roots'][env]:
|
||||||
ret[f_root] = {}
|
ret[f_root] = {}
|
||||||
@ -91,9 +91,9 @@ def write(data, path, env='base', index=0):
|
|||||||
Write the named file, by default the first file found is written, but the
|
Write the named file, by default the first file found is written, but the
|
||||||
index of the file can be specified to write to a lower priority file root
|
index of the file can be specified to write to a lower priority file root
|
||||||
'''
|
'''
|
||||||
if not env in __opts__['file_roots']:
|
if env not in __opts__['file_roots']:
|
||||||
return 'Named environment {0} is not present'.format(env)
|
return 'Named environment {0} is not present'.format(env)
|
||||||
if not len(__opts__['file_roots'][env]) > index:
|
if len(__opts__['file_roots'][env]) <= index:
|
||||||
return 'Specified index {0} in environment {1} is not present'.format(
|
return 'Specified index {0} in environment {1} is not present'.format(
|
||||||
index, env)
|
index, env)
|
||||||
if os.path.isabs(path):
|
if os.path.isabs(path):
|
||||||
|
@ -35,7 +35,7 @@ def list_env(env='base'):
|
|||||||
Return all of the file paths found in an environment
|
Return all of the file paths found in an environment
|
||||||
'''
|
'''
|
||||||
ret = {}
|
ret = {}
|
||||||
if not env in __opts__['pillar_roots']:
|
if env not in __opts__['pillar_roots']:
|
||||||
return ret
|
return ret
|
||||||
for f_root in __opts__['pillar_roots'][env]:
|
for f_root in __opts__['pillar_roots'][env]:
|
||||||
ret[f_root] = {}
|
ret[f_root] = {}
|
||||||
@ -92,7 +92,7 @@ def write(data, path, env='base', index=0):
|
|||||||
Write the named file, by default the first file found is written, but the
|
Write the named file, by default the first file found is written, but the
|
||||||
index of the file can be specified to write to a lower priority file root
|
index of the file can be specified to write to a lower priority file root
|
||||||
'''
|
'''
|
||||||
if not env in __opts__['pillar_roots']:
|
if env not in __opts__['pillar_roots']:
|
||||||
return 'Named environment {0} is not present'.format(env)
|
return 'Named environment {0} is not present'.format(env)
|
||||||
if len(__opts__['pillar_roots'][env]) <= index:
|
if len(__opts__['pillar_roots'][env]) <= index:
|
||||||
return 'Specified index {0} in environment {1} is not present'.format(
|
return 'Specified index {0} in environment {1} is not present'.format(
|
||||||
|
Loading…
Reference in New Issue
Block a user