File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
cookbooks/aws-parallelcluster-config Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ # Copyright:: 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+ #
5+ # Licensed under the Apache License, Version 2.0 (the "License").
6+ # You may not use this file except in compliance with the License.
7+ # A copy of the License is located at
8+ #
9+ # http://aws.amazon.com/apache2.0/
10+ #
11+ # or in the "LICENSE.txt" file accompanying this file.
12+ # This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
13+ # See the License for the specific language governing permissions and limitations under the License.
14+
15+ #
16+ # Check if a service is installed in the instance and in the specific platform
17+ #
18+ def is_service_installed? ( service , platform_families = node [ 'platform_family' ] )
19+ if platform_family? ( platform_families )
20+ service_check = Mixlib ::ShellOut . new ( "systemctl daemon-reload && systemctl list-unit-files --all | grep #{ service } " )
21+ service_check . run_command
22+ # convert return code in boolean
23+ service_check . exitstatus . to_i . zero?
24+ else
25+ # in case of different platform return false
26+ false
27+ end
28+ end
Original file line number Diff line number Diff line change 2323 end
2424end
2525
26- if graphic_instance?
26+ if graphic_instance? && is_service_installed? ( node [ 'cluster' ] [ 'nvidia' ] [ 'gdrcopy' ] [ 'service' ] )
2727 # NVIDIA GDRCopy
2828 execute "enable #{ node [ 'cluster' ] [ 'nvidia' ] [ 'gdrcopy' ] [ 'service' ] } service" do
2929 # Using command in place of service resource because of: https://github.com/chef/chef/issues/12053
You can’t perform that action at this time.
0 commit comments