expose timeout setting

expose setting of time out in env.json
remove the hard codeing of password in the configuration,
cs password is set using the envjson.

Change-Id: I09cc1f99914f444900e6b73d2ae438c72527ba2c
Issue-ID: SDC-833
Signed-off-by: Michael Lando <ml636r@att.com>
diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/02-createCsUser.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/02-createCsUser.rb
index 1ebc80d..d9041f2 100644
--- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/02-createCsUser.rb
+++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/02-createCsUser.rb
@@ -3,7 +3,9 @@
   sensitive true
   mode 0755
   variables({
-     :cassandra_ip => "HOSTIP"    
+     :cassandra_ip => "HOSTIP",
+     :cassandra_pwd => node['cassandra'][:cassandra_password],
+     :cassandra_usr => node['cassandra'][:cassandra_user]
   })
 end
 
diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/03-createDoxKeyspace.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/03-createDoxKeyspace.rb
index 789f658..4e37d49 100644
--- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/03-createDoxKeyspace.rb
+++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/03-createDoxKeyspace.rb
@@ -4,7 +4,9 @@
     mode 0755
     variables({
       :cassandra_ip => "HOSTIP",
-      :DC_NAME      => node['cassandra'][:cluster_name]+node.chef_environment
+      :DC_NAME      => node['cassandra'][:cluster_name]+node.chef_environment,
+      :cassandra_pwd => node['cassandra'][:cassandra_password],
+      :cassandra_usr => node['cassandra'][:cassandra_user]
     })
 end
 
diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/04-schemaCreation.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/04-schemaCreation.rb
index 5890603..0bb0027 100644
--- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/04-schemaCreation.rb
+++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/04-schemaCreation.rb
@@ -18,7 +18,10 @@
   source "titan.properties.erb"
   mode "0755"
   variables({
-      :DC_NAME      => node['cassandra'][:cluster_name]+node.chef_environment
+      :DC_NAME      => node['cassandra'][:cluster_name]+node.chef_environment,
+     :cassandra_pwd => node['cassandra'][:cassandra_password],
+     :cassandra_usr => node['cassandra'][:cassandra_user],
+     :titan_connection_timeout => node['cassandra']['titan_connection_timeout']
   })
 end
 
@@ -28,13 +31,17 @@
   source "configuration.yaml.erb"
   mode 0755
   variables({
-      :host_ip      => node['HOST_IP'],
-      :catalog_port => node['BE'][:http_port],
-      :ssl_port     => node['BE'][:https_port],
-      :cassandra_ip => node['Nodes']['CS'],
-      :rep_factor   => 1,
-      :DC_NAME      => node['cassandra'][:cluster_name]+node.chef_environment,
-      :titan_Path   => "/tmp/sdctool/config/"
+      :host_ip                => node['HOST_IP'],
+      :catalog_port           => node['BE'][:http_port],
+      :ssl_port               => node['BE'][:https_port],
+      :cassandra_ip           => node['Nodes']['CS'],
+      :rep_factor             => 1,
+      :DC_NAME                => node['cassandra'][:cluster_name]+node.chef_environment,
+      :titan_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
 
diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/05-titanSchemaCreation.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/05-titanSchemaCreation.rb
index a3af2f4..fa9ae79 100644
--- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/05-titanSchemaCreation.rb
+++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/05-titanSchemaCreation.rb
@@ -19,7 +19,10 @@
   source "titan.properties.erb"
   mode "0755"
   variables({
-      :DC_NAME      => node['cassandra'][:cluster_name]+node.chef_environment
+      :DC_NAME                  => node['cassandra'][:cluster_name]+node.chef_environment,
+      :cassandra_pwd            => node['cassandra'][:cassandra_password],
+      :cassandra_usr            => node['cassandra'][:cassandra_user],
+      :titan_connection_timeout => node['cassandra']['titan_connection_timeout']
   })
 end
 
@@ -29,13 +32,17 @@
   source "configuration.yaml.erb"
   mode 0755
   variables({
-      :host_ip      => node['HOST_IP'],
-      :catalog_port => node['BE'][:http_port],
-      :ssl_port     => node['BE'][:https_port],
-      :cassandra_ip => node['Nodes']['CS'],
-      :rep_factor   => 1,
-      :DC_NAME      => node['cassandra'][:cluster_name]+node.chef_environment,
-      :titan_Path   => "/tmp/sdctool/config"
+      :host_ip       => node['HOST_IP'],
+      :catalog_port  => node['BE'][:http_port],
+      :ssl_port      => node['BE'][:https_port],
+      :cassandra_ip  => node['Nodes']['CS'],
+      :rep_factor    => 1,
+      :DC_NAME       => node['cassandra'][:cluster_name]+node.chef_environment,
+      :titan_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
 
diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/configuration.yaml.erb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/configuration.yaml.erb
index 03a5bfb..f99737b 100644
--- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/configuration.yaml.erb
+++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/configuration.yaml.erb
@@ -70,6 +70,8 @@
     cassandraHosts: [<%= @cassandra_ip %>]
     localDataCenter: <%= @DC_NAME %>
     reconnectTimeout : 30000
+    socketReadTimeout: <%= @socket_read_timeout %>
+    socketConnectTimeout: <%= @socket_connect_timeout %>
     authenticate: true
     username: asdc_user
     password: Aa1234%^!
diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/create_cassandra_user.sh.erb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/create_cassandra_user.sh.erb
index 6b97224..9fcf165 100644
--- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/create_cassandra_user.sh.erb
+++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/create_cassandra_user.sh.erb
@@ -1,7 +1,7 @@
 #!/bin/bash
 
-CASSANDRA_USER=asdc_user
-CASSANDRA_PASS=Aa1234%^!
+CASSANDRA_USER=<%= @cassandra_usr %>
+CASSANDRA_PASS=<%= @cassandra_pwd %>
 CASSANDRA_IP=<%= @cassandra_ip %>
 
 pass_changed=99
diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/create_dox_keyspace.sh.erb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/create_dox_keyspace.sh.erb
index 37b7859..e316234 100644
--- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/create_dox_keyspace.sh.erb
+++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/create_dox_keyspace.sh.erb
@@ -1,7 +1,7 @@
 #!/bin/bash
 
-CASSANDRA_USER=asdc_user
-CASSANDRA_PASS='Aa1234%^!'
+CASSANDRA_USER='<%= @cassandra_usr %>'
+CASSANDRA_PASS='<%= @cassandra_pwd %>'
 
 KEYSPACE="CREATE KEYSPACE IF NOT EXISTS dox WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', '<%= @DC_NAME %>': '1'};"
 KEYSPACE1="CREATE KEYSPACE IF NOT EXISTS zusammen_dox WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', '<%= @DC_NAME %>': '1'};"
diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/titan.properties.erb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/titan.properties.erb
index bccf221..6f7859e 100644
--- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/titan.properties.erb
+++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/titan.properties.erb
@@ -1,25 +1,29 @@
 storage.backend=cassandra
 storage.hostname=localhost
 storage.port=9160
-storage.username=asdc_user
-storage.password=Aa1234%^!
+storage.username=<%= @cassandra_usr %>
+storage.password=<%= @cassandra_pwd %>
+storage.connection-timeout=<%= @titan_connection_timeout %>
 storage.cassandra.keyspace=sdctitan
 
+
 storage.cassandra.ssl.enabled=false
 storage.cassandra.ssl.truststore.location=/var/lib/jetty/config/.truststore
 storage.cassandra.ssl.truststore.password=Aa123456
 
-cache.db-cache = false
-cache.db-cache-clean-wait = 20
-cache.db-cache-time = 180000
-cache.db-cache-size = 0.5
-
 storage.cassandra.read-consistency-level=LOCAL_QUORUM
 storage.cassandra.write-consistency-level=LOCAL_QUORUM
 storage.cassandra.replication-strategy-class=org.apache.cassandra.locator.NetworkTopologyStrategy
 storage.cassandra.replication-strategy-options=<%= @DC_NAME %>,1
 storage.cassandra.astyanax.local-datacenter=<%= @DC_NAME %>
 
+cache.db-cache = false
+cache.db-cache-clean-wait = 20
+cache.db-cache-time = 180000
+cache.db-cache-size = 0.5
+
+cache.tx-cache-size = 1000000
+
 storage.lock.retries=5
 storage.lock.wait-time=500
 
diff --git a/sdc-os-chef/sdc-cassandra/startup.sh b/sdc-os-chef/sdc-cassandra/startup.sh
index 2f7cc3c..49edc26 100755
--- a/sdc-os-chef/sdc-cassandra/startup.sh
+++ b/sdc-os-chef/sdc-cassandra/startup.sh
@@ -20,6 +20,7 @@
 sleep 10
 
 chef-solo -c solo.rb  -E ${CHEFNAME}
-
+rc=$?
+if [[ $rc != 0 ]]; then exit $rc; fi
 while true; do sleep 2; done