From 45853f7d2b471839f13b1d356e596b7171a9a953 Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Sun, 12 May 2024 10:34:35 -0500 Subject: [PATCH] fix provision on dnf only platforms rockylinux images recently dropped yum. other distros are likely to do the same. --- tasks/docker.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tasks/docker.rb b/tasks/docker.rb index 385243f..19d1f32 100755 --- a/tasks/docker.rb +++ b/tasks/docker.rb @@ -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 @@ -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' + 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')