Skip to content

Commit 847f2ff

Browse files
committed
Skip dcv installation checking when ['cluster']['dcv']['install_enabled'] == false
1 parent dca7131 commit 847f2ff

File tree

2 files changed

+13
-9
lines changed
  • cookbooks

2 files changed

+13
-9
lines changed

cookbooks/aws-parallelcluster-platform/test/controls/dcv_spec.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
control 'tag:install_dcv_connect_script_installed' do
1313
title 'Check pcluster dcv connect script is installed'
14-
only_if { !os_properties.redhat_on_docker? }
14+
only_if { instance.dcv_install_enabled? && !os_properties.redhat_on_docker? }
1515

1616
describe file("#{node['cluster']['scripts_dir']}/pcluster_dcv_connect.sh") do
1717
it { should be_file }
@@ -23,7 +23,7 @@
2323

2424
control 'tag:install_dcv_authenticator_user_and_group_set_up' do
2525
title 'Check that dcv authenticator user and group have been set up'
26-
only_if { !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) && !os_properties.alinux2023? }
26+
only_if { instance.dcv_install_enabled? && !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) && !os_properties.alinux2023? }
2727

2828
describe group(node['cluster']['dcv']['authenticator']['group']) do
2929
it { should exist }
@@ -39,7 +39,7 @@
3939

4040
control 'tag:install_dcv_disabled_lock_screen' do
4141
title 'Check that the lock screen has been disabled'
42-
only_if { !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) && !os_properties.alinux2023? }
42+
only_if { instance.dcv_install_enabled? && !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) && !os_properties.alinux2023? }
4343

4444
describe bash('gsettings get org.gnome.desktop.lockdown disable-lock-screen') do
4545
its('exit_status') { should eq 0 }
@@ -54,7 +54,7 @@
5454

5555
control 'tag:install_dcv_installed' do
5656
title 'Check dcv is installed'
57-
only_if { !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) && !os_properties.alinux2023? }
57+
only_if { instance.dcv_install_enabled? && !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) && !os_properties.alinux2023? }
5858

5959
pkgs = %W(nice-dcv-server nice-xdcv nice-dcv-web-viewer)
6060
pkgs.each do |pkg|
@@ -66,7 +66,7 @@
6666

6767
control 'tag:install_dcv_external_authenticator_virtualenv_created' do
6868
title 'Check dcv external authenticator virtual environment is created'
69-
only_if { !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) && !os_properties.alinux2023? }
69+
only_if { instance.dcv_install_enabled? && !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) && !os_properties.alinux2023? }
7070

7171
describe file("#{node['cluster']['dcv']['authenticator']['virtualenv_path']}/bin/activate") do
7272
it { should be_file }
@@ -76,7 +76,7 @@
7676

7777
control 'tag:install_dcv_debian_specific_setup' do
7878
title 'Check debian specific setup'
79-
only_if { os_properties.debian_family? && !(os_properties.ubuntu? && os_properties.arm?) && !os_properties.alinux2023? }
79+
only_if { instance.dcv_install_enabled? && os_properties.debian_family? && !(os_properties.ubuntu? && os_properties.arm?) && !os_properties.alinux2023? }
8080

8181
pkgs = %W(whoopsie ubuntu-desktop mesa-utils)
8282
pkgs.each do |pkg|
@@ -97,7 +97,7 @@
9797

9898
control 'tag:install_dcv_rhel_and_centos_specific_setup' do
9999
title 'Check rhel and centos specific setup'
100-
only_if { !os_properties.on_docker? }
100+
only_if { instance.dcv_install_enabled? && !os_properties.on_docker? }
101101
only_if { !os_properties.alinux2023? }
102102
only_if { os_properties.centos? || os_properties.redhat? }
103103

@@ -136,7 +136,7 @@
136136
control 'tag:install_dcv_alinux2_specific_setup' do
137137
title 'Check alinux2 specific setup'
138138

139-
only_if { os_properties.alinux2? }
139+
only_if { instance.dcv_install_enabled? && os_properties.alinux2? }
140140

141141
prereq_packages = %w(gdm gnome-session gnome-classic-session gnome-session-xsession
142142
xorg-x11-server-Xorg xorg-x11-fonts-Type1 xorg-x11-drivers
@@ -160,7 +160,7 @@
160160

161161
control 'tag:install_dcv_switch_runlevel_to_multiuser_target' do
162162
title 'Check that runlevel is switched to multi-user.target'
163-
only_if { !os_properties.on_docker? }
163+
only_if { instance.dcv_install_enabled? && !os_properties.on_docker? }
164164
only_if { !os_properties.alinux2023? }
165165

166166
describe bash('systemctl get-default') do

cookbooks/aws-parallelcluster-shared/test/libraries/instance.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ def dcv_installed?
3939
inspec.file("/etc/dcv/dcv.conf").exist?
4040
end
4141

42+
def dcv_install_enabled?
43+
inspec.node['cluster']['dcv']['install_enabled'] != false
44+
end
45+
4246
def imds_token
4347
@imds_token = inspec.http('http://169.254.169.254/latest/api/token', method: 'PUT', headers: {
4448
"X-aws-ec2-metadata-token-ttl-seconds": 900,

0 commit comments

Comments
 (0)