Merge branch 'basestring' of https://github.com/fatbox/salt into fatbox-basestring

Conflicts:
	salt/state.py
This commit is contained in:
Thomas S Hatch 2012-02-27 08:48:03 -07:00
commit df6a8141c7
9 changed files with 20 additions and 20 deletions

View File

@ -51,7 +51,7 @@ class Caller(object):
sys.exit(1)
if hasattr(self.minion.functions[fun], '__outputter__'):
oput = self.minion.functions[fun].__outputter__
if isinstance(oput, str):
if isinstance(oput, basestring):
ret['out'] = oput
return ret

View File

@ -194,7 +194,7 @@ class Minion(object):
Override this method if you wish to handle the decoded
data differently.
'''
if isinstance(data['fun'], str):
if isinstance(data['fun'], basestring):
if data['fun'] == 'sys.reload_modules':
self.functions, self.returners = self.__load_modules()
@ -233,7 +233,7 @@ class Minion(object):
arg = eval(data['arg'][ind])
if isinstance(arg, bool):
data['arg'][ind] = str(data['arg'][ind])
elif isinstance(arg, (dict, int, list, str)):
elif isinstance(arg, (dict, int, list, basestring)):
data['arg'][ind] = arg
else:
data['arg'][ind] = str(data['arg'][ind])
@ -292,7 +292,7 @@ class Minion(object):
arg = eval(data['arg'][ind][index])
if isinstance(arg, bool):
data['arg'][ind][index] = str(data['arg'][ind][index])
elif isinstance(arg, (dict, int, list, str)):
elif isinstance(arg, (dict, int, list, basestring)):
data['arg'][ind][index] = arg
else:
data['arg'][ind][index] = str(data['arg'][ind][index])
@ -354,7 +354,7 @@ class Minion(object):
try:
if hasattr(self.functions[ret['fun']], '__outputter__'):
oput = self.functions[ret['fun']].__outputter__
if isinstance(oput, str):
if isinstance(oput, basestring):
load['out'] = oput
except KeyError:
pass
@ -362,7 +362,7 @@ class Minion(object):
data = self.serial.dumps(payload)
socket.send(data)
ret_val = self.serial.loads(socket.recv())
if isinstance(ret_val, str) and not ret_val:
if isinstance(ret_val, basestring) and not ret_val:
# The master AES key has changed, reauth
self.authenticate()
payload['load'] = self.crypticle.dumps(load)
@ -612,7 +612,7 @@ class Matcher(object):
'''
Runs the compound target check
'''
if not isinstance(tgt, str):
if not isinstance(tgt, basestring):
log.debug('Compound target received that is not a string')
return False
ref = {'G': 'grain',

View File

@ -48,7 +48,7 @@ def publish(tgt, fun, arg=None, expr_form='glob', returner='', timeout=5):
if isinstance(ast.literal_eval(arg), dict):
arg = [arg,]
except:
if isinstance(arg, str):
if isinstance(arg, basestring):
arg = arg.split(',')
auth = salt.crypt.SAuth(__opts__)

View File

@ -19,7 +19,7 @@ def _sync(form, env):
'''
Sync the given directory in the given environment
'''
if isinstance(env, str):
if isinstance(env, basestring):
env = env.split(',')
ret = []
remote = set()

View File

@ -43,7 +43,7 @@ def setenforce(mode):
'''
Set the enforcing mode
'''
if isinstance(mode, str):
if isinstance(mode, basestring):
if mode.lower() == 'enforcing':
mode = '1'
elif mode.lower() == 'permissive':

View File

@ -89,7 +89,7 @@ def sls(mods, env='base'):
salt '*' state.sls core,edit.vim dev
'''
st_ = salt.state.HighState(__opts__)
if isinstance(mods, str):
if isinstance(mods, basestring):
mods = mods.split(',')
high, errors = st_.render_highstate({env: mods})
if errors:

View File

@ -97,7 +97,7 @@ class HighStateOutputter(Outputter):
))
changes = ' Changes: '
for key in ret['changes']:
if isinstance(ret['changes'][key], str):
if isinstance(ret['changes'][key], basestring):
changes += (key + ': ' + ret['changes'][key] +
'\n ')
elif isinstance(ret['changes'][key], dict):

View File

@ -300,7 +300,7 @@ class State(object):
else:
fun = 0
for arg in body[state]:
if isinstance(arg, str):
if isinstance(arg, basestring):
fun += 1
elif isinstance(arg, dict):
# The arg is a dict, if the arg is require or
@ -442,7 +442,7 @@ class State(object):
funcs = set()
names = set()
for arg in run:
if isinstance(arg, str):
if isinstance(arg, basestring):
funcs.add(arg)
continue
if isinstance(arg, dict):
@ -494,8 +494,8 @@ class State(object):
for arg in run:
update = False
for hind in range(len(high[name][state])):
if isinstance(arg, str) and \
isinstance(high[name][state][hind], str):
if isinstance(arg, basestring) and \
isinstance(high[name][state][hind], basestring):
# replacing the function, replace the index
high[name][state].pop(hind)
high[name][state].insert(hind, arg)
@ -543,7 +543,7 @@ class State(object):
Take the path to a template and return the high data structure derived
from the template.
'''
if not isinstance(template, str):
if not isinstance(template, basestring):
return {}
if not os.path.isfile(template):
return {}
@ -899,12 +899,12 @@ class HighState(object):
for comp in ctop[env][tgt]:
if isinstance(comp, dict):
cmatches.append(comp)
if isinstance(comp, str):
if isinstance(comp, basestring):
cstates.add(comp)
for comp in top[env][tgt]:
if isinstance(comp, dict):
matches.append(comp)
if isinstance(comp, str):
if isinstance(comp, basestring):
states.add(comp)
top[env][tgt] = matches
top[env][tgt].extend(list(states))

View File

@ -513,7 +513,7 @@ def managed(name,
source = single_src
source_hash = single_hash
break
elif isinstance(single, str):
elif isinstance(single, basestring):
if single in mfiles:
source = single
break