From c77b4d5e0aeddadce9867f82cf42cd707e3720e3 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Thu, 16 Aug 2012 21:18:56 -0500 Subject: LinHES-config: fix hostype change after a system is installed. --- abs/core/LinHES-config/PKGBUILD | 10 +++--- abs/core/LinHES-config/mv_hostype.py | 36 +++++++++++++++++----- abs/core/LinHES-config/myth_settings_wrapper.sh | 15 +++++++-- abs/core/LinHES-config/restore_default_settings.sh | 14 +++++++++ 4 files changed, 60 insertions(+), 15 deletions(-) diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD index 0666eac..30ffeef 100644 --- a/abs/core/LinHES-config/PKGBUILD +++ b/abs/core/LinHES-config/PKGBUILD @@ -119,8 +119,8 @@ md5sums=('5d40d7ce4cd99fae059cac37cef9440f' '5a31addfbdc1154b05997f972a32fa33' 'c20f73d4da5d7e15e1f3eb85c7dcb49a' '68199e861c2933ccbb84735b9b440157' - '9ae8d79f620c6d19973c55c32a921874' - '79579277e0545aeeb50fba403434194c' + '2a7f3b34e522acfd08283b86c8926aba' + '60103d94ada98ac583fea620294f14d3' '960017a34d9cc78af6298f45aad6eb8e' 'ecf9e5df20683a769c4a8a8f2d65de85' '6d32a88e76b0a97b0ce67d37ef6394aa' @@ -137,14 +137,14 @@ md5sums=('5d40d7ce4cd99fae059cac37cef9440f' 'b845de3e05c1734cce4b9ac5e8f1baaf' '6801f87992b44118a12b6dfe6ea68127' '5e69839659d65ddda35b8a9982dc29e9' - '3afd18517bb765d1680f4fcc8d08c9cc' + '2934fd80277e4598856f3171ccef9bfd' '824e49d9b01fed295c704ab68908b464' 'fe5e31b833cc6707209e9d656b6eb53c' 'ecb52b9b7a9ac0c8988093c1dfdda635' '23d0e12b7ca1cc6ea6b993c1d7ff20b9' - 'fd2414d9b0e611a95e858cae5736ccad' + '6924cdcc5e7ed0c073b669362b0366e1' '755c05b833aca6c5be130972af052e8b' - 'd8f80e5686d02555f044363f1ac17d97' + '5cdb3ef03d5a2a99889a458a82228ecc' '2596460462cf6c889cf8f95485537b20' 'a63ff9ef5250965aeabc74bfa8e43981' '4804aa93aaad3dfcfff08cd9ffd68836') diff --git a/abs/core/LinHES-config/mv_hostype.py b/abs/core/LinHES-config/mv_hostype.py index 2f2ceab..21a22b4 100755 --- a/abs/core/LinHES-config/mv_hostype.py +++ b/abs/core/LinHES-config/mv_hostype.py @@ -38,7 +38,7 @@ def setup_db(): def setup_mysqlnetwork(EnableNetwork): logging.debug(" Setting up mysql network") - mysqlconf = "/etc/my.cnf" + mysqlconf = "/etc/mysql/my.cnf" cmd = '''grep "#skip-networking" %s ''' %mysqlconf status = mv_common.runcmd(cmd) @@ -49,7 +49,7 @@ def setup_mysqlnetwork(EnableNetwork): else: cmd = '''sed -ie "s/^skip-networking/#skip-networking/g" %s ''' %mysqlconf mv_common.runcmd(cmd) - mv_common.restart_service("mysqld") + mv_common.restart_service("mysql") else: logging.debug(" Disabling mysql networking") if status == 1 : @@ -57,7 +57,7 @@ def setup_mysqlnetwork(EnableNetwork): else: cmd = '''sed -ie "s/#skip-networking/skip-networking/g" %s ''' %mysqlconf mv_common.runcmd(cmd) - mv_common.restart_service("mysqld") + mv_common.restart_service("mysql") def generate_config_xml(uuid,dbhost): @@ -107,22 +107,35 @@ def setup_mysql_connection(systemconfig): if systemtype == "Master_backend": logging.debug(" Setting dbhost to %s in systemconfig", mythip) dbhost = mythip - cmd = '''sed -ei "s/^dbhost=.*$/dbhost=\"%s\"/" /etc/systemconfig ''' %dbhost + cmd = '''sed -i "s/^dbhost=.*$/dbhost=\"%s\"/" /etc/systemconfig ''' %dbhost mv_common.runcmd(cmd) logging.debug(" Changing dbhost in settings table for master_backend") - cmd = '''%s/bin/restore_default_settings.sh -c BECONFIG -s master -a %s ''' %(mv_root, dbhost) + #cmd = '''%s/bin/restore_default_settings.sh -c BECONFIG -s master -a %s ''' %(mv_root, dbhost) + cmd = '''%s/bin/myth_settings_wrapper.sh -c BECONFIG -s master -a %s ''' %(mv_root, dbhost) mv_common.runcmd(cmd) + #mv_common.reloadfe(systemconfig.get("dbhost"),True) if systemtype == "Slave_backend": slavehost = mythip logging.debug(" Changing slave in settings: %s", slavehost) - cmd = '''%s/bin/restore_default_settings.sh -c BECONFIG -s slave -a %s ''' %(mv_root, slavehost) + cmd = '''%s/bin/myth_settings_wrapper.sh -c BECONFIG -s slave -a %s ''' %(mv_root, slavehost) + #cmd = '''%s/bin/restore_default_settings.sh -c BECONFIG -s slave -a %s ''' %(mv_root, slavehost) mv_common.runcmd(cmd) - if systemtype == "Master_backend": + if systemtype == "Standalone": logging.debug(" changing mysql.txt file to use localhost") cmd = '''sed -e "s/^DBHostName=.*$/DBHostName="localhost"/" %s > %s ''' %(mysqltemplate, mysqltxt) mv_common.runcmd(cmd) + + #mv_common.reloadfe(systemconfig.get("dbhost"),True) + + cmd = '''%s/bin/myth_settings_wrapper.sh -c BECONFIG -s standalone ''' %(mv_root) + mv_common.runcmd(cmd) + #mv_common.reloadfe(systemconfig.get("dbhost"),True) + + logging.debug(" Running beconfig a 2nd time") + cmd = '''%s/bin/myth_settings_wrapper.sh -c BECONFIG -s standalone ''' %(mv_root) + mv_common.runcmd(cmd) else: logging.debug(" changing mysql.txt file to use %s", dbhost) cmd = '''sed -e "s/^DBHostName=.*$/DBHostName=%s/" %s > %s ''' %(dbhost, mysqltemplate, mysqltxt) @@ -378,8 +391,10 @@ def hostypeprint(systemconfig): if data_config.SYSTEMTYPE == "MythVantage": mv_common.remove_service("ghosd") + if restart_mbe == True : - mv_common.restart_service("mythbackend") + setup_mysql_connection(systemconfig) + mv_common.stop_service("mythbackend") if run_mysqlnetwork: @@ -388,6 +403,11 @@ def hostypeprint(systemconfig): logging.debug(" Not running setup_mysql_connection") setup_mysql_connection(systemconfig) + + if restart_mbe == True : + mv_common.start_service("mythbackend") + + if func_supported: setup_func_minion(systemconfig.get("dbhost"),systemconfig.get("hostname")) diff --git a/abs/core/LinHES-config/myth_settings_wrapper.sh b/abs/core/LinHES-config/myth_settings_wrapper.sh index 33f401f..7bf8782 100644 --- a/abs/core/LinHES-config/myth_settings_wrapper.sh +++ b/abs/core/LinHES-config/myth_settings_wrapper.sh @@ -2,7 +2,7 @@ . /etc/profile . /etc/systemconfig shopt -s -o nounset -echo $@ >> /tmp/restore.out +echo $@ >> /tmp/wrapper.out #TEMPLATES="/usr/share/templates/settings" TEMPLATES="$TEMPLATES/settings" TABLES="settings keybindings jumppoints" @@ -181,7 +181,7 @@ case $OPERATION in if [ $SYSTEMTYPE = "master" ] then define_xml ${IP_ADDRESS} $hostname settings BackendServerIP - load_xml + load_xml $gen_xml define_xml ${IP_ADDRESS} '' settings MasterServerIP load_xml $gen_xml @@ -192,7 +192,18 @@ case $OPERATION in define_xml ${IP_ADDRESS} $hostname settings BackendServerIP load_xml $gen_xml fi + + + if [ $SYSTEMTYPE = "standalone" ] + then + define_xml "127.0.0.1" $hostname settings BackendServerIP + load_xml $gen_xml + define_xml "127.0.0.1" '' settings MasterServerIP + load_xml $gen_xml + fi ;; + + ZIP) define_xml $ZIPCODE $hostname settings locale load_xml $gen_xml diff --git a/abs/core/LinHES-config/restore_default_settings.sh b/abs/core/LinHES-config/restore_default_settings.sh index ffd4b0d..ca27578 100755 --- a/abs/core/LinHES-config/restore_default_settings.sh +++ b/abs/core/LinHES-config/restore_default_settings.sh @@ -3,6 +3,20 @@ . /etc/systemconfig shopt -s -o nounset echo $@ >> /tmp/restore.out +echo "######################################################" +echo "######################################################" +echo "######################################################" +echo "######################################################" +cat /tmp/restore.out + +exit 0 + + + + + + + #TEMPLATES="/usr/share/templates/settings" TEMPLATES="$TEMPLATES/settings" TABLES="settings keybindings jumppoints" -- cgit v0.12