Fix for incorrect output with salt CLI --static option

When the ``static`` option was used outside the context of the ``batch`` option
the output would appear thusly:

```bash
salt -s 'seed*ord' test.ping --out json
```

```json
{
    "seed-02.pgsql.revsys.000.lab.rackspace.ord": true,
    "seed-01.pgsql.revsys.000.lab.rackspace.ord": true,
    "seed-03.pgsql.revsys.000.lab.rackspace.ord": true
}
{
    "seed-03.pgsql.revsys.000.lab.rackspace.ord": true
}
{
    "seed-02.pgsql.revsys.000.lab.rackspace.ord": true
}
{
    "seed-01.pgsql.revsys.000.lab.rackspace.ord": true
}
```

Using the default outputter results in minion responses being displayed twice.

If it is used with the ``batch`` option, it Does The Right Thing. Since
``batch`` needs logic to take care of the presense of ``static``, it made
sense to me to remove the `if options.static:` bits from the else half
of the `if options.batch:`, extending it to `if options.batch or
options.static:` and adding
`if not options.batch: self.config['batch'] = '100%'` to make cli.batch.Batch()
happy.
This commit is contained in:
Stephen Spencer 2015-05-04 18:50:34 -05:00
parent eadfc30256
commit 4ee367956c

View file

@ -53,7 +53,7 @@ class SaltCMD(parsers.SaltCMDOptionParser):
self.exit(2, '{0}\n'.format(exc))
return
if self.options.batch:
if self.options.batch or self.options.static:
import salt.cli.batch
eauth = {}
if 'token' in self.config:
@ -78,6 +78,9 @@ class SaltCMD(parsers.SaltCMDOptionParser):
if self.options.static:
if not self.options.batch:
self.config['batch'] = '100%'
batch = salt.cli.batch.Batch(self.config, eauth=eauth, quiet=True)
ret = {}