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

fix provision on dnf only platforms #261

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions tasks/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ def install_ssh_components(distro, version, container)
docker_exec(container, 'rm -f /etc/apt/sources.list.d/ubuntu-esm-infra-trusty.list')
docker_exec(container, 'apt-get update')
docker_exec(container, 'apt-get install -y openssh-server openssh-client')
when %r{fedora}
docker_exec(container, 'dnf clean all')
docker_exec(container, 'dnf install -y sudo openssh-server openssh-clients')
docker_exec(container, 'ssh-keygen -A')
when %r{centos}, %r{^el-}, %r{eos}, %r{oracle}, %r{ol}, %r{rhel|redhat}, %r{scientific}, %r{amzn}, %r{rocky}, %r{almalinux}
when %r{centos}, %r{^el-}, %r{eos}, %r{oracle}, %r{ol}, %r{rhel|redhat}, %r{scientific}, %r{amzn}, %r{rocky}, %r{almalinux}, %r{fedora}
if version == '6'
# sometimes the redhat 6 variant containers like to eat their rpmdb, leading to
# issues with "rpmdb: unable to join the environment" errors
Expand All @@ -35,7 +31,8 @@ def install_ssh_components(distro, version, container)
'do sleep 0.1 ; count=$((count+1)) ; done ; fi'
docker_exec(container, "bash -c '#{check_init_cmd}'")
end
docker_exec(container, 'yum install -y sudo openssh-server openssh-clients')
packager = (version.to_i > 8) ? 'dnf' : 'yum'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't that off by one? EL8 already contains dnf?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could be, but I intentionally chose 9 as RedHat technically called it "yum 4" until EL 9.

docker_exec(container, "#{packager} install -y sudo openssh-server openssh-clients")
ssh_folder = docker_exec(container, 'ls /etc/ssh/')
docker_exec(container, 'ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ""') unless ssh_folder.include?('ssh_host_rsa_key')
docker_exec(container, 'ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ""') unless ssh_folder.include?('ssh_host_dsa_key')
Expand Down
Loading