summaryrefslogtreecommitdiffstats
path: root/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb
blob: e60740fb3d3815c09c77fca09be605cf4a2f7e8b (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
47
48
49
50
51
52
53
54
55
56
57
58
cookbook_file "/tmp/sdctool.tar" do
  source "sdctool.tar"
  mode 0755
end

execute "install tar" do
  command "/bin/tar xf /tmp/sdctool.tar -C /tmp"
  cwd "/tmp"
  action :run
end

template "janusgraph.properties" do
  sensitive true
  path "/tmp/sdctool/config/janusgraph.properties"
  source "janusgraph.properties.erb"
  mode "0755"
  variables({
     :DC_NAME                       => node['cassandra']['datacenter_name'],
     :cassandra_ip                  => node['Nodes']['CS'].first,
     :cassandra_port_num            => node['cassandra'][:cassandra_port],
     :janus_connection_timeout      => node['cassandra'][:janusgraph_connection_timeout],
     :cassandra_pwd                 => node['cassandra'][:cassandra_password],
     :cassandra_usr                 => node['cassandra'][:cassandra_user],
     :replication_factor            => node['cassandra']['replication_factor']
  })
end


template "/tmp/sdctool/config/configuration.yaml" do
  sensitive true
  source "configuration.yaml.erb"
  mode 0755
  variables({
      :host_ip                => node['Nodes']['BE'],
      :catalog_port           => node['BE'][:http_port],
      :ssl_port               => node['BE'][:https_port],
      :cassandra_ip           => node['Nodes']['CS'].first,
      :cassandra_port         => node['cassandra']['cassandra_port'],
      :rep_factor             => node['cassandra']['replication_factor'],
      :DC_NAME                => node['cassandra']['datacenter_name'],
      :janusgraph_Path        => "/tmp/sdctool/config/",
      :socket_connect_timeout => node['cassandra']['socket_connect_timeout'],
      :socket_read_timeout    => node['cassandra']['socket_read_timeout'],
      :cassandra_pwd          => node['cassandra'][:cassandra_password],
      :cassandra_usr          => node['cassandra'][:cassandra_user]
  })
end

execute "executing-schema-creation" do
  command "chmod +x /tmp/sdctool/scripts/schemaCreation.sh && /tmp/sdctool/scripts/schemaCreation.sh /tmp/sdctool/config"
  cwd "/tmp"
  action :run
end

execute "executing-janusGraphSchemaCreation.sh" do
  command "chmod +x /tmp/sdctool/scripts/janusGraphSchemaCreation.sh && /tmp/sdctool/scripts/janusGraphSchemaCreation.sh /tmp/sdctool/config"
  action :run
end