-
Notifications
You must be signed in to change notification settings - Fork 543
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
[sunbeam] Update plugin to collet more details #3646
[sunbeam] Update plugin to collet more details #3646
Conversation
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
24c32b1
to
eb14b81
Compare
Sounds good to me (from a pure sos side, not knowing either command or file to be collected). |
I think this does a beg a question, should we improve some of the commands to be able collect commands as a user, so we're not doing blanket The problem also I have this which I discovered last night, is that 2 of these commands will also collect certs within the command itself. If the command could be different, do I put the same login the the This is here for collaboration with my team at the moment, and do some improvements. |
I think some support for "running under user" within |
eb14b81
to
d24d664
Compare
d24d664
to
c9cff03
Compare
|
||
if self.get_option("juju-allow-login"): | ||
self.exec_cmd( | ||
f'su - {sunbeam_user} -c "sunbeam utils juju-login"') |
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 did not work with runas
argument as this command has some interactive related items, and the only way to get this working was via su
c9cff03
to
46f1221
Compare
sos/report/plugins/sunbeam.py
Outdated
@@ -37,10 +48,90 @@ def setup(self): | |||
'sunbeam cluster list --format yaml', | |||
]) | |||
|
|||
sunbeam_user = self.get_option("sunbeam-user") | |||
user_pwd = pwd.getpwnam(sunbeam_user) |
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.
If the user does not exist, getpwnam
raises an exception that will end up in sos_logs/sunbeam-plugin-errors.txt
:
>>> pwd.getpwnam('no-user')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: "getpwnam(): name not found: 'no-user'"
>>>
Technically it doesnt matter much since even catching the exception will cause the plugin wont collect anything (due to if user_pwd
), just that scenario looks bit non-professional.
Leaving on @arif-ali to decide if it is worth fixing it - I dont want to block this "form of error reporting" point from merging.
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.
good catch, I agree it's looks non-professional if that error file is created; I will fix and re-upload. Thanks for catching this; this is exactly why we have others reviewing things
* Add juju related info for sunbeam * Add logs from the sunbeam snap home user * Only collect juju details if juju is logged in * Obfuscate the certs from the controller config Resolves: SET-682 Signed-off-by: Arif Ali <arif.ali@canonical.com>
46f1221
to
45d1139
Compare
Resolves: SET-682
Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines