Exemplo n.º 1
0
def umount(target, fstab=True):
    logger.debug("umount: target=%s, fstab=%s", target, fstab)

    (retcode, mount_info) = oscommon.run("mount")
    if retcode != 0:
        raise Exception("can't run 'mount' command")
    if target in mount_info:
        oscommon.runex("umount %s" % target)
    else:
        logger.debug("target %s is not mounted", target)
    
    if fstab:
        txt = Text.TextEditor("/etc/fstab")
        txt.delete(target)
        txt.save()
Exemplo n.º 2
0
def umount(target, fstab=True):
    logger.debug("umount: target=%s, fstab=%s", target, fstab)

    (retcode, mount_info) = oscommon.run("mount")
    if retcode != 0:
        raise Exception("can't run 'mount' command")
    if target in mount_info:
        oscommon.runex("umount %s" % target)
    else:
        logger.debug("target %s is not mounted", target)
    
    if fstab:
        txt = TextEditor("/etc/fstab")
        txt.delete(target)
        txt.save()
Exemplo n.º 3
0
def mount(source, target, fstype, fstab=False):
    logger.debug("mount: source=%s, target=%s, fstype=%s, fstab=%s", source, target, fstype, fstab)

    (retcode, mount_info) = oscommon.run("mount")
    if retcode != 0:
        raise Exception("can't run 'mount' command")
    if source in mount_info:
        logger.debug("%s is already mounted" % source)
    else:
        oscommon.runex("mount -t %s %s %s" % (fstype, source, target))
    
    if fstab:
        txt = Text.TextEditor("/etc/fstab")
        txt.delete(target)
        txt.insert( "%s %s    %s    defaults    0 0" % (source, target, fstype) )
        txt.save()
Exemplo n.º 4
0
def mount(source, target, fstype, fstab=False):
    logger.debug("mount: source=%s, target=%s, fstype=%s, fstab=%s", source, target, fstype, fstab)

    (retcode, mount_info) = oscommon.run("mount")
    if retcode != 0:
        raise Exception("can't run 'mount' command")
    if source in mount_info:
        logger.debug("%s is already mounted" % source)
    else:
        oscommon.runex("mount -t %s %s %s" % (fstype, source, target))
    
    if fstab:
        txt = TextEditor("/etc/fstab")
        txt.delete(target)
        txt.insert("%s %s    %s    defaults    0 0" % (source, target, fstype))
        txt.save()
Exemplo n.º 5
0
 def uninstall(self):
     retcode = oscommon.run("rpm -q %s" % self.pkg)[0]
     if retcode == 0:
         oscommon.runex("rpm -q %s | xargs rpm -e --allmatches --noscripts --nodeps" % self.pkg)
     else:
         logger.info("don't find rpm [%s] installed", self.name)
Exemplo n.º 6
0
def sethostname(name):
    oscommon.runex("hostname %s" % name)
    txt = Text.TextEditor("/etc/sysconfig/network")
    txt.set_param("HOSTNAME", name)
    txt.save()
Exemplo n.º 7
0
 def uninstall(self):
     retcode = oscommon.run("rpm -q %s" % self.pkg)[0]
     if retcode == 0:
         oscommon.runex("rpm -q %s | xargs rpm -e --allmatches --noscripts --nodeps" % self.pkg)
     else:
         logger.info("don't find rpm [%s] installed", self.name)
Exemplo n.º 8
0
def sethostname(name):
    oscommon.runex("hostname %s" % name)
    txt = TextEditor("/etc/sysconfig/network")
    txt.set_param("HOSTNAME", name)
    txt.save()