-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
salt.outputter.highstate: recursion for orch #46022
Conversation
6137184
to
3ed7b48
Compare
@mattp- Thanks for submitting this! Offhand, there's a lint error here: https://jenkins.saltstack.com/job/PR/job/salt-pr-lint-n/19299/violations/file/salt/output/highstate.py/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests need to be written to make sure this change doesn't regress, too.
salt/output/highstate.py
Outdated
nchanges += 1 if schanged else 0 | ||
if ret.get('name') in ['state.orch', 'state.orchestrate', 'state.sls']: | ||
nested = output(ret['changes']['return'], indent_level=indent_level+1) | ||
ctext = re.sub('^',u' ' * 14 * indent_level, '\n'+nested, flags=re.MULTILINE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't be using the u''
syntax here. That should be using salt.utils.stringutils.to_unicode
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah my bad, originally wrote this on a release branch pre Unicode change. Will update and add a regression test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattp- All good! Thank you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The u
is still there. Also, there need to be spaces after commas and between operators, or else the linter will complain.
I don't think we'll need to use salt.utils.stringutils.to_unicode()
here, due to unicode_literals
being imported. The nested
variable should contain a unicode string because the output()
function returns unicode strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get tests written for this?
salt/output/highstate.py
Outdated
nchanges += 1 if schanged else 0 | ||
if ret.get('name') in ['state.orch', 'state.orchestrate', 'state.sls']: | ||
nested = output(ret['changes']['return'], indent_level=indent_level+1) | ||
ctext = re.sub('^',u' ' * 14 * indent_level, '\n'+nested, flags=re.MULTILINE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The u
is still there. Also, there need to be spaces after commas and between operators, or else the linter will complain.
I don't think we'll need to use salt.utils.stringutils.to_unicode()
here, due to unicode_literals
being imported. The nested
variable should contain a unicode string because the output()
function returns unicode strings.
d960c6a
to
1556338
Compare
@rallytime / @terminalmage I've added a regression test and updated to correct the lint errors. can you please take another gander? Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is still a single lint issue that needs to be fixed. The ones in test_error.py are unrelated and already fixed upstream, if you rebase against the head of our develop
branch after fixing the lint error I pointed out below, then it should get the lint check to pass.
'retcode': 0 | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line needs to be removed to satisfy the linter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 186 in case the above comment is ambiguous.
1fec871
to
2928817
Compare
Lint issues should now be resolved |
8b4f76a
to
6966347
Compare
orchestration / nested runners emitting to highstate were not rendered as highstate like a normal state apply. With this change, recurse and indent accordingly based on nested orchestrations.
6966347
to
98cfa1f
Compare
What does this PR do?
orchestration / nested runners emitting to highstate were not rendered as
highstate like a normal state apply. With this change, recurse and indent
accordingly based on nested orchestrations.
Previous Behavior
nested orch / states were just rendered as raw data.
New Behavior
orch/state output is now rendered as nested inner highstates:
Tests written?
No
Commits signed with GPG?
No
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.