diff options
author | 2017-10-30 20:18:11 +0200 | |
---|---|---|
committer | 2017-10-30 19:08:27 +0000 | |
commit | 93c2e98ea8b851b0758c81762cb97b473d61d6cb (patch) | |
tree | ec9ae26b9b1521799f549010465412c59750468b /sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_create_DMaaP_keys.rb-NotUsed | |
parent | 2ef9d4814d4f1dba2654a41459addc35c8356d26 (diff) |
New normativeType Allotted Resource & Recepies
Change-Id: I0602cec92497bbf0b926996b88ccbe6b3f02bbef
Issue-ID:SDC-556
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_create_DMaaP_keys.rb-NotUsed')
-rw-r--r-- | sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_create_DMaaP_keys.rb-NotUsed | 34 |
1 files changed, 34 insertions, 0 deletions
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 + |