Skip to content

Conversation

@grzs
Copy link
Contributor

@grzs grzs commented Nov 30, 2022

Signed-off-by: Janos Gerzson [email protected]


user = self.get_option('become_user') or ''
if user:
user = self.get_option('become_user') or 'root'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be the current user by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will run as the current user (ansible_user) if become_user is root, or not set at all (by default).
Actually, if become_user has been set to anything but root it will be executed with sudo, otherwise no sudo applied.
I tested it and was working flawlessly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarification. I think we can add some tests here.
I'll prepare a test skeleton.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use this as a template for tests: #531 Just replace podman_lovely_module by your module/plugin name everywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants