-
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
Fixes SmartOS grains when using py3 #53794
Conversation
Some data we can use to mock mdata-list:
(yes, sdc:XXX values are not listed)
|
Ideally the test should just run through the grain mdata grain parsing and with all the output combinations and we should get the expected grains or lack of the grains (but no exceptions) |
Some more fixes were needed in salt.utils.platform as the is_smartos_zone and is_smartos_globalzone were failing on bytes vs string literal on py3. |
So I talked with @Ch3LL and we need the following tests:
Probably something for salt.utils.platform too as that was the read cause of the issue, it just expose the other to grains to some undefined behavior which we cannot hit otherwise. |
Tests for the functions in both grain modules are done, and some small more tweaks to salt.grains.smartos to make it more efficient. |
When running salt on SmartOS with py3, the mdata grains are broken. Both stem from the same underlying issue that stderr is mixed in with stdout for the `mdata-list` and `mdata-get`. (Is this new?) The solution is to ignore the output if it starts with 'ERROR:'. I couldn't find a way to filter out stderr via cmd.run directly.
Some grains were broken in the GZ too, also do some mindor cleanup. 1. /etc/pkgsrc_version Does not exist in GZ and is a non-supported interface for zones, we can get this information from the pkg_install.conf file too. This should also more accuratly reflect the correct value. The path for the file is different in the GZ so we need to support both locations 2. pkgin repos are missing in GZ only Same as above, the path is different so we need to support both.
The output of Popen is bytes not string so the checks below for 'global' was not matching. - cleanup the Popen bits a bit - decode('utf8') the output
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.
Small typo, otherwise this looks good from my perspective.
What does this PR do?
The salt package in pkgsrc was moved to py3, this broke some grains on SmartOS.
For now the current release 2019.3 is back on py27. But in preperation for the next release, this PR fixes those issues.
What issues does this PR fix or reference?
#53740
Previous Behavior
Missing grains on SmartOS (Global Zone) when using py3
New Behavior
Grains are no longer missing
Tests written?
Yes
Commits signed with GPG?
No