Skip to content

Commit

Permalink
Fix installing ppa for LXD running as non root
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmoura committed Nov 25, 2020
1 parent 0e5e5ab commit 7e80caf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/integration_tests/bugs/test_lp1900837.py
Expand Up @@ -18,7 +18,7 @@ def test_permissions_unchanged(self, client):
assert "644" == _get_log_perms(client)

# Set permissions to 600 and confirm our assertion passes pre-reboot
client.execute("chmod 600 /var/log/cloud-init.log")
client.execute("chmod 600 /var/log/cloud-init.log", use_sudo=True)
assert "600" == _get_log_perms(client)

# Reboot
Expand Down
4 changes: 3 additions & 1 deletion tests/integration_tests/conftest.py
Expand Up @@ -105,7 +105,9 @@ def setup_image(session_cloud):
client.install_proposed_image()
elif integration_settings.CLOUD_INIT_SOURCE.startswith('ppa:'):
client = session_cloud.launch()
client.install_ppa(integration_settings.CLOUD_INIT_SOURCE)
client.install_ppa(
integration_settings.CLOUD_INIT_SOURCE
)
elif os.path.isfile(str(integration_settings.CLOUD_INIT_SOURCE)):
client = session_cloud.launch()
client.install_deb()
Expand Down
8 changes: 4 additions & 4 deletions tests/integration_tests/instances.py
Expand Up @@ -108,10 +108,10 @@ def install_proposed_image(self):
def install_ppa(self, repo):
log.info('Installing PPA')
remote_script = (
'{sudo} add-apt-repository {repo} -y && '
'{sudo} apt-get update -q && '
'{sudo} apt-get install -qy cloud-init'
).format(sudo='sudo' if self.use_sudo else '', repo=repo)
'sudo add-apt-repository {repo} -y && '
'sudo apt-get update -q && '
'sudo apt-get install -qy cloud-init'
).format(repo=repo)
self._install_new_cloud_init(remote_script)

def install_deb(self):
Expand Down

0 comments on commit 7e80caf

Please sign in to comment.