Esempio n. 1
0
    def __usr_sbin_init():
        """Initialize paths to device management commands that we will
                execute when handling package driver actions"""

        usr_sbin = DebugValues.get("driver-cmd-dir", "/usr/sbin") + "/"
        DriverAction.usr_sbin = usr_sbin
        DriverAction.add_drv = usr_sbin + "add_drv"
        DriverAction.rem_drv = usr_sbin + "rem_drv"
        DriverAction.update_drv = usr_sbin + "update_drv"
Esempio n. 2
0
        def __usr_sbin_init():
                """Initialize paths to device management commands that we will
                execute when handling package driver actions"""

                usr_sbin = DebugValues.get("driver-cmd-dir", "/usr/sbin") + "/"
                DriverAction.usr_sbin = usr_sbin
                DriverAction.add_drv = usr_sbin + "add_drv"
                DriverAction.rem_drv = usr_sbin + "rem_drv"
                DriverAction.update_drv = usr_sbin + "update_drv"
        def __init__(self, data=None, **attrs):
                generic.Action.__init__(self, data, **attrs)

                if not self.__class__.usr_sbin:
                        usr_sbin = DebugValues.get("driver-cmd-dir",
                            "/usr/sbin") + "/"
                        self.__class__.usr_sbin = usr_sbin
                        self.__class__.add_drv = usr_sbin + "add_drv"
                        self.__class__.rem_drv = usr_sbin + "rem_drv"
                        self.__class__.update_drv = usr_sbin + "update_drv"

                #
                # Clean up clone_perms.  This attribute may been specified either as:
                # 
                #  <minorname> <mode> <owner> <group>
                #
                # or
                #
                #  <mode> <owner> <group>
                # 
                # In the latter case, the <minorname> is assumed to be
                # the same as the driver name.  Correct any such instances
                # here so that there is only one form, so that we can cleanly
                # compare, verify, etc.
                #
                if not self.attrlist("clone_perms"):
                        return

                new_cloneperms = []
                for cp in self.attrlist("clone_perms"):
                        # If we're given three fields, assume the minor node
                        # name is the same as the driver name.
                        if len(cp.split()) == 3:
                                new_cloneperms.append(
                                    self.attrs["name"] + " " + cp)
                        else:
                                new_cloneperms.append(cp)
                if len(new_cloneperms) == 1:
                        self.attrs["clone_perms"] = new_cloneperms[0]
                else:
                        self.attrs["clone_perms"] = new_cloneperms
Esempio n. 4
0
    def __init__(self, data=None, **attrs):
        generic.Action.__init__(self, data, **attrs)

        if not self.__class__.usr_sbin:
            usr_sbin = DebugValues.get("driver-cmd-dir", "/usr/sbin") + "/"
            self.__class__.usr_sbin = usr_sbin
            self.__class__.add_drv = usr_sbin + "add_drv"
            self.__class__.rem_drv = usr_sbin + "rem_drv"
            self.__class__.update_drv = usr_sbin + "update_drv"

        #
        # Clean up clone_perms.  This attribute may been specified either as:
        #
        #  <minorname> <mode> <owner> <group>
        #
        # or
        #
        #  <mode> <owner> <group>
        #
        # In the latter case, the <minorname> is assumed to be
        # the same as the driver name.  Correct any such instances
        # here so that there is only one form, so that we can cleanly
        # compare, verify, etc.
        #
        if not self.attrlist("clone_perms"):
            return

        new_cloneperms = []
        for cp in self.attrlist("clone_perms"):
            # If we're given three fields, assume the minor node
            # name is the same as the driver name.
            if len(cp.split()) == 3:
                new_cloneperms.append(self.attrs["name"] + " " + cp)
            else:
                new_cloneperms.append(cp)
        if len(new_cloneperms) == 1:
            self.attrs["clone_perms"] = new_cloneperms[0]
        else:
            self.attrs["clone_perms"] = new_cloneperms