diff options
author | Yuli Shlosberg <ys9693@att.com> | 2018-01-25 13:53:36 +0200 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2018-02-04 10:39:20 +0000 |
commit | 0875ce0faad191c21b32cc9c95ffc20ebd57d586 (patch) | |
tree | 28520da212637e0f67697d9ff837e80da6eaa408 /sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/create_cassandra_user.sh.erb | |
parent | b676b6dcada5549348003191c09142e92de4d352 (diff) |
Cassandra OOM Alignment
Change-Id: If9792919dba17936965b45361888a44a12a76b67
Issue-ID: SDC-911
Signed-off-by: Yuli Shlosberg <ys9693@att.com>
Diffstat (limited to 'sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/create_cassandra_user.sh.erb')
-rw-r--r-- | sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/create_cassandra_user.sh.erb | 57 |
1 files changed, 0 insertions, 57 deletions
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 deleted file mode 100644 index 9fcf165f44..0000000000 --- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/create_cassandra_user.sh.erb +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -CASSANDRA_USER=<%= @cassandra_usr %> -CASSANDRA_PASS=<%= @cassandra_pwd %> -CASSANDRA_IP=<%= @cassandra_ip %> - -pass_changed=99 -retry_num=1 -is_up=0 -while [ $is_up -eq 0 -a $retry_num -le 100 ]; do - echo "exit" | cqlsh -u cassandra -p cassandra $CASSANDRA_IP > /dev/null 2>&1 - res1=$? - echo "exit" | cqlsh -u cassandra -p $CASSANDRA_PASS $CASSANDRA_IP > /dev/null 2>&1 - res2=$? - - if [ $res1 -eq 0 -o $res2 -eq 0 ]; then - echo "`date` --- cqlsh is enabled to connect." - is_up=1 - [ $res1 -eq 0 ] && pass_changed=0 - [ $res2 -eq 0 ] && pass_changed=1 - else - echo "`date` --- cqlsh is NOT enabled to connect yet. sleep 5" - sleep 5 - fi - let "retry_num++" -done - - -echo "pass_changed=[$pass_changed]" -case $pass_changed in - 0) - cassandra_user_exist=`echo "list users;" | cqlsh -u cassandra -p cassandra $CASSANDRA_IP |grep -c $CASSANDRA_USER` - if [ $cassandra_user_exist -eq 1 ] ; then - echo "cassandra user $CASSANDRA_USER already exist" - echo "alter user $CASSANDRA_USER with password '$CASSANDRA_PASS' nosuperuser;" | cqlsh -u cassandra -p cassandra $CASSANDRA_IP - else - echo "Going to create $CASSANDRA_USER" - echo "create user $CASSANDRA_USER with password '$CASSANDRA_PASS' nosuperuser;" | cqlsh -u cassandra -p cassandra $CASSANDRA_IP - fi - echo "Modify cassandra password" - echo "ALTER USER cassandra WITH PASSWORD '$CASSANDRA_PASS';" | cqlsh -u cassandra -p cassandra $CASSANDRA_IP - ;; - 1) - cassandra_user_exist=`echo "list users;" | cqlsh -u cassandra -p $CASSANDRA_PASS $CASSANDRA_IP |grep -c $CASSANDRA_USER` - if [ $cassandra_user_exist -eq 1 ] ; then - echo "cassandra user $CASSANDRA_USER already exist" - echo "alter user $CASSANDRA_USER with password '$CASSANDRA_PASS' nosuperuser;" | cqlsh -u cassandra -p $CASSANDRA_PASS $CASSANDRA_IP - else - echo "Going to create $CASSANDRA_USER" - echo "create user $CASSANDRA_USER with password '$CASSANDRA_PASS' nosuperuser;" | cqlsh -u cassandra -p $CASSANDRA_PASS $CASSANDRA_IP - fi - ;; - *) - echo "pass_changed doen't have value" - ;; -esac - |