diff --git a/lib/kitchen/docker/helpers/dockerfile_helper.rb b/lib/kitchen/docker/helpers/dockerfile_helper.rb index a1406b4..1a95f5e 100644 --- a/lib/kitchen/docker/helpers/dockerfile_helper.rb +++ b/lib/kitchen/docker/helpers/dockerfile_helper.rb @@ -111,7 +111,8 @@ def rhel_platform <<-CODE ENV container=docker RUN yum clean all - RUN yum install -y sudo openssh-server openssh-clients which curl + RUN yum install -y sudo openssh-server openssh-clients which + RUN which curl || yum install -y curl RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' CODE end diff --git a/spec/dockerfile_helper_spec.rb b/spec/dockerfile_helper_spec.rb index 095d1a9..3d1cf45 100644 --- a/spec/dockerfile_helper_spec.rb +++ b/spec/dockerfile_helper_spec.rb @@ -61,9 +61,10 @@ def initialize(config = {}) expect(result).not_to include("--allowerasing") end - it "installs required packages including curl" do + it "installs required packages including curl if needed" do result = helper.rhel_platform - expect(result).to include("sudo openssh-server openssh-clients which curl") + expect(result).to include("sudo openssh-server openssh-clients which") + expect(result).to include("which curl || yum install -y curl") end end