aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/1_create_consumer_and_user.rb
blob: 97d140ab1fab5c0c3a2c0838cb37ea240b5bb518 (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
37
38
39
40
41
42
43
44
45
46
if node['disableHttp']
  protocol = "https"
  be_port = node['BE']['https_port']
else
  protocol = "http"
  be_port = node['BE']['http_port']
end


template "/var/tmp/user.py" do
    source "user.py.erb"
    sensitive true
    mode 0755
    variables({
      :protocol => protocol,
      :be_ip => node['Nodes']['BE'],
      :be_port => be_port
    })
end

bash "executing-create_user" do
   code <<-EOH
     python /var/tmp/user.py
     rc=$?
     if [[ $rc != 0 ]]; then exit $rc; fi
   EOH
end

template "/var/tmp/consumers.py" do
    source "consumers.py.erb"
    sensitive true
    mode 0755
    variables({
      :protocol => protocol,
      :be_ip => node['Nodes']['BE'],
      :be_port => be_port
    })
end

bash "executing-consumers" do
   code <<-EOH
     python /var/tmp/consumers.py
     rc=$?
     if [[ $rc != 0 ]]; then exit $rc; fi
   EOH
end