Allow split of list using spaces.

This change checks for comma existence and if its not there splits based on spaces.  Should have identical use as previously.  It also solves the problem of giving non-comma-delimited-output to salt from other programs.
This commit is contained in:
Chris Gilmer 2013-07-25 14:58:08 -07:00
parent a52773e940
commit ecce87a9a7

View File

@ -1036,7 +1036,10 @@ class SaltCMDOptionParser(OptionParser, ConfigDirMixIn, MergeConfigMixIn,
self.args[2] = self.args[2]
if self.options.list:
self.config['tgt'] = self.args[0].split(',')
if ',' in self.args[0]:
self.config['tgt'] = self.args[0].split(',')
else:
self.config['tgt'] = self.args[0].split()
else:
self.config['tgt'] = self.args[0]
@ -1107,7 +1110,10 @@ class SaltCPOptionParser(OptionParser, ConfigDirMixIn, MergeConfigMixIn,
self.exit(1)
if self.options.list:
self.config['tgt'] = self.args[0].split(',')
if ',' in self.args[0]:
self.config['tgt'] = self.args[0].split(',')
else:
self.config['tgt'] = self.args[0].split()
else:
self.config['tgt'] = self.args[0]
self.config['src'] = self.args[1:-1]
@ -1487,7 +1493,10 @@ class SaltSSHOptionParser(OptionParser, ConfigDirMixIn, MergeConfigMixIn,
def _mixin_after_parsed(self):
if self.options.list:
self.config['tgt'] = self.args[0].split(',')
if ',' in self.args[0]:
self.config['tgt'] = self.args[0].split(',')
else:
self.config['tgt'] = self.args[0].split()
else:
self.config['tgt'] = self.args[0]
if len(self.args) > 0: