summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/mv_hostype.py
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/LinHES-config/mv_hostype.py')
-rwxr-xr-xabs/core/LinHES-config/mv_hostype.py66
1 files changed, 48 insertions, 18 deletions
diff --git a/abs/core/LinHES-config/mv_hostype.py b/abs/core/LinHES-config/mv_hostype.py
index 59b05b6..2cbd97a 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):
@@ -101,28 +101,41 @@ def setup_mysql_connection(systemconfig):
dbhost = systemconfig.get("dbhost")
uuid = gen_uuid()
config_xml=generate_config_xml(uuid,dbhost)
- mv_common.mkdir_mythhome(data_config.MYTHHOME)
+ mv_common.mkdir_mythhome(data_config.MYTHHOME,"mythtv","mythtv")
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)
@@ -260,7 +273,7 @@ def hostypeprint(systemconfig):
daemon_list=''
daemon_remove_list=''
run_mysqlnetwork = False
-
+ restart_mbe = False
profile_status="/etc/profile.d/z_myth_status.sh"
myth_status="/usr/LH/bin/myth_status.sh"
@@ -271,9 +284,12 @@ def hostypeprint(systemconfig):
EnableNetwork = False
run_mysqlnetwork = True
if systemconfig.get("hostypec"):
- setup_db()
+ logging.info(" Host type change detected, queuing restart of backend")
+ restart_mbe = True
+
+
install_list=["nss-mdns", "mysql", "mythdb-initial", "avahi", "rpcbind", "nfs-utils", "local-website", "myth2ipod", "mythtv-status"]
- daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs", "lighttpd"]
+ daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs", "lighttpd" ,"msg_daemon"]
mv_common.link_file(myth_status,profile_status)
@@ -290,7 +306,7 @@ def hostypeprint(systemconfig):
setup_ntp(False,"null")
setup_avahi(systemconfig.get("TEMPLATES"))
install_list=["nss-mdns", "mysql", "mythdb-initial", "avahi", "rpcbind", "nfs-utils", "local-website", "myth2ipod", "mythtv-status"]
- daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs", "lighttpd"]
+ daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs", "lighttpd" ,"msg_daemon"]
EnableNetwork = True
run_mysqlnetwork = True
mv_common.link_file(myth_status,profile_status)
@@ -303,6 +319,9 @@ def hostypeprint(systemconfig):
install_list.append('certmaster')
daemon_list.append('certmaster')
+ if systemconfig.get("hostypec"):
+ logging.info(" Host type change detected, queuing restart of backend")
+ restart_mbe = True
elif systemconfig.get("SystemType") == "Slave_backend":
logging.info("Slave backend system being configured")
@@ -310,10 +329,8 @@ def hostypeprint(systemconfig):
remove_avahi_service()
mv_common.link_file(myth_status,profile_status)
- if systemconfig.get("hostypec"):
- setup_db()
install_list = [ "nss-mdns", "rpcbind", "nfs-utils", "avahi", "libmysqlclient" ]
- daemon_list = ["mythbackend", "rpcbind", "nfs-common", "netfs", "avahi" ]
+ daemon_list = ["mythbackend", "rpcbind", "nfs-common", "netfs", "avahi" ,"msg_daemon" ]
daemon_remove_list=["mysql", "lighttpd", "certmaster"]
@@ -326,6 +343,9 @@ def hostypeprint(systemconfig):
daemon_list.append('xymon-client')
setup_rsyslog_client(systemconfig.get("dbhost"))
+ if systemconfig.get("hostypec"):
+ logging.info(" Host type change detected, queuing restart of backend")
+ restart_mbe = True
elif systemconfig.get("SystemType") == "Frontend_only":
@@ -335,7 +355,7 @@ def hostypeprint(systemconfig):
install_list=["mysql-clients", "libmysqlclient", "avahi", "rpcbind", "nfs-utils"]
remove_list=["mysql","lighttpd"]
- daemon_list=["nss-mdns", "mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs" ]
+ daemon_list=["nss-mdns", "mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs" ,"msg_daemon"]
daemon_remove_list=["mysql", "mythbackend","lighttpd"]
if xymon_supported:
install_list.append('xymonclient')
@@ -361,23 +381,33 @@ def hostypeprint(systemconfig):
if systemconfig.get("RunFrontend") == "1":
logging.debug(" Will run the frontend")
mv_common.add_service("frontend")
- mv_common.add_service("hal")
+ #mv_common.add_service("hal")
if data_config.SYSTEMTYPE == "MythVantage":
mv_common.add_service("ghosd")
else:
logging.debug(" Will NOT run the frontend")
mv_common.remove_service("frontend")
- mv_common.add_service("hal")
+ #mv_common.add_service("hal")
if data_config.SYSTEMTYPE == "MythVantage":
mv_common.remove_service("ghosd")
+ if restart_mbe == True :
+ setup_mysql_connection(systemconfig)
+ mv_common.stop_service("mythbackend")
+
+
if run_mysqlnetwork:
setup_mysqlnetwork(EnableNetwork)
else:
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"))