trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lium...@apache.org
Subject [1/2] incubator-trafodion git commit: [TRAFODION-2429] python installer - remove all templates file
Date Tue, 10 Jan 2017 02:36:46 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 6046c6ee4 -> e1fb1dfa3


[TRAFODION-2429] python installer - remove all templates file


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/ba6136d1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/ba6136d1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/ba6136d1

Branch: refs/heads/master
Commit: ba6136d13a172f5b2ac02345189a29964b2a74d7
Parents: 548a193
Author: Eason <hfutmkby@gmail.com>
Authored: Fri Jan 6 14:09:12 2017 +0800
Committer: Eason <hfutmkby@gmail.com>
Committed: Fri Jan 6 14:09:12 2017 +0800

----------------------------------------------------------------------
 .../configs/db_config_default.ini               |  5 +-
 install/python-installer/db_install.py          |  2 +-
 install/python-installer/scripts/common.py      |  3 +-
 install/python-installer/scripts/hadoop_mods.py |  4 +-
 install/python-installer/scripts/hdfs_cmds.py   |  4 +-
 install/python-installer/scripts/traf_ldap.py   | 17 ++--
 install/python-installer/scripts/traf_user.py   | 58 +++++++-------
 .../python-installer/templates/bashrc.template  | 81 --------------------
 .../templates/traf_authentication_conf.template | 71 -----------------
 9 files changed, 49 insertions(+), 196 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ba6136d1/install/python-installer/configs/db_config_default.ini
----------------------------------------------------------------------
diff --git a/install/python-installer/configs/db_config_default.ini b/install/python-installer/configs/db_config_default.ini
index 52f1f47..87efb4f 100644
--- a/install/python-installer/configs/db_config_default.ini
+++ b/install/python-installer/configs/db_config_default.ini
@@ -108,7 +108,10 @@ ldap_port = 389
 ldap_identifiers =
 ldap_encrypt = 0
 ldap_certpath =
-# provide if have
+
+# set to Y if user info is needed
+ldap_userinfo = N
+# provide if ldap_userinfo = Y
 ladp_user =
 ladp_pwd =
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ba6136d1/install/python-installer/db_install.py
----------------------------------------------------------------------
diff --git a/install/python-installer/db_install.py b/install/python-installer/db_install.py
index 34783ed..b972829 100755
--- a/install/python-installer/db_install.py
+++ b/install/python-installer/db_install.py
@@ -211,7 +211,7 @@ class UserInput(object):
         isuser = self.in_data[name].has_key('isuser')
 
         # check answer value basicly
-        answer = answer.rstrip()
+        answer = answer.strip()
         if answer:
             if isYN:
                 answer = answer.upper()

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ba6136d1/install/python-installer/scripts/common.py
----------------------------------------------------------------------
diff --git a/install/python-installer/scripts/common.py b/install/python-installer/scripts/common.py
index 5074bfd..68c4a6a 100644
--- a/install/python-installer/scripts/common.py
+++ b/install/python-installer/scripts/common.py
@@ -101,7 +101,8 @@ def run_cmd(cmd):
     p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
shell=True)
     stdout, stderr = p.communicate()
     if p.returncode != 0:
-        err('Failed to run command %s: %s' % (cmd, stderr))
+        msg = stderr if stderr else stdout
+        err('Failed to run command %s: %s' % (cmd, msg))
     return stdout.strip()
 
 def run_cmd_as_user(user, cmd):

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ba6136d1/install/python-installer/scripts/hadoop_mods.py
----------------------------------------------------------------------
diff --git a/install/python-installer/scripts/hadoop_mods.py b/install/python-installer/scripts/hadoop_mods.py
index c065d15..945057b 100755
--- a/install/python-installer/scripts/hadoop_mods.py
+++ b/install/python-installer/scripts/hadoop_mods.py
@@ -140,7 +140,7 @@ class HDPMod(object):
 
     def restart(self):
         srv_baseurl = CLUSTER_URL_PTR % (self.url, self.cluster_name) + '/services/'
-        srvs = ['HBASE', 'ZOOKEEPER', 'HDFS']
+        srvs = ['HBASE', 'HDFS', 'ZOOKEEPER']
 
         # Stop
         info('Restarting HDP services ...')
@@ -156,7 +156,7 @@ class HDPMod(object):
             else:
                 info('HDP service %s had already been stopped' % srv)
 
-        time.sleep(5)
+        time.sleep(10)
         # Start
         config = {'RequestInfo': {'context' :'Start All services'}, 'ServiceInfo': {'state'
: 'STARTED'}}
         rc = self.p.put(srv_baseurl, config)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ba6136d1/install/python-installer/scripts/hdfs_cmds.py
----------------------------------------------------------------------
diff --git a/install/python-installer/scripts/hdfs_cmds.py b/install/python-installer/scripts/hdfs_cmds.py
index dc08b7e..cf861b1 100755
--- a/install/python-installer/scripts/hdfs_cmds.py
+++ b/install/python-installer/scripts/hdfs_cmds.py
@@ -46,9 +46,9 @@ def run():
     hbase_user = dbcfgs['hbase_user']
 
     run_cmd_as_user(hdfs_user, '%s dfsadmin -safemode wait' % hdfs_bin)
-    run_cmd_as_user(hdfs_user, '%s dfs -mkdir -p %s/{trafodion_backups,bulkload,lobs} /hbase/archive
/hbase-staging' % (hdfs_bin, traf_loc))
+    run_cmd_as_user(hdfs_user, '%s dfs -mkdir -p %s/{trafodion_backups,bulkload,lobs} /bulkload
/lobs /hbase/archive /hbase-staging' % (hdfs_bin, traf_loc))
     run_cmd_as_user(hdfs_user, '%s dfs -chown -R %s:%s /hbase/archive /hbase-staging' % (hdfs_bin,
hbase_user, hbase_user))
-    run_cmd_as_user(hdfs_user, '%s dfs -chown -R %s:%s %s/{trafodion_backups,bulkload,lobs}'
% (hdfs_bin, traf_user, traf_user, traf_loc))
+    run_cmd_as_user(hdfs_user, '%s dfs -chown -R %s:%s %s/{trafodion_backups,bulkload,lobs}
/bulkload /lobs' % (hdfs_bin, traf_user, traf_user, traf_loc))
     run_cmd_as_user(hdfs_user, '%s dfs -setfacl -R -m user:%s:rwx /hbase/archive' % (hdfs_bin,
traf_user))
     run_cmd_as_user(hdfs_user, '%s dfs -setfacl -R -m default:user:%s:rwx /hbase/archive'
% (hdfs_bin, traf_user))
     run_cmd_as_user(hdfs_user, '%s dfs -setfacl -R -m mask::rwx /hbase/archive' % hdfs_bin)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ba6136d1/install/python-installer/scripts/traf_ldap.py
----------------------------------------------------------------------
diff --git a/install/python-installer/scripts/traf_ldap.py b/install/python-installer/scripts/traf_ldap.py
index 1f2c6fb..dbe3417 100755
--- a/install/python-installer/scripts/traf_ldap.py
+++ b/install/python-installer/scripts/traf_ldap.py
@@ -36,24 +36,23 @@ def run():
     TRAF_HOME = os.environ['TRAF_HOME']
     SQENV_FILE = TRAF_HOME + '/sqenvcom.sh'
     TRAF_AUTH_CONFIG = '%s/sql/scripts/.traf_authentication_config' % TRAF_HOME
-    TRAF_AUTH_TEMPLATE = '%s/templates/traf_authentication_conf.template' % TMP_DIR
+    TRAF_AUTH_TEMPLATE = '%s/sql/scripts/traf_authentication_config' % TRAF_HOME
 
     # set traf_authentication_config file
     change_items = {
-        '{{ ldap_hosts }}': dbcfgs['ldap_hosts'],
-        '{{ ldap_port }}': dbcfgs['ldap_port'],
-        '{{ ldap_identifiers }}': dbcfgs['ldap_identifiers'],
-        '{{ ldap_encrypt }}': dbcfgs['ldap_encrypt'],
-        '{{ ldap_certpath }}': dbcfgs['ldap_certpath'],
-        '{{ ldap_user }}': dbcfgs['ldap_user'],
-        '{{ ldap_pwd }}': dbcfgs['ldap_pwd']
+        'LDAPHostName:.*': 'LDAPHostName:%s' % dbcfgs['ldap_hosts'],
+        'LDAPPort:.*': 'LDAPPort:%s' % dbcfgs['ldap_port'],
+        'UniqueIdentifier:.*': 'UniqueIdentifier:%s' % dbcfgs['ldap_identifiers'],
+        'LDAPSSL:.*': 'LDAPSSL:%s' % dbcfgs['ldap_encrypt'],
+        'TLS_CACERTFilename:.*': 'TLS_CACERTFilename:%s' % dbcfgs['ldap_certpath'],
+        'LDAPSearchDN:.*': 'LDAPSearchDN:%s' % dbcfgs['ldap_user'],
+        'LDAPSearchPwd:.*': 'LDAPSearchPwd:%s' % dbcfgs['ldap_pwd']
     }
 
     print 'Modify authentication config file'
     run_cmd('cp %s %s' % (TRAF_AUTH_TEMPLATE, TRAF_AUTH_CONFIG))
     mod_file(TRAF_AUTH_CONFIG, change_items)
 
-
     print 'Check LDAP Configuration file for errors'
     run_cmd('ldapconfigcheck -file %s' % TRAF_AUTH_CONFIG)
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ba6136d1/install/python-installer/scripts/traf_user.py
----------------------------------------------------------------------
diff --git a/install/python-installer/scripts/traf_user.py b/install/python-installer/scripts/traf_user.py
index 01b80b3..ec5c250 100755
--- a/install/python-installer/scripts/traf_user.py
+++ b/install/python-installer/scripts/traf_user.py
@@ -26,7 +26,7 @@
 import os
 import sys
 import json
-from common import ParseXML, run_cmd, append_file, mod_file, \
+from common import ParseXML, run_cmd, append_file, mod_file, write_file, \
                    cmd_output, run_cmd_as_user, err, TMP_DIR
 
 def run():
@@ -53,11 +53,13 @@ def run():
     TRAF_DIRNAME = dbcfgs['traf_dirname']
     TRAF_HOME = '%s/%s' % (TRAF_USER_DIR, TRAF_DIRNAME)
 
+    TRAFODION_CFG_DIR = '/etc/trafodion/'
+    TRAFODION_CFG_FILE = '/etc/trafodion/trafodion_config'
     HBASE_XML_FILE = dbcfgs['hbase_xml_file']
     KEY_FILE = '/tmp/id_rsa'
     AUTH_KEY_FILE = '%s/.ssh/authorized_keys' % TRAF_USER_DIR
     SSH_CFG_FILE = '%s/.ssh/config' % TRAF_USER_DIR
-    BASHRC_TEMPLATE = '%s/templates/bashrc.template' % TMP_DIR
+    BASHRC_TEMPLATE = '%s/sqf/sysinstall/home/trafodion/.bashrc' % TRAF_HOME
     BASHRC_FILE = '%s/.bashrc' % TRAF_USER_DIR
     ULIMITS_FILE = '/etc/security/limits.d/%s.conf' % TRAF_USER
     HSPERFDATA_FILE = '/tmp/hsperfdata_trafodion'
@@ -68,6 +70,9 @@ def run():
 
     if not cmd_output('getent passwd %s' % TRAF_USER):
         run_cmd('useradd --shell /bin/bash -m %s -g %s --home %s --password "$(openssl passwd
%s)"' % (TRAF_USER, TRAF_GROUP, TRAF_USER_DIR, TRAF_PWD))
+        # copy bashrc to trafodion's home only if user doesn't exist
+        run_cmd('cp %s %s' % (BASHRC_TEMPLATE, BASHRC_FILE))
+        run_cmd('chown -R %s:%s %s*' % (TRAF_USER, TRAF_GROUP, BASHRC_FILE))
     elif not os.path.exists(TRAF_USER_DIR):
         run_cmd('mkdir -p %s' % TRAF_USER_DIR)
         run_cmd('chmod 700 %s' % TRAF_USER_DIR)
@@ -88,39 +93,38 @@ def run():
     run_cmd('chown -R %s:%s %s/.ssh/' % (TRAF_USER, TRAF_GROUP, TRAF_USER_DIR))
 
     hb = ParseXML(HBASE_XML_FILE)
-    zk_hosts = hb.get_property('hbase.zookeeper.quorum')
+    zk_nodes = hb.get_property('hbase.zookeeper.quorum')
     zk_port = hb.get_property('hbase.zookeeper.property.clientPort')
-    # set bashrc
+    # set trafodion_config
     nodes = dbcfgs['node_list'].split(',')
-    change_items = {
-        '{{ java_home }}': dbcfgs['java_home'],
-        '{{ traf_home }}': TRAF_HOME,
-        '{{ hadoop_type }}': hadoop_type,
-        '{{ node_list }}': ' '.join(nodes),
-        '{{ node_count }}': str(len(nodes)),
-        '{{ enable_ha }}': dbcfgs['enable_ha'],
-        '{{ zookeeper_nodes }}': zk_hosts,
-        '{{ zookeeper_port }}': zk_port,
-        '{{ my_nodes }}': ' -w ' + ' -w '.join(nodes)
-    }
-
-    mod_file(BASHRC_TEMPLATE, change_items)
+    trafodion_config = """
+export TRAF_HOME="%s"
+export MY_SQROOT=$TRAF_HOME # for compatibility
+export JAVA_HOME="%s"
+export NODE_LIST="%s"
+export MY_NODES="%s"
+export node_count="%s"
+export HADOOP_TYPE="%s"
+export ENABLE_HA="%s"
+export ZOOKEEPER_NODES="%s"
+export ZOOKEEPER_PORT="%s"
+""" % (TRAF_HOME, dbcfgs['java_home'], ' '.join(nodes), ' -w ' + ' -w '.join(nodes),
+       str(len(nodes)), hadoop_type, dbcfgs['enable_ha'], zk_nodes, zk_port)
+
+    run_cmd('mkdir -p %s' % TRAFODION_CFG_DIR)
+    write_file(TRAFODION_CFG_FILE, trafodion_config)
 
     if 'APACHE' in DISTRO:
-        bashrc_content = """
+        extra_config = """
 export HADOOP_PREFIX=%s
 export HBASE_HOME=%s
 export PATH=$PATH:$HADOOP_PREFIX/bin:$HADOOP_PREFIX/sbin:$HBASE_HOME/bin
         """ % (dbcfgs['hadoop_home'], dbcfgs['hbase_home'])
-        append_file(BASHRC_TEMPLATE, bashrc_content, position='HADOOP_TYPE')
+        append_file(TRAFODION_CFG_FILE, extra_config)
 
-    # backup bashrc if exsits
-    if os.path.exists(BASHRC_FILE):
-        run_cmd('cp %s %s.bak' % ((BASHRC_FILE,) *2))
+    # set permission
+    run_cmd('chown -R %s:%s %s*' % (TRAF_USER, TRAF_GROUP, TRAFODION_CFG_DIR))
 
-    # copy bashrc to trafodion's home
-    run_cmd('cp %s %s' % (BASHRC_TEMPLATE, BASHRC_FILE))
-    run_cmd('chown -R %s:%s %s*' % (TRAF_USER, TRAF_GROUP, BASHRC_FILE))
 
     # set ulimits for trafodion user
     ulimits_config = '''
@@ -135,11 +139,9 @@ export PATH=$PATH:$HADOOP_PREFIX/bin:$HADOOP_PREFIX/sbin:$HBASE_HOME/bin
 %s   hard   nproc 100000
 %s   soft nofile 8192
 %s   hard nofile 65535
-hbase soft nofile 8192
 ''' % ((TRAF_USER,) * 10)
 
-    with open(ULIMITS_FILE, 'w') as f:
-        f.write(ulimits_config)
+    write_file(ULIMITS_FILE, ulimits_config)
 
     # change permission for hsperfdata
     if os.path.exists(HSPERFDATA_FILE):

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ba6136d1/install/python-installer/templates/bashrc.template
----------------------------------------------------------------------
diff --git a/install/python-installer/templates/bashrc.template b/install/python-installer/templates/bashrc.template
deleted file mode 100644
index 010d282..0000000
--- a/install/python-installer/templates/bashrc.template
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/bin/sh
-
-# @@@ START COPYRIGHT @@@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# @@@ END COPYRIGHT @@@
-
-
-# This is the .bashrc for the Trafodion environment
-#
-#-------------------------------------------
-# Execute the system's default .bashrc first
-#-------------------------------------------
-if [ -f /etc/bashrc ]; then
-	. /etc/bashrc
-fi
-
-cd $HOME
-
-#-------------------------------------------
-# full path of your Trafodion installation
-#-------------------------------------------
-export TRAF_HOME="{{ traf_home }}"
-export MY_SQROOT="{{ traf_home }}" # for compatibility
-
-#-------------------------------------------
-# other env vars needed by Trafodion
-#-------------------------------------------
-
-# These env vars define all nodes in the cluster
-export JAVA_HOME="{{ java_home }}"
-export NODE_LIST="{{ node_list }}"
-export MY_NODES="{{ my_nodes }}"
-export node_count="{{ node_count }}"
-export HADOOP_TYPE="{{ hadoop_type }}"
-export ENABLE_HA="{{ enable_ha }}"
-export ZOOKEEPER_NODES="{{ zookeeper_nodes }}"
-export ZOOKEEPER_PORT="{{ zookeeper_port }}"
-
-#-------------------------------------------
-# Execute the sqenv.sh script if it exists.
-#-------------------------------------------
-PATH=".:$PATH"
-if [ -f $TRAF_HOME/sqenv.sh ]; then
-	pushd . >/dev/null
-	cd $TRAF_HOME
-	source ./sqenv.sh
-	popd >/dev/null
-	export MANPATH=$MANPATH:$MPI_ROOT/share/man
-fi
-
-#-------------------------------------------
-# additional settings for Trafodion environment
-#-------------------------------------------
-ETC_SECURITY_MSG="***ERROR: To fix this please configure /etc/security/limits.conf properly
on $HOSTNAME."
-
-# set core file size
-ulimit -c unlimited
-
-# set max open files
-ulimit -n 32768
-if [ $? -ne 0 ]; then
-    echo "***ERROR: Unable to set max open files. Current value $(ulimit -n)"
-    echo $ETC_SECURITY_MSG
-fi

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ba6136d1/install/python-installer/templates/traf_authentication_conf.template
----------------------------------------------------------------------
diff --git a/install/python-installer/templates/traf_authentication_conf.template b/install/python-installer/templates/traf_authentication_conf.template
deleted file mode 100644
index f15dd70..0000000
--- a/install/python-installer/templates/traf_authentication_conf.template
+++ /dev/null
@@ -1,71 +0,0 @@
-# @@@ START COPYRIGHT @@@
-# #
-# # Licensed to the Apache Software Foundation (ASF) under one
-# # or more contributor license agreements.  See the NOTICE file
-# # distributed with this work for additional information
-# # regarding copyright ownership.  The ASF licenses this file
-# # to you under the Apache License, Version 2.0 (the
-# # "License"); you may not use this file except in compliance
-# # with the License.  You may obtain a copy of the License at
-# #
-# #   http://www.apache.org/licenses/LICENSE-2.0
-# #
-# # Unless required by applicable law or agreed to in writing,
-# # software distributed under the License is distributed on an
-# # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# # KIND, either express or implied.  See the License for the
-# # specific language governing permissions and limitations
-# # under the License.
-# #
-# # @@@ END COPYRIGHT @@@
-# #
-#
-# This is the template file for Trafodion database authentication
-# directory service configuration.
-#
-# To use authentication in Trafodion, this file must be configured
-# as described below and placed in $TRAF_HOME/sql/scripts and be named
-# .traf_authentication_config.  You must also enable authentication by
-# running the script traf_authentication_setup in $TRAF_HOME/sql/scripts.
-#
-# NOTE: the format of this configuration file is expected to change in the
-# next release of Trafodion.  Backward compatilibity is not guaranteed.
-#
-SECTION: Defaults
-  DefaultSectionName: local
-  RefreshTime: 1800
-  TLS_CACERTFilename: {{ ldap_certpath }}
-SECTION: local
-# If one or more of the LDAPHostName values is a load balancing host, list
-# the name(s) here, one name: value pair for each host.
-  LoadBalanceHostName:
-
-# One or more identically configured hosts must be specified here,
-# one name: value pair for each host.
-  LdapHostname: {{ ldap_hosts }}
-
-# Default is port 389, change if using 636 or any other port
-  LdapPort: {{ ldap_port }}
-
-# Must specify one or more unique identifiers, one name: value pair for each
-  UniqueIdentifier: {{ ldap_identifiers }}
-
-# If the configured LDAP server requires a username and password to
-# to perform name lookup, provide those here.
-  LDAPSearchDN: {{ ldap_user }}
-  LDAPSearchPwd: {{ ldap_pwd }}
-
-# If configured LDAP server requires TLS(1) or SSL (2), update this value
-  LDAPSSL: {{ ldap_encrypt }}
-
-# Default timeout values in seconds
-  LDAPNetworkTimeout: 30
-  LDAPTimeout: 30
-  LDAPTimeLimit: 30
-
-# Default values for retry logic algorithm
-  RetryCount: 5
-  RetryDelay: 2
-  PreserveConnection: No
-  ExcludeBadHosts: Yes
-  MaxExcludeListSize: 3


Mime
View raw message