Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@
retry_delay 10
end unless kitchen_test? || (node['cluster']['node_type'] == "ExternalSlurmDbd")

bash "Remove existing cluster name state file" do
user 'root'
group 'root'
code <<-CLUSTERSTATE
rm /var/spool/slurm.state/clustername
CLUSTERSTATE
only_if { ::File.exist?('/var/spool/slurm.state/clustername') }
Copy link
Contributor

@gmarciani gmarciani Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to use bash, why using an only_if rather than having a rm -f?
Also, why using bash and not using the file resource with action delete?

end

bash "bootstrap slurm database" do
user 'root'
group 'root'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,12 @@
supports restart: false
action %i(disable stop)
end

bash "Remove existing cluster name state file" do
Copy link
Contributor

@gmarciani gmarciani Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is duplicated. What about reducing code duplication by defining this logic into a function and call that function or use the file resources to delete the file?

user 'root'
group 'root'
code <<-CLUSTERSTATE
rm /var/spool/slurm.state/clustername
CLUSTERSTATE
only_if { ::File.exist?('/var/spool/slurm.state/clustername') }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end
Loading