From 68bf7207a2097a0313c272e5a851373bfe69761d Mon Sep 17 00:00:00 2001 From: Tal Gitelman Date: Mon, 30 Oct 2017 20:18:11 +0200 Subject: New normativeType Allotted Resource & Recepies Change-Id: I0602cec92497bbf0b926996b88ccbe6b3f02bbef Issue-ID:SDC-556 Signed-off-by: Tal Gitelman --- .../recipes/BE_10_import_Normatives.rb | 16 ---------- .../recipes/BE_4_create_DMaaP_keys.rb | 34 ---------------------- .../sdc-catalog-be/recipes/BE_4_jetty_Modules.rb | 22 ++++++++++++++ .../sdc-catalog-be/recipes/BE_5_jetty_Modules.rb | 22 -------------- .../recipes/BE_5_setup_elasticsearch.rb | 15 ++++++++++ .../recipes/BE_6_setup_elasticsearch.rb | 15 ---------- .../recipes/BE_6_setup_portal_properties.rb | 17 +++++++++++ .../sdc-catalog-be/recipes/BE_7_logback.rb | 7 +++++ .../recipes/BE_7_setup_portal_properties.rb | 17 ----------- .../sdc-catalog-be/recipes/BE_8_errors_config.rb | 14 +++++++++ .../sdc-catalog-be/recipes/BE_8_logback.rb | 7 ----- .../sdc-catalog-be/recipes/BE_9_errors_config.rb | 14 --------- .../recipes/BE_Number_create_DMaaP_keys.rb-NotUsed | 34 ++++++++++++++++++++++ .../recipes/BE_Number_import_Normatives.rb | 16 ++++++++++ 14 files changed, 125 insertions(+), 125 deletions(-) delete mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_import_Normatives.rb delete mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_create_DMaaP_keys.rb create mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb delete mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_jetty_Modules.rb create mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb delete mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_elasticsearch.rb create mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_properties.rb create mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb delete mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_setup_portal_properties.rb create mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb delete mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_logback.rb delete mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_errors_config.rb create mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_create_DMaaP_keys.rb-NotUsed create mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_import_Normatives.rb (limited to 'sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be') diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_import_Normatives.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_import_Normatives.rb deleted file mode 100644 index 6e9b24133d..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_import_Normatives.rb +++ /dev/null @@ -1,16 +0,0 @@ -cookbook_file "/tmp/normatives.tar.gz" do - source "normatives.tar.gz" -end - -working_directory = "/tmp" - -bash "import-normatives" do - cwd "#{working_directory}" - code <<-EOH - tar xvfz /tmp/normatives.tar.gz - cd scripts/import/tosca/ - /bin/chmod +x importNormativeAll.py - python importNormativeAll.py - EOH -end - diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_create_DMaaP_keys.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_create_DMaaP_keys.rb deleted file mode 100644 index 583dfff7b2..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_create_DMaaP_keys.rb +++ /dev/null @@ -1,34 +0,0 @@ -http_request 'create-DMaaP-apiKeys' do - action :post - url 'http://23.253.97.75:3904/apiKeys/create' - message ({:some => 'data'}.to_json) - headers({ - 'Content-Type' => 'application/json' - }) -end - - -selfEnviroment = node.chef_environment - -ruby_block "create-DMaaP-apiKeys" do - block do - sleep(15) - #tricky way to load this Chef::Mixin::ShellOut utilities - Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut) - curl_command = "https://es_admin:Aa123456@#{application_host}:9200/_cluster/health?pretty=true --insecure" - resp = Net::HTTP.get_response URI.parse(curl_command) - stat = JSON.parse(resp.read_body)['status'] - - case stat - when "green" - printf("\033[32m%s\n\033[0m", " ElasticSearch tests completed successfully.") - when "yellow" - printf("\033[33m%s\n\033[0m", " ElasticSearch tests completed successfully, with warnings") - when "red" - printf("\033[31m%s\n\033[0m", " ElasticSearch tests failed!!!") - end - end -end - -curl POST -d '{"email":"Grinberg.Moti","description":"New Api Key for ASDC OS"}' http://23.253.97.75:3904/apiKeys/create - diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb new file mode 100644 index 0000000000..046e3c6919 --- /dev/null +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb @@ -0,0 +1,22 @@ +jetty_base="/var/lib/jetty" +jetty_home="/usr/local/jetty" + +###### create Jetty modules +bash "create-jetty-modules" do +cwd "#{jetty_base}" +code <<-EOH + cd "#{jetty_base}" + java -jar "/#{jetty_home}"/start.jar --add-to-start=deploy + java -jar "/#{jetty_home}"/start.jar --add-to-startd=http,https,logging,setuid +EOH +not_if "ls /#{jetty_base}/start.d/https.ini" +end + +template "ssl-ini" do + path "/#{jetty_base}/start.d/ssl.ini" + source "ssl-ini.erb" + owner "jetty" + group "jetty" + mode "0755" + variables :https_port => "#{node['BE'][:https_port]}" +end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_jetty_Modules.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_jetty_Modules.rb deleted file mode 100644 index 046e3c6919..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_jetty_Modules.rb +++ /dev/null @@ -1,22 +0,0 @@ -jetty_base="/var/lib/jetty" -jetty_home="/usr/local/jetty" - -###### create Jetty modules -bash "create-jetty-modules" do -cwd "#{jetty_base}" -code <<-EOH - cd "#{jetty_base}" - java -jar "/#{jetty_home}"/start.jar --add-to-start=deploy - java -jar "/#{jetty_home}"/start.jar --add-to-startd=http,https,logging,setuid -EOH -not_if "ls /#{jetty_base}/start.d/https.ini" -end - -template "ssl-ini" do - path "/#{jetty_base}/start.d/ssl.ini" - source "ssl-ini.erb" - owner "jetty" - group "jetty" - mode "0755" - variables :https_port => "#{node['BE'][:https_port]}" -end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb new file mode 100644 index 0000000000..39fc5af883 --- /dev/null +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb @@ -0,0 +1,15 @@ +clusterName = node['elasticsearch'][:cluster_name]+node.chef_environment +node_name = node[:hostname] + +template "elasticsearch.yml-config" do + path "/var/lib/jetty/config/elasticsearch.yml" + source "BE-elasticsearch.yml.erb" + owner "jetty" + group "jetty" + mode "0755" + variables({ + :cluster_name => "#{clusterName}", + :es_host_ip => node['Nodes']['ES'] + }) +end + diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_elasticsearch.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_elasticsearch.rb deleted file mode 100644 index 39fc5af883..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_elasticsearch.rb +++ /dev/null @@ -1,15 +0,0 @@ -clusterName = node['elasticsearch'][:cluster_name]+node.chef_environment -node_name = node[:hostname] - -template "elasticsearch.yml-config" do - path "/var/lib/jetty/config/elasticsearch.yml" - source "BE-elasticsearch.yml.erb" - owner "jetty" - group "jetty" - mode "0755" - variables({ - :cluster_name => "#{clusterName}", - :es_host_ip => node['Nodes']['ES'] - }) -end - diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_properties.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_properties.rb new file mode 100644 index 0000000000..8c57de6caf --- /dev/null +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_properties.rb @@ -0,0 +1,17 @@ +template "template portal.properties" do + path "/var/lib/jetty/resources/portal.properties" + source "BE-portal.properties.erb" + owner "jetty" + group "jetty" + mode "0755" + variables ({ + :ecomp_rest_url => node['ECompP']['ecomp_rest_url'], + :ecomp_redirect_url => node['ECompP']['ecomp_redirect_url'], + :ueb_url_list => node['ECompP']['ueb_url_list'], + :inbox_name => node['ECompP']['inbox_name'], + :app_key => node['ECompP']['app_key'], + :app_secret => node['ECompP']['app_secret'], + :app_topic_name => node['ECompP']['app_topic_name'], + :decrypt_key => node['ECompP']['decryption_key'] + }) +end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb new file mode 100644 index 0000000000..2dfc4f1089 --- /dev/null +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb @@ -0,0 +1,7 @@ +cookbook_file "/var/lib/jetty/config/catalog-be/logback.xml" do + source "logback.xml" + mode 0755 + owner "jetty" + group "jetty" +end + diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_setup_portal_properties.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_setup_portal_properties.rb deleted file mode 100644 index 8c57de6caf..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_setup_portal_properties.rb +++ /dev/null @@ -1,17 +0,0 @@ -template "template portal.properties" do - path "/var/lib/jetty/resources/portal.properties" - source "BE-portal.properties.erb" - owner "jetty" - group "jetty" - mode "0755" - variables ({ - :ecomp_rest_url => node['ECompP']['ecomp_rest_url'], - :ecomp_redirect_url => node['ECompP']['ecomp_redirect_url'], - :ueb_url_list => node['ECompP']['ueb_url_list'], - :inbox_name => node['ECompP']['inbox_name'], - :app_key => node['ECompP']['app_key'], - :app_secret => node['ECompP']['app_secret'], - :app_topic_name => node['ECompP']['app_topic_name'], - :decrypt_key => node['ECompP']['decryption_key'] - }) -end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb new file mode 100644 index 0000000000..684d730709 --- /dev/null +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb @@ -0,0 +1,14 @@ +cookbook_file "/var/lib/jetty/config/catalog-be/ecomp-error-configuration.yaml" do + source "ecomp-error-configuration.yaml" + mode 0755 + owner "jetty" + group "jetty" +end + +cookbook_file "/var/lib/jetty/config/catalog-be/error-configuration.yaml" do + source "error-configuration.yaml" + mode 0755 + owner "jetty" + group "jetty" +end + diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_logback.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_logback.rb deleted file mode 100644 index 2dfc4f1089..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_logback.rb +++ /dev/null @@ -1,7 +0,0 @@ -cookbook_file "/var/lib/jetty/config/catalog-be/logback.xml" do - source "logback.xml" - mode 0755 - owner "jetty" - group "jetty" -end - diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_errors_config.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_errors_config.rb deleted file mode 100644 index 684d730709..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_errors_config.rb +++ /dev/null @@ -1,14 +0,0 @@ -cookbook_file "/var/lib/jetty/config/catalog-be/ecomp-error-configuration.yaml" do - source "ecomp-error-configuration.yaml" - mode 0755 - owner "jetty" - group "jetty" -end - -cookbook_file "/var/lib/jetty/config/catalog-be/error-configuration.yaml" do - source "error-configuration.yaml" - mode 0755 - owner "jetty" - group "jetty" -end - diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_create_DMaaP_keys.rb-NotUsed b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_create_DMaaP_keys.rb-NotUsed new file mode 100644 index 0000000000..583dfff7b2 --- /dev/null +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_create_DMaaP_keys.rb-NotUsed @@ -0,0 +1,34 @@ +http_request 'create-DMaaP-apiKeys' do + action :post + url 'http://23.253.97.75:3904/apiKeys/create' + message ({:some => 'data'}.to_json) + headers({ + 'Content-Type' => 'application/json' + }) +end + + +selfEnviroment = node.chef_environment + +ruby_block "create-DMaaP-apiKeys" do + block do + sleep(15) + #tricky way to load this Chef::Mixin::ShellOut utilities + Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut) + curl_command = "https://es_admin:Aa123456@#{application_host}:9200/_cluster/health?pretty=true --insecure" + resp = Net::HTTP.get_response URI.parse(curl_command) + stat = JSON.parse(resp.read_body)['status'] + + case stat + when "green" + printf("\033[32m%s\n\033[0m", " ElasticSearch tests completed successfully.") + when "yellow" + printf("\033[33m%s\n\033[0m", " ElasticSearch tests completed successfully, with warnings") + when "red" + printf("\033[31m%s\n\033[0m", " ElasticSearch tests failed!!!") + end + end +end + +curl POST -d '{"email":"Grinberg.Moti","description":"New Api Key for ASDC OS"}' http://23.253.97.75:3904/apiKeys/create + diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_import_Normatives.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_import_Normatives.rb new file mode 100644 index 0000000000..6e9b24133d --- /dev/null +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_import_Normatives.rb @@ -0,0 +1,16 @@ +cookbook_file "/tmp/normatives.tar.gz" do + source "normatives.tar.gz" +end + +working_directory = "/tmp" + +bash "import-normatives" do + cwd "#{working_directory}" + code <<-EOH + tar xvfz /tmp/normatives.tar.gz + cd scripts/import/tosca/ + /bin/chmod +x importNormativeAll.py + python importNormativeAll.py + EOH +end + -- cgit 1.2.3-korg