Skip to content

Commit f5d6eb4

Browse files
committed
Add directories.rb recipe extracting from base.rb
Signed-off-by: Edoardo Antonini <[email protected]>
1 parent d456720 commit f5d6eb4

File tree

4 files changed

+61
-15
lines changed

4 files changed

+61
-15
lines changed

cookbooks/aws-parallelcluster-install/recipes/base.rb

+1-15
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,7 @@
2929
end
3030
end
3131

32-
# Setup directories
33-
directory '/etc/parallelcluster'
34-
directory node['cluster']['base_dir']
35-
directory node['cluster']['sources_dir']
36-
directory node['cluster']['scripts_dir']
37-
directory node['cluster']['license_dir']
38-
directory node['cluster']['configs_dir']
39-
directory node['cluster']['shared_dir']
40-
41-
# Create ParallelCluster log folder
42-
directory '/var/log/parallelcluster/' do
43-
owner 'root'
44-
mode '1777'
45-
recursive true
46-
end
32+
include_recipe "aws-parallelcluster-install::directories"
4733

4834
build_essential
4935
include_recipe "aws-parallelcluster-install::python"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# Cookbook:: aws-parallelcluster
3+
# Recipe:: directories
4+
#
5+
# Copyright:: 2013-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the
8+
# License. A copy of the License is located at
9+
#
10+
# http://aws.amazon.com/apache2.0/
11+
#
12+
# or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
13+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Setup directories
17+
directory '/etc/parallelcluster'
18+
directory node['cluster']['base_dir']
19+
directory node['cluster']['sources_dir']
20+
directory node['cluster']['scripts_dir']
21+
directory node['cluster']['license_dir']
22+
directory node['cluster']['configs_dir']
23+
directory node['cluster']['shared_dir']
24+
25+
# Create ParallelCluster log folder
26+
directory '/var/log/parallelcluster/' do
27+
owner 'root'
28+
mode '1777'
29+
recursive true
30+
end

kitchen.recipes.yml

+9
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,12 @@ suites:
2929
controls:
3030
- admin_user
3131
- ulimit
32+
- name: directories
33+
run_list:
34+
# runs the recipe to test, along with the recipes it depends on
35+
- recipe[aws-parallelcluster::test_dummy]
36+
- recipe[aws-parallelcluster-install::directories]
37+
verifier:
38+
controls:
39+
- pcluster_directories_exist
40+
- pcluster_log_dir_is_configured
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
control 'pcluster_directories_exist' do
2+
title 'Setup of ParallelCluster directories'
3+
4+
base_dir = "/opt/parallelcluster"
5+
dirs = [ base_dir, "#{base_dir}/sources", "#{base_dir}/scripts", "#{base_dir}/licenses", "#{base_dir}/configs", "#{base_dir}/shared" ]
6+
dirs.each do |path|
7+
describe directory(path) do
8+
it { should exist }
9+
end
10+
end
11+
end
12+
13+
control 'pcluster_log_dir_is_configured' do
14+
title 'Setup of ParallelCluster log folder'
15+
16+
describe directory("/var/log/parallelcluster") do
17+
it { should exist }
18+
its('owner') { should eq 'root' }
19+
its('mode') { should cmp '01777' }
20+
end
21+
end

0 commit comments

Comments
 (0)