simplify / style-tweak conditionals in wheel

This commit is contained in:
Chris Rebert 2013-05-01 23:32:47 -07:00
parent f1d5655483
commit 02578dc670
3 changed files with 6 additions and 6 deletions

View File

@ -30,7 +30,7 @@ class Wheel(object):
'''
Execute a master control function
'''
if not fun in self.w_funcs:
if fun not in self.w_funcs:
return 'Unknown wheel function'
f_call = salt.utils.format_call(self.w_funcs[fun], kwargs)
return self.w_funcs[fun](*f_call.get('args', ()), **f_call.get('kwargs', {}))

View File

@ -34,7 +34,7 @@ def list_env(env='base'):
Return all of the file paths found in an environment
'''
ret = {}
if not env in __opts__['file_roots']:
if env not in __opts__['file_roots']:
return ret
for f_root in __opts__['file_roots'][env]:
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
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)
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(
index, env)
if os.path.isabs(path):

View File

@ -35,7 +35,7 @@ def list_env(env='base'):
Return all of the file paths found in an environment
'''
ret = {}
if not env in __opts__['pillar_roots']:
if env not in __opts__['pillar_roots']:
return ret
for f_root in __opts__['pillar_roots'][env]:
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
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)
if len(__opts__['pillar_roots'][env]) <= index:
return 'Specified index {0} in environment {1} is not present'.format(