-
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
Update states.chef for version 16.x and 17.x Chef Infra Client output #61893
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
As to the As to the |
@ericham Apologies. I missed that there was in fact a changelog included with the PR. |
@ericham Looking at the changes and the current tests, this would require additional test coverage. Another concern would be whether support needs to be preserved for previous versions of Chef with the current test. |
I've changed the regex to maintain the original version output and add my changes to support the 2 current versions of Chef. "(Chef Client finished|Chef Infra Client finished|Infra Phase complete), (\d+)" Previous versions I plan to attend the Twitch Test Clinic tomorrow to get help on writing the test case. |
This PR is also blocked by #61919 - when that's merged (and tests a la test-clinic) have been added this should be ready for a re-review 👍 |
These tests cover the entire state, but are only concerned with the ret["result"] of the outputs. It would be a good idea to test other outputs as well - these tests could be modified to include assertions about the other parts of ret. (Obviously they would need to be slightly renamed. Maybe to `..._return_expected_ret`
@waynew thanks again for all the help today in the Twitch Test Clinic, I've cherry-picked your 2 commits to add the necessary unit test. |
@waynew after your merge there were 2 tests that failed, I decided to merge from master again as there were more commits outstanding, and now there is 1 failing test. So not sure if there is still an issue in the test suite or something with my code? |
For some of the tests I had to (re)approve and run, so those are going now 👍 |
@waynew I merged from master again and got 27 successful tests, I believe the 6 expected checks get triggered on review? @garethgreenaway I believe this is ready for review now as the |
@dwoz I see you're assigned as the reviewer, I believe this is ready now to be reviewed? If not, please let me know what else I need to complete. |
What does this PR do?
Update the regex search for output lines of Chef Infra Client versions 16.x and 17.x to not throw " AttributeError: 'NoneType' object has no attribute 'group'".
What issues does this PR fix or reference?
Fixes: #61891
Previous Behavior
The regex searched for "Chef Client finished, (\d+)" which appears to match some EOL version of Chef Infra Client. The currently supported versions of Chef Infra Client are 16.x and 17.x which no longer output this line at the end of a chef-client run.
New Behavior
The regex now searches for "Infra \w+ (complete|finished), (\d+)" which will match the output as follows:
Version 16.x Chef Infra Client has the following output line at the end of a successful chef-client run:
Chef Infra Client finished, 47 resources updated
Version 17.x Chef Infra Client has the following output line at the end of a successful chef-client run:
Infra Phase complete, 36 resources updated
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
- [ ] DocsI have applied these changes successfully on my Ubuntu 18.04 and 20.04 minions, the AttributeError no longer occurs and the stdout is displayed correctly. I'm not sure if a new or existing test needs to be written or updated.
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.