• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python anaconda_log.log_method_call函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyanaconda.anaconda_log.log_method_call函数的典型用法代码示例。如果您正苦于以下问题:Python log_method_call函数的具体用法?Python log_method_call怎么用?Python log_method_call使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了log_method_call函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: create

    def create(self, *args, **kwargs):
        """ Create the format. """
        log_method_call(self, device=self.device,
                        type=self.type, status=self.status)
        intf = kwargs.get("intf")
        w = None
        if intf:
            w = intf.progressWindow(_("Formatting"),
                                    _("Creating %(type)s on %(device)s")
                                    % {"type": self.type, "device": self.device},
                                    100, pulse = True)

        try:
            DeviceFormat.create(self, *args, **kwargs)
            # Consider use of -Z|--zero
            # -f|--force or -y|--yes may be required

            # lvm has issues with persistence of metadata, so here comes the
            # hammer...
            DeviceFormat.destroy(self, *args, **kwargs)

            lvm.pvcreate(self.device, progress=w)
        except Exception:
            raise
        else:
            self.exists = True
            self.notifyKernel()
        finally:
            if w:
                w.pop()
开发者ID:masami256,项目名称:Anaconda-for-ore-ore-kernel,代码行数:30,代码来源:lvmpv.py


示例2: create

    def create(self, *args, **kwargs):
        """ Create the device. """
        log_method_call(self, device=self.device,
                        type=self.type, status=self.status)
        intf = kwargs.get("intf")
        force = kwargs.get("force")
        if not force and self.exists:
            raise SwapSpaceError("format already exists")

        if force:
            self.teardown()
        elif self.status:
            raise SwapSpaceError("device exists and is active")

        w = None
        if intf:
            w = intf.progressWindow(_("Formatting"),
                                    _("Creating %(type)s on %(device)s")
                                    % {"type": self.type, "device": kwargs.get("device", self.device)},
                                    100, pulse = True)

        try:
            DeviceFormat.create(self, *args, **kwargs)
            swap.mkswap(self.device, label=self.label, progress=w)
        except Exception:
            raise
        else:
            self.exists = True
            self.notifyKernel()
        finally:
            if w:
                w.pop()
开发者ID:mattias-ohlsson,项目名称:anaconda,代码行数:32,代码来源:swap.py


示例3: create

    def create(self, *args, **kwargs):
        """ Create the format. """
        log_method_call(self, device=self.device,
                        type=self.type, status=self.status)
        if not self.hasKey:
            raise LUKSError("luks device has no key/passphrase")

        intf = kwargs.get("intf")
        w = None
        if intf:
            w = intf.waitWindow(_("Formatting"),
                                _("Encrypting %s") % kwargs.get("device",
                                                                self.device))

        try:
            DeviceFormat.create(self, *args, **kwargs)
            crypto.luks_format(self.device,
                             passphrase=self.__passphrase,
                             key_file=self._key_file,
                             cipher=self.cipher,
                             key_size=self.key_size)
        except Exception:
            raise
        else:
            self.uuid = crypto.luks_uuid(self.device)
            self.exists = True
            self.mapName = "luks-%s" % self.uuid
            self.notifyKernel()
        finally:
            if w:
                w.pop()
开发者ID:mattias-ohlsson,项目名称:anaconda,代码行数:31,代码来源:luks.py


示例4: commitToDisk

 def commitToDisk(self):
     """ Commit the current partition table to disk. """
     log_method_call(self, device=self.device,
                     numparts=len(self.partitions))
     try:
         self.partedDisk.commitToDevice()
     except parted.DiskException as msg:
         raise DiskLabelCommitError(msg)
开发者ID:masami256,项目名称:Anaconda-for-ore-ore-kernel,代码行数:8,代码来源:disklabel.py


示例5: teardown

    def teardown(self, *args, **kwargs):
        """ Close, or tear down, a device. """
        log_method_call(self, device=self.device,
                        type=self.type, status=self.status)
        if not self.exists:
            raise SwapSpaceError("format has not been created")

        if self.status:
            swap.swapoff(self.device)
开发者ID:mattias-ohlsson,项目名称:anaconda,代码行数:9,代码来源:swap.py


示例6: setup

    def setup(self, *args, **kwargs):
        log_method_call(self, type=self.mountType, device=self.device,
                        mountpoint=self.mountpoint)
        if not self.mountpoint and "mountpoint" not in kwargs:
            # Since btrfs vols have subvols the format setup is automatic.
            # Don't try to mount it if there's no mountpoint.
            return

        return self.mount(*args, **kwargs)
开发者ID:mattias-ohlsson,项目名称:anaconda,代码行数:9,代码来源:fs.py


示例7: create

    def create(self, *args, **kwargs):
        log_method_call(self, device=self.device,
                        type=self.type, status=self.status)
        # allow late specification of device path
        device = kwargs.get("device")
        if device:
            self.device = device

        if not os.path.exists(self.device):
            raise FormatCreateError("invalid device specification", self.device)
开发者ID:masami256,项目名称:Anaconda-for-ore-ore-kernel,代码行数:10,代码来源:__init__.py


示例8: teardown

    def teardown(self, *args, **kwargs):
        """ Close, or tear down, the format. """
        log_method_call(self, device=self.device,
                        type=self.type, status=self.status)
        if not self.exists:
            raise LUKSError("format has not been created")

        if self.status:
            log.debug("unmapping %s" % self.mapName)
            crypto.luks_close(self.mapName)
开发者ID:mattias-ohlsson,项目名称:anaconda,代码行数:10,代码来源:luks.py


示例9: commit

 def commit(self):
     """ Commit the current partition table to disk and notify the OS. """
     log_method_call(self, device=self.device,
                     numparts=len(self.partitions))
     try:
         self.partedDisk.commit()
     except parted.DiskException as msg:
         raise DiskLabelCommitError(msg)
     else:
         udev_settle()
开发者ID:masami256,项目名称:Anaconda-for-ore-ore-kernel,代码行数:10,代码来源:disklabel.py


示例10: setup

    def setup(self, *args, **kwargs):
        """ Open, or set up, a device. """
        log_method_call(self, device=self.device,
                        type=self.type, status=self.status)
        if not self.exists:
            raise DeviceFormatError("format has not been created")

        if self.status:
            return

        DeviceFormat.setup(self, *args, **kwargs)
开发者ID:masami256,项目名称:Anaconda-for-ore-ore-kernel,代码行数:11,代码来源:disklabel.py


示例11: removePassphrase

    def removePassphrase(self, passphrase):
        """ Remove the specified passphrase from the LUKS header. """
        log_method_call(self, device=self.device,
                        type=self.type, status=self.status)
        if not self.exists:
            raise LUKSError("format has not been created")

        crypto.luks_remove_key(self.device,
                             passphrase=self.__passphrase,
                             key_file=self._key_file,
                             del_passphrase=passphrase)
开发者ID:mattias-ohlsson,项目名称:anaconda,代码行数:11,代码来源:luks.py


示例12: destroy

    def destroy(self, *args, **kwargs):
        """ Wipe the disklabel from the device. """
        log_method_call(self, device=self.device,
                        type=self.type, status=self.status)
        if not self.exists:
            raise DeviceFormatError("format does not exist")

        if not os.access(self.device, os.W_OK):
            raise DeviceFormatError("device path does not exist")

        self.partedDevice.clobber()
        self.exists = False
开发者ID:masami256,项目名称:Anaconda-for-ore-ore-kernel,代码行数:12,代码来源:disklabel.py


示例13: probe

    def probe(self):
        """ Probe for any missing information about this format. """
        log_method_call(self, device=self.device,
                        type=self.type, status=self.status)
        if not self.exists:
            raise MDMemberError("format does not exist")

        info = mdraid.mdexamine(self.device)
        if self.uuid is None:
            self.uuid = info['uuid']
        if self.raidMinor is None:
            self.raidMinor = info['mdMinor']
开发者ID:masami256,项目名称:Anaconda-for-ore-ore-kernel,代码行数:12,代码来源:mdraid.py


示例14: notifyKernel

    def notifyKernel(self):
        log_method_call(self, device=self.device,
                        type=self.type)
        if not self.device:
            return

        if self.device.startswith("/dev/mapper/"):
            try:
                name = dm_node_from_name(os.path.basename(self.device))
            except Exception, e:
                log.warning("failed to get dm node for %s" % self.device)
                return
开发者ID:masami256,项目名称:Anaconda-for-ore-ore-kernel,代码行数:12,代码来源:__init__.py


示例15: setup

    def setup(self, *args, **kwargs):
        """ Open, or set up, the format. """
        log_method_call(self, device=self.device, mapName=self.mapName,
                        type=self.type, status=self.status)
        if not self.configured:
            raise LUKSError("luks device not configured")

        if self.status:
            return

        DeviceFormat.setup(self, *args, **kwargs)
        crypto.luks_open(self.device, self.mapName,
                       passphrase=self.__passphrase,
                       key_file=self._key_file)
开发者ID:mattias-ohlsson,项目名称:anaconda,代码行数:14,代码来源:luks.py


示例16: addPassphrase

    def addPassphrase(self, passphrase):
        """ Add a new passphrase.

            Add the specified passphrase to an available key slot in the
            LUKS header.
        """
        log_method_call(self, device=self.device,
                        type=self.type, status=self.status)
        if not self.exists:
            raise LUKSError("format has not been created")

        crypto.luks_add_key(self.device,
                          passphrase=self.__passphrase,
                          key_file=self._key_file,
                          new_passphrase=passphrase)
开发者ID:mattias-ohlsson,项目名称:anaconda,代码行数:15,代码来源:luks.py


示例17: removeKeyFromFile

    def removeKeyFromFile(self, keyfile):
        """ Remove a key contained in a file.

            Remove key contained in the specified key file from the LUKS
            header.
        """
        log_method_call(self, device=self.device,
                        type=self.type, status=self.status, file=keyfile)
        if not self.exists:
            raise LUKSError("format has not been created")

        crypto.luks_remove_key(self.device,
                             passphrase=self.__passphrase,
                             key_file=self._key_file,
                             del_key_file=keyfile)
开发者ID:mattias-ohlsson,项目名称:anaconda,代码行数:15,代码来源:luks.py


示例18: addKeyFromFile

    def addKeyFromFile(self, keyfile):
        """ Add a new key from a file.

            Add the contents of the specified key file to an available key
            slot in the LUKS header.
        """
        log_method_call(self, device=self.device,
                        type=self.type, status=self.status, file=keyfile)
        if not self.exists:
            raise LUKSError("format has not been created")

        crypto.luks_add_key(self.device,
                          passphrase=self.__passphrase,
                          key_file=self._key_file,
                          new_key_file=keyfile)
开发者ID:mattias-ohlsson,项目名称:anaconda,代码行数:15,代码来源:luks.py


示例19: setup

    def setup(self, *args, **kwargs):
        log_method_call(self, device=self.device,
                        type=self.type, status=self.status)

        if not self.exists:
            raise FormatSetupError("format has not been created")

        if self.status:
            return

        # allow late specification of device path
        device = kwargs.get("device")
        if device:
            self.device = device

        if not self.device or not os.path.exists(self.device):
            raise FormatSetupError("invalid device specification")
开发者ID:masami256,项目名称:Anaconda-for-ore-ore-kernel,代码行数:17,代码来源:__init__.py


示例20: __init__

    def __init__(self, *args, **kwargs):
        """ Create a DeviceFormat instance.

            Keyword Arguments:

                device -- path to the underlying device
                uuid -- this format's UUID
                exists -- indicates whether this is an existing format

            On initialization this format is like DeviceFormat

        """
        log_method_call(self, *args, **kwargs)
        DeviceFormat.__init__(self, *args, **kwargs)

        # Initialize the attribute that will hold the block object.
        self._member = None
开发者ID:mattias-ohlsson,项目名称:anaconda,代码行数:17,代码来源:multipath.py



注:本文中的pyanaconda.anaconda_log.log_method_call函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python i18n._函数代码示例发布时间:2022-05-25
下一篇:
Python pyaml.dump函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap