aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/07-importComformance.rb
blob: ac91d1892b8e53dcb7a6243fb91961a0c0fdda78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
working_directory =  "/tmp"
cl_release=node['version'].split('.')[0..2].join('.').split('-')[0]
printf("\033[33mcl_release=[%s]\n\033[0m", cl_release)

cookbook_file "/tmp/sdctool.tar" do
   source "sdctool.tar"
end

bash "extract sdctool.tar" do
  cwd "#{working_directory}"
  code <<-EOH
    tar xvf /tmp/sdctool.tar
  EOH
end

cookbook_file "/tmp/sdctool/config/SDC.zip" do
   source "SDC-#{cl_release}.zip"
end

bash "import-Comformance" do
  cwd "#{working_directory}"
  code <<-EOH
    conf_dir=/tmp/sdctool/config
    schema_file_name=SDC.zip

    cl_version=`grep 'toscaConformanceLevel:' $conf_dir/configuration.yaml |awk '{print $2}'`

    cd /tmp/sdctool/scripts
    /bin/chmod +x sdcSchemaFileImport.sh
    echo "execute /tmp/sdctool/scripts/sdcSchemaFileImport.sh $conf_dir/$schema_file_name #{cl_release} $cl_version $conf_dir "
    ./sdcSchemaFileImport.sh ${conf_dir}/${schema_file_name} $cl_release ${cl_version} ${conf_dir} 
  EOH
end