当前位置: 首页>>代码示例>>Python>>正文


Python Popen.check_call方法代码示例

本文整理汇总了Python中solaris_install.Popen.check_call方法的典型用法代码示例。如果您正苦于以下问题:Python Popen.check_call方法的具体用法?Python Popen.check_call怎么用?Python Popen.check_call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在solaris_install.Popen的用法示例。


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

示例1: set

# 需要导入模块: from solaris_install import Popen [as 别名]
# 或者: from solaris_install.Popen import check_call [as 别名]
 def set(self, propname, propvalue, dry_run):
     """ method to set a property for the pool
     """
     cmd = [ZPOOL, "set", "%s=%s" % (propname, propvalue), self.name]
     if not dry_run:
         Popen.check_call(cmd, stdout=Popen.STORE, stderr=Popen.STORE,
                          logger=ILN)
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:9,代码来源:logical.py

示例2: _write_loader

# 需要导入模块: from solaris_install import Popen [as 别名]
# 或者: from solaris_install.Popen import check_call [as 别名]
    def _write_loader(self, devname, data_root):
        """Invoked by the MenuLstBootLoaderMixIn.
        Invoke installboot to write the bootblk to disk."""

        args = ['/sbin/installboot', '-F', 'zfs']

        # If a version is present, try to use it during installation
        if self.version is not None:
            args += ['-u', self.version]

        args += [data_root + (ZFSBootLoader.BOOTBLK_PATH %
                              {'platformname': platform_name()}),
                 devname]

        self._debug('_write_loader: Invoking command: ' + ' '.join(args))

        try:
            Popen.check_call(args, stdout=Popen.STORE, stderr=Popen.STORE)
        except CalledProcessError as cpe:
            self._debug('_write_loader: Return code = %d' % cpe.returncode)
            if cpe.returncode != ZFSBootLoader.INSTALLBOOT_NOUPDT:
                output = ''
                if cpe.popen is not None and cpe.popen.stderr is not None:
                    output = '\nOutput was:\n' + cpe.popen.stderr
                raise BootLoaderInstallError('installboot failed for '
                      'device ' + devname + ': Return code ' +
                      str(cpe.returncode) + output)
        except OSError as ose:
                raise BootLoaderInstallError('Error while trying to '
                      'invoke installboot for '
                      'device ' + devname + ': ' + str(ose))
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:33,代码来源:sbb.py

示例3: do_unconfigure

# 需要导入模块: from solaris_install import Popen [as 别名]
# 或者: from solaris_install.Popen import check_call [as 别名]
def do_unconfigure(sub_cmd, options):
    '''Performs the requested unconfigure operations'''
    try:
        create_config_profiles(sub_cmd, options)
    except IOError:
        print _("IO error creating profile")
        sys.exit(SU_FATAL_ERR)

    if not options.alt_root:
        try:
            apply_profiles([CONFIG_PROFILE_DEST, UNCONFIG_PROFILE_DEST])
        except:
            print _("Unable to apply the unconfigure parameters to the image")
            sys.exit(SU_FATAL_ERR)

        # system-unconfig is an SMF milestone. Bring the
        # system down to the milestone.
        cmd = [SVCADM, "milestone", "unconfig"]
        try:
            Popen.check_call(cmd, stderr=Popen.PIPE,
                check_result=(Popen.STDERR_EMPTY, 0))
        except CalledProcessError as err:
            print err.popen.stderr
            print _("Unable to initiate unconfiguration process.")
            sys.exit(SU_FATAL_ERR)
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:27,代码来源:__init__.py

示例4: tearDown

# 需要导入模块: from solaris_install import Popen [as 别名]
# 或者: from solaris_install.Popen import check_call [as 别名]
 def tearDown(self):
     '''Delete test instance of dhcp SMF service'''
     cmd = [dhcp.SVCCFG, "delete", self.dhcp_srv_inst]
     Popen.check_call(cmd)
     dhcp.DHCP_SERVER_IPV4_SVC = self.dhcp_srv_orig
     if os.path.exists(self.dhcp_dir):
         shutil.rmtree(self.dhcp_dir)
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:9,代码来源:test_dhcp.py

示例5: create

# 需要导入模块: from solaris_install import Popen [as 别名]
# 或者: from solaris_install.Popen import check_call [as 别名]
    def create(self, dry_run, options=[]):
        """ method to create the zpool from the vdevs

        options - optional list of pool and/or dataset options to pass to the
        create flag
        """
        cmd = [ZPOOL, "create", "-f"]
        if options:
            cmd.extend(options)

        # add the mountpoint if specified
        if self.mountpoint is not None:
            cmd.append("-m")
            cmd.append(self.mountpoint)

        cmd.append(self.name)
        if None in self.vdev_list:
            raise RuntimeError("Invalid entry in vdev_list:  " + \
                               str(self.vdev_list))

        # add the vdev_list to the cmd to preserve the format Popen needs
        cmd += self.vdev_list

        if not dry_run:
            Popen.check_call(cmd, stdout=Popen.STORE, stderr=Popen.STORE,
                             logger=ILN)
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:28,代码来源:logical.py

示例6: execute

# 需要导入模块: from solaris_install import Popen [as 别名]
# 或者: from solaris_install.Popen import check_call [as 别名]
    def execute(self, dry_run=False):
        '''
            The AbstractCheckpoint class requires this method
            in sub-classes.

            Execute in a subprocess the following command:
                   /usr/sbin/bootadm update-archive -R target_directory

            Parameters:
            - the dry_run keyword paramater. The default value is False.
              If set to True, the log message describes the checkpoint tasks.

            Returns:
            - Nothing
              On failure, errors raised are managed by the engine.
        '''
        self.logger.debug('ICT current task: updating the boot archive')

        # parse_doc populates variables necessary to execute the checkpoint
        self.parse_doc()

        # Run bootadm
        #XXX This should probably eventually be migrated once libbootmgt
        #goes back
        cmd = [ICT.BOOTADM, 'update-archive', '-R', self.target_dir]
        if dry_run:
            self.logger.debug('Executing: %s', cmd)
        if not dry_run:
            Popen.check_call(cmd, stdout=Popen.STORE, stderr=Popen.STORE,
                logger=self.logger)
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:32,代码来源:boot_archive.py

示例7: unmount

# 需要导入模块: from solaris_install import Popen [as 别名]
# 或者: from solaris_install.Popen import check_call [as 别名]
 def unmount(self, dry_run):
     """ method to unmount the ramdisk
     """
     if self.mounted:
         cmd = [UMOUNT, "-f", self.mountpoint]
         if not dry_run:
             Popen.check_call(cmd, stdout=Popen.STORE, stderr=Popen.STORE,
                              logger=ILN)
         self.mounted = False
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:11,代码来源:logical.py

示例8: create_ramdisk

# 需要导入模块: from solaris_install import Popen [as 别名]
# 或者: from solaris_install.Popen import check_call [as 别名]
    def create_ramdisk(self, dry_run):
        """ create_ramdisk - method to create the ramdisk, if needed
        """
        if not self.exists:
            # create the file first
            cmd = [MKFILE, "%dk" % self.size, self.ramdisk]

            if not dry_run:
                Popen.check_call(cmd, stdout=Popen.STORE, stderr=Popen.STORE,
                                 logger=ILN)
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:12,代码来源:logical.py

示例9: rollback

# 需要导入模块: from solaris_install import Popen [as 别名]
# 或者: from solaris_install.Popen import check_call [as 别名]
 def rollback(self, to_snapshot, recursive=False):
     """ rollback - method to rollback a ZFS filesystem to a given
     checkpoint
     """
     cmd = [ZFS, "rollback"]
     if recursive:
         cmd.append("-r")
     cmd.append(self.snapname(to_snapshot))
     Popen.check_call(cmd, stdout=Popen.STORE, stderr=Popen.STORE,
                      logger=ILN)
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:12,代码来源:logical.py

示例10: unpack

# 需要导入模块: from solaris_install import Popen [as 别名]
# 或者: from solaris_install.Popen import check_call [as 别名]
 def unpack(cls, iso, targetdir):
     '''Unpacks an AI ISO into targetdir, and returns an InstalladmImage
     object representing the unpacked image.
     
     '''
     cmd = [com.SETUP_IMAGE_SCRIPT, com.IMAGE_CREATE, iso, targetdir]
     Popen.check_call(cmd, stderr=Popen.STORE)
     iso_img = cls(targetdir)
     iso_img.verify()
     iso_img._prep_ai_webserver()
     return iso_img
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:13,代码来源:image.py

示例11: check_install_SMF

# 需要导入模块: from solaris_install import Popen [as 别名]
# 或者: from solaris_install.Popen import check_call [as 别名]
def check_install_SMF():
    ''' Check if install/server SMF services is available.
        returning True if available and False if not.
    '''
    # Ensure system/install/server SMF service is available
    cmd = ["/usr/bin/svcs", "svc:/system/install/server"]
    try:
        Popen.check_call(cmd, stdout=Popen.DEVNULL, stderr=Popen.DEVNULL)
    except CalledProcessError:
        # This system does not have the service so skip the test
        raise SkipTest("svc:/system/install/server not installed")
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:13,代码来源:test_aimdns_manual.py

示例12: apply_profiles

# 需要导入模块: from solaris_install import Popen [as 别名]
# 或者: from solaris_install.Popen import check_call [as 别名]
def apply_profiles(profile_list):
    '''Apply config profiles to the SMF repository.'''

    for profile in profile_list:
        cmd = [SVCCFG, "apply", profile]
        try:
            Popen.check_call(cmd, stderr=Popen.PIPE,
                             check_result=(Popen.STDERR_EMPTY, 0))
        except CalledProcessError as err:
            print err.popen.stderr
            print _("Unable to apply SMF profile %s." % profile)
            raise
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:14,代码来源:__init__.py

示例13: reboot

# 需要导入模块: from solaris_install import Popen [as 别名]
# 或者: from solaris_install.Popen import check_call [as 别名]
def reboot(is_x86):
    '''Reboot the machine, attempting fast reboot first if available'''
    cmds = _reboot_cmds(is_x86)
    for cmd in cmds:
        try:
            Popen.check_call(cmd, stdout=Popen.STORE, stderr=Popen.STORE,
                             logger=LOGGER)
        except (CalledProcessError):
            LOGGER.warn("Reboot failed:\n\t'%s'", " ".join(cmd))
        else:
            LOGGER.warn("Reboot failed:\n\t'%s'.\nWill attempt"
                        " standard reboot", " ".join(cmd))
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:14,代码来源:__init__.py

示例14: destroy

# 需要导入模块: from solaris_install import Popen [as 别名]
# 或者: from solaris_install.Popen import check_call [as 别名]
    def destroy(self, dry_run, force=False):
        """ method to destroy the zpool
        """
        if self.exists:
            cmd = [ZPOOL, "destroy"]
            if force:
                cmd.append("-f")
            cmd.append(self.name)

            if not dry_run:
                Popen.check_call(cmd, stdout=Popen.STORE, stderr=Popen.STORE,
                                 logger=ILN)
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:14,代码来源:logical.py

示例15: test_overlay_1

# 需要导入模块: from solaris_install import Popen [as 别名]
# 或者: from solaris_install.Popen import check_call [as 别名]
    def test_overlay_1(self):
        '''
        Put original manifest together from pieces, and verify it.
        '''
        mim = ManifestInput(self.AIM_MANIFEST_FILE)
        mim.load(self.TARGET_XML, not self.OVERLAY)
        mim.load(self.ADD_DRIVER_XML, self.OVERLAY)
        mim.load(self.SOFTWARE_XML, self.OVERLAY)
        mim.commit()
        TestOverlayA.strip_blank_lines(self.AIM_MANIFEST_FILE)

        # Raises an exception if diff command finds differences from original.
        Popen.check_call([self.DIFF, self.FULL_XML, self.AIM_MANIFEST_FILE])
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:15,代码来源:test_manifest_input_overlay.py


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