diff options
author | James Meyer <james.meyer@operamail.com> | 2009-06-22 21:17:41 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2009-06-22 21:17:41 (GMT) |
commit | 66436f56b1f264d1fe7e51c057e27fd8adc03822 (patch) | |
tree | 28a71a570e7b6320f8ea234ec776e8790777e972 /abs/core-testing/LinHES-config/mv_install.py | |
parent | 71f2f52cdb80bb814fde97b994e1625beac55282 (diff) | |
download | linhes_pkgbuild-66436f56b1f264d1fe7e51c057e27fd8adc03822.zip linhes_pkgbuild-66436f56b1f264d1fe7e51c057e27fd8adc03822.tar.gz linhes_pkgbuild-66436f56b1f264d1fe7e51c057e27fd8adc03822.tar.bz2 |
linhes-config: feeble attempt at error catching from scripts:
new mythvantage
Diffstat (limited to 'abs/core-testing/LinHES-config/mv_install.py')
-rwxr-xr-x | abs/core-testing/LinHES-config/mv_install.py | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/abs/core-testing/LinHES-config/mv_install.py b/abs/core-testing/LinHES-config/mv_install.py index 97fbae5..1d213a9 100755 --- a/abs/core-testing/LinHES-config/mv_install.py +++ b/abs/core-testing/LinHES-config/mv_install.py @@ -15,6 +15,17 @@ def usage(): def clean_upgrade(): return False +def error_out(errmsg): + cmd = '''echo %s >> /tmp/.install_error ''' %errmsg + runcmd(cmd) + logging.critical("***********************************") + logging.critical("error: %s",errmsg) + print "***********************************" + print "ERROR: mv_install.py: %s" %errmsg + print "***********************************" + sys.exit(1) + + def update_db(value, data): db = MySQLdb.connect(host="localhost", user="mythtv", passwd="mythtv", db="mythconverg") try: @@ -175,7 +186,7 @@ def runcmd(cmd): else: cmd = "echo "+cmd logging.debug(" %s", cmd) - cmdout = commands.getoutput(cmd) + cmdout = commands.getstatusoutput(cmd) logging.debug(" %s", cmdout) return cmdout @@ -303,7 +314,7 @@ def fscmd(fstype): rc = fscmds[fstype] except: logging.critical(" %s is not a valid fs type, exiting now", fstype) - sys.exit(3) + error_out("Error mvinstall during format") return rc @@ -489,7 +500,7 @@ def create_fstab(extralines): def find_uuid(partition): logging.info("Finding the UUID for %s...", partition) cmd = "blkid -s UUID /dev/%s" %partition - tmpuuid = runcmd(cmd) + tmpuuid = runcmd(cmd)[1] splituuid = tmpuuid.partition("=") uuid = splituuid[2].replace('"', "") logging.info("The uuid is %s", uuid) @@ -903,8 +914,11 @@ def full_install(hostoptions): runcmd(cmd) logging.info("Running systemconfig in chroot") #cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) - cmd = " chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT) - runcmd(cmd) + cmd = "chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT) + rc = runcmd(cmd)[0] + if rc != 0 : + error_out("Running systemconfig") + mysqldb("stop", "chroot") kill_dhcp_chroot() logging.info("____End Database in CHROOT____") @@ -922,9 +936,11 @@ def full_install(hostoptions): logging.debug("touching /tmp/.dbsysfailed") else: #cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) - cmd = " chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT) - runcmd(cmd) - cmd = " chroot %s %s/bin/restore_default_settings.sh -c ACCESSCONTROL " %(data_config.MOUNTPOINT, MVROOT) + cmd = "chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT) + rc = runcmd(cmd)[0] + if rc != 0 : + error_out("Running systemconfig") + cmd = "chroot %s %s/bin/restore_default_settings.sh -c ACCESSCONTROL " %(data_config.MOUNTPOINT, MVROOT) runcmd(cmd) umount_bind_chroot() #cmd = " chroot %s %s/bin/systemconfig.sh advanced, user" %(data_config.MOUNTPOINT, MVROOT) @@ -1127,8 +1143,10 @@ def upgrade(hostoptions): mount_bind_chroot() logging.info("Running systemconfig in chroot") #cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) - cmd = " chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT) - runcmd(cmd) + cmd = "chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT) + rc = runcmd(cmd)[0] + if rc != 0 : + error_out("Running systemconfig") mysqldb("stop", "") if ( systemconfig["SystemType"] == "Master_backend" or systemconfig["SystemType"] == "Standalone" ): if clean_upgrade() or not backup_sql_check(): @@ -1154,8 +1172,10 @@ def upgrade(hostoptions): logging.info("Running systemconfig in chroot 2nd time") #cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) - cmd = " chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT) - runcmd(cmd) + cmd = "chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT) + rc = runcmd(cmd)[0] + if rc != 0 : + error_out("Running systemconfig") #logging.info("Running systemconfig in chroot") #cmd = " chroot %s %s/bin/systemconfig.sh advanced" %(data_config.MOUNTPOINT, MVROOT) #runcmd(cmd) |