theforeman / foreman_azure_rm

Adds Azure Resource Manager as a compute resource for The Foreman
GNU General Public License v3.0
9 stars 24 forks source link

Fixes #35481 - Remove hard coded sudo command in script extension #158

Closed chris1984 closed 2 years ago

chris1984 commented 2 years ago

What are the changes introduced in this pull request?

When building a VM with Forman in Microsoft Azure, it looks like we hard coded adding azureuser ALL=(ALL) NOPASSWD:ALL in the /etc/sudoers.d/waagent file This no longer is needed since Azure drops in a 90-cloud-init-users in a newly provisioned VM. We can see the contents of that file here:

[root@Toledo123 ~]# cat /etc/sudoers.d/90-cloud-init-users 
# Created by cloud-init v. 19.4 on Tue, 03 Aug 2021 14:30:54 +0000

# User rules for azureuser
azureuser ALL=(ALL) NOPASSWD:ALL

# User rules for azureuser
azureuser ALL=(ALL) NOPASSWD:ALL

The hard-coded value actually introduced another bug, we were trying to echo that sudo command even if a user didn't put anything in the script_command or script_uri fields, which would then add the Linux Script VM Extension to the VM when a user didn't ask for it.

This PR does two things:

Considerations taken when implementing this change?

What are the testing steps for this pull request?

chris1984 commented 2 years ago

@pendor If you have time can this get a review? BZ for reference https://bugzilla.redhat.com/show_bug.cgi?id=2088529

chris1984 commented 2 years ago

Test failures are unrelated, will make a pr to fix them, and will update my commit message to make the redmine check happy once it's reviewed/acked.

chris1984 commented 2 years ago

@Ron-Lavi here is the pr