diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 6fc52a0..033a281 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,22 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 6 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: space, no_space -Layout/LineContinuationSpacing: - Exclude: - - 'tasks/docker.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: aligned, indented -Layout/LineEndStringConcatenationIndentation: - Exclude: - - 'tasks/docker.rb' - # Offense count: 13 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: @@ -117,21 +101,9 @@ Style/MixinUsage: - 'tasks/docker_exp.rb' - 'tasks/vagrant.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Style/NegatedIfElseCondition: - Exclude: - - 'tasks/docker.rb' - # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Methods. Style/RedundantArgument: Exclude: - 'tasks/update_node_pp.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Style/RedundantStringEscape: - Exclude: - - 'tasks/vagrant.rb' diff --git a/tasks/docker.rb b/tasks/docker.rb index 3343cad..d55603c 100755 --- a/tasks/docker.rb +++ b/tasks/docker.rb @@ -23,16 +23,16 @@ def install_ssh_components(distro, version, container) # sometimes the redhat 6 variant containers like to eat their rpmdb, leading to # issues with "rpmdb: unable to join the environment" errors # This "fix" is from https://www.srv24x7.com/criticalyum-main-error-rpmdb-open-failed/ - run_local_command("docker exec #{container} bash -exc \"rm -f /var/lib/rpm/__db*; "\ - 'db_verify /var/lib/rpm/Packages; '\ - 'rpm --rebuilddb; '\ - 'yum clean all; '\ - 'yum install -y sudo openssh-server openssh-clients"') + run_local_command("docker exec #{container} bash -exc \"rm -f /var/lib/rpm/__db*; " \ + 'db_verify /var/lib/rpm/Packages; ' \ + 'rpm --rebuilddb; ' \ + 'yum clean all; ' \ + 'yum install -y sudo openssh-server openssh-clients"') else # If systemd is running for init, ensure systemd has finished starting up before proceeding: - check_init_cmd = 'if [[ "$(readlink /proc/1/exe)" == "/usr/lib/systemd/systemd" ]]; then '\ - 'count=0 ; while ! [[ "$(systemctl is-system-running)" =~ ^running|degraded$ && $count > 20 ]]; '\ - 'do sleep 0.1 ; count=$((count+1)) ; done ; fi' + check_init_cmd = 'if [[ "$(readlink /proc/1/exe)" == "/usr/lib/systemd/systemd" ]]; then ' \ + 'count=0 ; while ! [[ "$(systemctl is-system-running)" =~ ^running|degraded$ && $count > 20 ]]; ' \ + 'do sleep 0.1 ; count=$((count+1)) ; done ; fi' run_local_command("docker exec #{container} bash -c '#{check_init_cmd}'") run_local_command("docker exec #{container} yum install -y sudo openssh-server openssh-clients") end @@ -74,10 +74,10 @@ def fix_ssh(distro, version, container) # https://bugzilla.redhat.com/show_bug.cgi?id=1728777 run_local_command("docker exec #{container} sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd") if distro =~ %r{redhat|centos} && version =~ %r{^7} - if !%r{^(7|8|9|2)}.match?(version) - run_local_command("docker exec #{container} service sshd restart") - else + if %r{^(7|8|9|2)}.match?(version) run_local_command("docker exec #{container} /usr/sbin/sshd") + else + run_local_command("docker exec #{container} service sshd restart") end when %r{sles} run_local_command("docker exec #{container} /usr/sbin/sshd") diff --git a/tasks/vagrant.rb b/tasks/vagrant.rb index 685773f..c63ec44 100755 --- a/tasks/vagrant.rb +++ b/tasks/vagrant.rb @@ -54,7 +54,7 @@ def generate_vagrantfile(file_path, platform, enable_synced_folder, provider, cp '' end vf = <<~VF - Vagrant.configure(\"2\") do |config| + Vagrant.configure("2") do |config| config.vm.box = '#{platform}' config.vm.boot_timeout = 600 config.ssh.insert_key = false