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

Python solaris_install.Popen类代码示例

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

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



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


示例16: test_overlay_1

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


示例17: test_check_result

 def test_check_result(self):
     '''Popen.check_call() check_result keyword arg raises errors
     appropriately'''
     try:
         popen = Popen.check_call(self.cmd(0), check_result=(0, 4))
     except CalledProcessError as err:
         self.fail("Unexpected CalledProcessError: %s" % err)
     try:
         popen = Popen.check_call(self.cmd(4), check_result=(0, 4))
     except CalledProcessError as err:
         self.fail("Unexpected CalledProcessError: %s" % err)
     self.assertRaises(CalledProcessError, Popen.check_call, self.cmd(5),
                       check_result=(0, 4))
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:13,代码来源:test_install_common.py


示例18: snapshot

    def snapshot(self, snapshot_name, overwrite=False):
        """ snapshot - method to create a ZFS shapshot of the filesystem

        snapshot_name - name of the snapshot to create
        overwrite - boolean argument to determine if ZFS should delete an
        existing snapshot with the same name (if it exists)
        """
        snap = self.snapname(snapshot_name)
        if overwrite and snap in self.snapshot_list:
            self.destroy(dry_run=False, snapshot=snapshot_name)
        cmd = [ZFS, "snapshot", snap]
        Popen.check_call(cmd, stdout=Popen.STORE, stderr=Popen.STORE,
                         logger=ILN)
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:13,代码来源:logical.py


示例19: test_log_out

 def test_log_out(self):
     '''Popen.check_call(..., logger=some_logger) logs stdout'''
     logger = MockLogger(100)
     popen = Popen.check_call(self.cmd(0), stdout=Popen.STORE,
                              logger=logger, stdout_loglevel=100)
     self.assertTrue(sys.executable in logger.msgs[100][0])
     self.assertEqual("--stdout--", logger.msgs[100][1])
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:7,代码来源:test_install_common.py


示例20: _nic_is_under_dhcp_control

    def _nic_is_under_dhcp_control(self):
        '''Returns True if selected NIC is controlled by DHCP.
        Returns False otherwise.

        '''

        #
        # Obtain type for all ipadm address objects created over given NIC.
        # Then search for presence of 'dhcp' type which indicates IPv4
        # address object controlled by DHCP.
        #
        argslist = ['/usr/sbin/ipadm', 'show-addr', '-p', '-o', 'type',
                    self.get_nic_link(self.nic_iface) + "/"]
        try:
            ipadm_popen = Popen.check_call(argslist, stdout=Popen.STORE,
                                           stderr=Popen.STORE,
                                           logger=LOGGER())
        except CalledProcessError as error:
            LOGGER().warn("'ipadm' failed with following error: %s", error)
            return False

        if 'dhcp' in ipadm_popen.stdout.split():
            return True
        else:
            return False
开发者ID:PluribusNetworks,项目名称:pluribus_userland,代码行数:25,代码来源:network_info.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python engine.InstallEngine类代码示例发布时间:2022-05-27
下一篇:
Python solar_models.Resource类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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