Skip to content
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

[vm] disable unattended upgrades on debian/ubuntu on EC2 #1207

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

pducolin
Copy link
Contributor

@pducolin pducolin commented Oct 18, 2024

What does this PR do?

Disable apt unattended upgrades at startup through userdata

Which scenarios this will impact?

aws debian and ubuntu

Motivation

ADXT-686

Additional Notes

@pducolin pducolin requested a review from a team as a code owner October 18, 2024 14:03
vmArgs.userData = vmArgs.userData + sshUserData
} else if vmArgs.osInfo.Flavor == os.Ubuntu || vmArgs.osInfo.Flavor == os.Debian {
vmArgs.userData = vmArgs.userData + os.DebianDisableUnattendedUpgradesScriptContent
Copy link
Member

Choose a reason for hiding this comment

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

Does it really work if vmArgs.userData already contains something?
I feel like we could end with a script that looks like:

#!/bin/bash
echo "First userdata"
#!/bin/bash
apt-get -y remove unattended-upgrades

And I am not sure it would work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TIL #! is called shebang. A script starting with shebang that is used as if it was an executable will use the interpreter defined after the shebang to interpret commands.

Following shebang are discarded as comments.

Tried running the following on zsh

#!/bin/bash
echo "First userdata"
#!/bin/bash
echo "something else"

And I get

First userdata
something else

Copy link
Member

@KevinFairise2 KevinFairise2 Oct 18, 2024

Choose a reason for hiding this comment

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

I see! As long as we provide user data with same language it should work. If we start to pass bash script and python script it will break but that is unlikely we do that

Copy link
Member

Choose a reason for hiding this comment

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

We could also enforce bash scripting and automatically set the shebang to bash.

@pducolin
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Oct 18, 2024

🚂 MergeQueue: pull request added to the queue

The median merge time in main is 21m.

Use /merge -c to cancel this operation!

@dd-mergequeue dd-mergequeue bot merged commit e6eb856 into main Oct 18, 2024
9 checks passed
@dd-mergequeue dd-mergequeue bot deleted the pducolin/debian-disable-unattended-upgrades branch October 18, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants