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


Python solaris_install.Popen类代码示例

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


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

示例1: _write_loader

    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,代码行数:31,代码来源:sbb.py

示例2: set

 def set(self, prop, value, dry_run):
     """ method to set a property on the ZFS filesystem
     """
     cmd = [ZFS, "set", "%s=%s" % (prop, value), self.full_name]
     if not dry_run:
         Popen.check_call(cmd, stdout=Popen.STORE, stderr=Popen.STORE,
                          logger=ILN)
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:7,代码来源:logical.py

示例3: create

    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,代码行数:26,代码来源:logical.py

示例4: test_logging_no_hang

    def test_logging_no_hang(self):
        '''Try to ensure Popen.check_call doesn't hang when trying to do
        logging'''

        # To ensure the logger keyword arg is implemented in a way that
        # doesn't cause hangs, and since the use of logger causes blocking
        # behavior, spawn a non-blocking subprocess that spawns a blocking
        # subprocess. If the non-blocking subprocess doesn't complete
        # in a reasonable amount of time, kill both and fail
        cmd = [sys.executable, "-c",
               "from solaris_install import Popen; import logging; "
               "Popen.check_call(['/usr/bin/pkg', 'foo'], "
               "logger=logging.getLogger())"]

        popen = Popen(cmd, stdout=Popen.DEVNULL, stderr=Popen.DEVNULL)
        for wait_count in xrange(15):
            # If it's not done nearly instantly, something is wrong.
            # However, give the benefit of the doubt by waiting up to
            # 5 seconds for completion
            if popen.poll() is not None:
                break
            else:
                time.sleep(0.5)
        else:
            popen.kill()
            self.fail("subprocess hung while attempting logging")
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:26,代码来源:test_install_common.py

示例5: do_unconfigure

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,代码行数:25,代码来源:__init__.py

示例6: tearDown

 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,代码行数:7,代码来源:test_dhcp.py

示例7: execute

    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,代码行数:30,代码来源:boot_archive.py

示例8: unmount

 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,代码行数:9,代码来源:logical.py

示例9: create_ramdisk

    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,代码行数:10,代码来源:logical.py

示例10: rollback

 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,代码行数:10,代码来源:logical.py

示例11: unpack

 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,代码行数:11,代码来源:image.py

示例12: check_install_SMF

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,代码行数:11,代码来源:test_aimdns_manual.py

示例13: apply_profiles

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,代码行数:12,代码来源:__init__.py

示例14: reboot

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,代码行数:12,代码来源:__init__.py

示例15: destroy

    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,代码行数:12,代码来源:logical.py


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