Skip to content

Commit

Permalink
Merge pull request #4344 from StackStorm/v290_fixes
Browse files Browse the repository at this point in the history
Various v2.9.0 changes
  • Loading branch information
bigmstone authored Sep 18, 2018
2 parents 75ff16b + 94a0d4a commit 44d77fc
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 15 deletions.
1 change: 1 addition & 0 deletions st2client/st2client/commands/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ def _print_execution_details(self, execution, args, **kwargs):
options = {'attributes': attr}

options['json'] = args.json
options['yaml'] = args.yaml
options['with_schema'] = args.with_schema
options['attribute_transform_functions'] = self.attribute_transform_functions
self.print_output(instance, formatter, **options)
Expand Down
5 changes: 5 additions & 0 deletions st2client/st2client/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import six
from six.moves.configparser import ConfigParser


__all__ = [
'CLIConfigParser',

Expand Down Expand Up @@ -60,6 +61,10 @@
'silence_ssl_warnings': {
'type': 'bool',
'default': False
},
'silence_schema_output': {
'type': 'bool',
'default': True
}
},
'cli': {
Expand Down
9 changes: 5 additions & 4 deletions st2client/st2client/formatters/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import yaml

from st2client import formatters
from st2client.config import get_config
from st2client.utils import jsutil
from st2client.utils import strutil
from st2client.utils.color import DisplayColors
Expand Down Expand Up @@ -95,20 +96,20 @@ def format(cls, entry, *args, **kwargs):
(DisplayColors.colorize(attr, DisplayColors.BLUE), value)

output_schema = entry.get('action', {}).get('output_schema')

schema_check = get_config()['general']['silence_schema_output']
if not output_schema and kwargs.get('with_schema'):
rendered_schema = {
'output_schema': schema.render_output_schema_from_output(entry['result'])
}

rendered_schema = yaml.safe_dump(rendered_schema, default_flow_style=False)
output += '\n'
output += _print_bordered(
"This action does not have an output schema defined. Based "
"on the action output the following inferred schema was built:"
"Based on the action output the following inferred schema was built:"
"\n\n"
"%s" % rendered_schema
)
elif not output_schema:
elif not output_schema and not schema_check:
output += (
"\n\n** This action does not have an output_schema. "
"Run again with --with-schema to see a suggested schema."
Expand Down
2 changes: 0 additions & 2 deletions st2client/tests/fixtures/execution_get_attributes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
status: succeeded (1s elapsed)
end_timestamp: Tue, 02 Dec 2014 19:56:07 UTC

** This action does not have an output_schema. Run again with --with-schema to see a suggested schema.
2 changes: 0 additions & 2 deletions st2client/tests/fixtures/execution_get_default.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,3 @@ result:
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.015/0.023/0.030/0.006 ms'
succeeded: true

** This action does not have an output_schema. Run again with --with-schema to see a suggested schema.
2 changes: 0 additions & 2 deletions st2client/tests/fixtures/execution_unescape_newline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ Traceback (most recent call last):
stdout: 'FOOBAR2
'
succeeded: true

** This action does not have an output_schema. Run again with --with-schema to see a suggested schema.
2 changes: 0 additions & 2 deletions st2client/tests/fixtures/execution_unicode.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ result:
stderr: ''
stdout: "‡"
succeeded: true

** This action does not have an output_schema. Run again with --with-schema to see a suggested schema.
2 changes: 0 additions & 2 deletions st2client/tests/fixtures/execution_unicode_py3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ result:
stderr: ''
stdout: "\u2021"
succeeded: true

** This action does not have an output_schema. Run again with --with-schema to see a suggested schema.
3 changes: 2 additions & 1 deletion st2client/tests/unit/test_config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def test_parse(self):
'base_url': 'http://127.0.0.1',
'api_version': 'v1',
'cacert': 'cacartpath',
'silence_ssl_warnings': False
'silence_ssl_warnings': False,
'silence_schema_output': True
},
'cli': {
'debug': True,
Expand Down

0 comments on commit 44d77fc

Please sign in to comment.