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

Python util.system2函数代码示例

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

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



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

示例1: make_snapshot

    def make_snapshot(self, volume):
        prepared_image_path = os.path.join(self.destination, self.image_name)
        LOG.debug('sgp_dd image into volume %s' % volume.device)
        system2(('sgp_dd',
            'if='+prepared_image_path,
            'of='+volume.device,
            'bs=8k', 
            'count=%s' % (self.image_size*1024*1024/8)))
        # coreutils.dd(**{'if': prepared_image_path, 'of': volume.device, 'bs': '8M'})

        volume.mount()
        self.clean_snapshot(volume)
        LOG.debug('detaching volume')
        volume.detach()

        LOG.debug('Making snapshot of volume %s' % volume.device)
        snapshot = volume.snapshot()
        util.wait_until(
                lambda: snapshot.status() == 'completed',
                logger=LOG,
                error_text='EBS snapshot %s wasnt completed' % snapshot.id)
        LOG.debug('Snapshot is made')

        volume.ensure(mount=True)
        return snapshot.id
开发者ID:chenleji,项目名称:scalarizr,代码行数:25,代码来源:ec2.py


示例2: _format_image

    def _format_image(self):
        LOG.info("Formatting image")

        vol_entry = [v for v in self._mtab
                                        if v.device.startswith('/dev')][0]
        if vol_entry.device == '/dev/root' and not os.path.exists(vol_entry.device):
            vol_entry = [v for v in mount.mounts('/etc/mtab')
                            if v.device.startswith('/dev')][0]
        fs = filesystem(vol_entry.fstype)

        # create filesystem
        fs.mkfs(self.devname)

        # set EXT3/4 options
        if fs.type.startswith('ext'):
            # max mounts before check (-1 = disable)
            system2(('/sbin/tune2fs', '-c', '1', self.devname))
            # time based (3m = 3 month)
            system2(('/sbin/tune2fs', '-i', '3m', self.devname))

        # set label
        label = fs.get_label(vol_entry.device)
        if label:
            fs.set_label(self.devname, label)

        LOG.debug('Image %s formatted', self.devname)
开发者ID:chenleji,项目名称:scalarizr,代码行数:26,代码来源:rebundle.py


示例3: execute

    def execute(self, query, silent=False):
        if not self.password:
            full_query = query
        else:
            full_query = 'AUTH %s\n%s' % (self.password, query)
        try:
            out = system2([self.path, '-p', self.port], stdin=full_query,silent=True, warn_stderr=False)[0]

            #fix for redis 2.4 AUTH
            if 'Client sent AUTH, but no password is set' in out:
                out = system2([self.path], stdin=query,silent=True)[0]

            if out.startswith('ERR') or out.startswith('LOADING'):
                raise PopenError(out)

            elif out.startswith('OK\n'):
                out = out[3:]
            if out.endswith('\n'):
                out = out[:-1]
            return out
        except PopenError, e:
            if 'LOADING' in str(e):
                LOG.debug('Unable to execute query %s: Redis is loading the dataset in memory' % query)
            elif not silent:
                LOG.error('Unable to execute query %s with redis-cli: %s' % (query, e))
            raise
开发者ID:AnyBucket,项目名称:scalarizr,代码行数:26,代码来源:redis.py


示例4: start

    def start(self):
        try:
            if not self.running:

                #TODO: think about moving this code elsewhere
                if self.port == DEFAULT_PORT:
                    base_dir = self.redis_conf.dir
                    snap_src = os.path.join(base_dir, DB_FILENAME)
                    snap_dst = os.path.join(base_dir, get_snap_db_filename(DEFAULT_PORT))
                    if os.path.exists(snap_src) and not os.path.exists(snap_dst):
                        shutil.move(snap_src, snap_dst)
                        self.redis_conf.dbfilename = snap_dst
                    aof_src = os.path.join(base_dir, AOF_FILENAME)
                    aof_dst = os.path.join(base_dir, get_aof_db_filename(DEFAULT_PORT))
                    if os.path.exists(aof_src) and not os.path.exists(aof_dst):
                        shutil.move(aof_src, aof_dst)
                        self.redis_conf.appendfilename = aof_dst


                LOG.debug('Starting %s on port %s' % (BIN_PATH, self.port))
                system2('%s %s -s %s -c "%s %s"'%(SU_EXEC, DEFAULT_USER, BASH, BIN_PATH, self.config_path), shell=True, close_fds=True, preexec_fn=os.setsid)
                wait_until(lambda: self.running, timeout=MAX_START_TIMEOUT)
                wait_until(lambda: self.cli.test_connection(), timeout=MAX_START_TIMEOUT)
                LOG.debug('%s process has been started.' % SERVICE_NAME)

        except PopenError, e:
            LOG.error('Unable to start redis process: %s' % e)
            raise initdv2.InitdError(e)
开发者ID:notbrain,项目名称:scalarizr,代码行数:28,代码来源:redis.py


示例5: start

    def start(cls):
        if not cls.is_running():
            cls._logger.info("Starting %s process" % MONGOS)
            args = [
                "sudo",
                "-u",
                DEFAULT_USER,
                MONGOS,
                "--fork",
                "--logpath",
                ROUTER_LOG_PATH,
                "--configdb",
                "mongo-0-0:%s" % CONFIG_SERVER_DEFAULT_PORT,
            ]
            if cls.keyfile and os.path.exists(cls.keyfile):
                chown_r(cls.keyfile, DEFAULT_USER)
                args.append("--keyFile=%s" % cls.keyfile)

            if cls.verbose and isinstance(cls.verbose, int) and 0 < cls.verbose < 6:
                args.append("-" + "v" * cls.verbose)

            if os.path.exists(ROUTER_LOG_PATH):
                chown_r(ROUTER_LOG_PATH, DEFAULT_USER)

            system2(args, close_fds=True, preexec_fn=mongo_preexec_fn)
            wait_until(lambda: cls.is_running, timeout=MAX_START_TIMEOUT)
            wait_until(lambda: cls.get_cli().has_connection, timeout=MAX_START_TIMEOUT)
            cls._logger.debug("%s process has been started." % MONGOS)
开发者ID:rpallas,项目名称:scalarizr,代码行数:28,代码来源:mongodb.py


示例6: rebundle

    def rebundle(self):
        image_name = self._role_name + "-" + time.strftime("%Y%m%d%H%M%S")
        nova = __node__['openstack']['new_nova_connection']
        nova.connect()

        server_id = __node__['openstack']['server_id']
        system2("sync", shell=True)
        LOG.info('Creating server image (server_id: %s)', server_id)
        image_id = nova.servers.create_image(server_id, image_name)
        LOG.info('Server image %s created', image_id)

        result = [None]
        def image_completed():
            try:
                result[0] = nova.images.get(image_id)
                return result[0].status in ('ACTIVE', 'FAILED')
            except:
                e = sys.exc_info()[1]
                if 'Unhandled exception occurred during processing' in str(e):
                    return
                raise
        wait_until(image_completed, start_text='Polling image status', sleep=30)

        image_id = result[0].id
        if result[0].status == 'FAILED':
            raise handlers.HandlerError('Image %s becomes FAILED', image_id)
        LOG.info('Image %s completed and available for use!', image_id)
        return image_id
开发者ID:AnyBucket,项目名称:scalarizr,代码行数:28,代码来源:rebundle.py


示例7: _run_chef_client

 def _run_chef_client(self):
     system2(self.get_cmd(),
         close_fds=not linux.os.windows_family,
         log_level=logging.INFO,
         preexec_fn=not linux.os.windows_family and os.setsid or None,
         env=self.environment_variables
     )
开发者ID:chenleji,项目名称:scalarizr,代码行数:7,代码来源:chef.py


示例8: execute

    def execute(self, query, silent=False):
        if not self.password:
            full_query = query
        else:
            full_query = 'AUTH %s\n%s' % (self.password, query)

        execute_query = lambda: system2([self.path, '-p', self.port], stdin=full_query,silent=True, warn_stderr=False)
        try:
            out = execute_query()[0]

            #fix for redis 2.4 AUTH
            if 'Client sent AUTH, but no password is set' in out:
                execute_query = lambda: system2([self.path], stdin=query, silent=True)
                out = execute_query()[0]

            if "Redis is loading the dataset in memory" in out:
                #[SCALARIZR-1604]
                #test until service becomes available:
                wait_until(lambda: "LOADING" not in system2([self.path], stdin='ping', silent=True)[0])
                #run query again:
                out = execute_query()[0]

            elif out.startswith('ERR'):
                raise PopenError(out)

            elif out.startswith('OK\n'):
                out = out[3:]
            if out.endswith('\n'):
                out = out[:-1]
            return out
        except PopenError, e:
            if not silent:
                LOG.error('Unable to execute query %s with redis-cli: %s' % (query, e))
            raise
开发者ID:chenleji,项目名称:scalarizr,代码行数:34,代码来源:redis.py


示例9: create_snapshot

def create_snapshot(ec2_conn, volume_id, description=None, logger=None, timeout=SNAPSHOT_TIMEOUT, wait_completion=False, tags=None):
    if isinstance(volume_id, Volume):
        volume_id = volume_id.id
    logger = logger or logging.getLogger(__name__)

    # Create snapshot
    logger.debug('Creating snapshot of EBS volume %s', volume_id)
    system2('sync', shell=True)
    snap = ec2_conn.create_snapshot(volume_id, description)
    logger.debug('Snapshot %s created for EBS volume %s', snap.id, volume_id)

    # Apply tags
    if not tags:
        logger.debug('No tags to apply to EBS snapshot %s' % snap.id)
    else:
        try:
            logger.debug('Applying tags to EBS snapshot %s : %s' % (snap.id, tags))
            ec2_conn.create_tags((snap.id, ), tags)
        except:
            logger.warn('Cannot apply tags to EBS snapshot %s', snap.id)

    if wait_completion:
        wait_snapshot(ec2_conn, snap, logger, timeout)

    return snap
开发者ID:AnyBucket,项目名称:scalarizr,代码行数:25,代码来源:ebstool.py


示例10: _cleanup_after_rebundle

def _cleanup_after_rebundle():
    cnf = bus.cnf
    pl = bus.platform
    logger = logging.getLogger(__name__)
    
    if 'volumes' not in pl.features:
        # Destory mysql storages
        if os.path.exists(cnf.private_path('storage/mysql.json')) and pl.name == 'rackspace':
            logger.info('Cleanuping old MySQL storage')
            mysql_bhv = firstmatched(lambda x: x in node.__node__['behavior'], ('mysql', 'mysql2', 'percona'))
            vol = node.__node__[mysql_bhv]['volume']
            vol.destroy(force=True)

    if os.path.exists('/etc/chef/client.pem'):
        os.remove('/etc/chef/client.pem')
    if os.path.exists('/etc/chef/client.rb'):
        os.remove('/etc/chef/client.rb')
    
    # Reset private configuration
    priv_path = cnf.private_path()
    for file in os.listdir(priv_path):
        if file in ('.user-data', '.update'):
            continue
        path = os.path.join(priv_path, file)
        coreutils.chmod_r(path, 0700)
        os.remove(path) if (os.path.isfile(path) or os.path.islink(path)) else shutil.rmtree(path)
    if not linux.os.windows_family:
        system2('sync', shell=True)
开发者ID:AnyBucket,项目名称:scalarizr,代码行数:28,代码来源:app.py


示例11: _change_selinux_ctx

	def _change_selinux_ctx(self):
		chcon = software.whereis('chcon')
		if disttool.is_rhel() and chcon:
			LOG.debug('Changing SELinux file security context for new mysql datadir')
			system2((chcon[0], '-R', '-u', 'system_u', '-r',
					'object_r', '-t', 'mysqld_db_t', 
					os.path.dirname(__mysql__['storage_dir'])), raise_exc=False)
开发者ID:golovast,项目名称:scalarizr,代码行数:7,代码来源:mysql2.py


示例12: move_mysqldir_to

    def move_mysqldir_to(self, storage_path):
        LOG.info('Moving mysql dir to %s' % storage_path)
        for directive, dirname in (
                        ('mysqld/log_bin', os.path.join(storage_path,STORAGE_BINLOG)),
                        ('mysqld/datadir', os.path.join(storage_path,STORAGE_DATA_DIR) + '/')
                        ):

            dest = os.path.dirname(dirname)
            if os.path.isdir(dest):
                LOG.info('No need to move %s to %s: already in place.' % (directive, dest))
            else:
                os.makedirs(dest)

                raw_value = self.my_cnf.get(directive)
                LOG.debug('directive %s:%s' % (directive, raw_value))
                if raw_value:
                    src_dir = os.path.dirname(raw_value + "/") + "/"
                    LOG.debug('source path: %s' % src_dir)
                    if os.path.isdir(src_dir) and src_dir != dest:
                        selinuxenabled = software.which('selinuxenabled')
                        if selinuxenabled:
                            if not system2((selinuxenabled, ), raise_exc=False)[2]:
                                if not system2((software.which('getsebool'), 'mysqld_disable_trans'), raise_exc=False)[2]:
                                    LOG.debug('Make SELinux rule for rsync')
                                    system2((software.which('setsebool'), '-P', 'mysqld_disable_trans', '1'))

                        LOG.info('Copying mysql directory \'%s\' to \'%s\'', src_dir, dest)
                        rsync(src_dir, dest, archive=True, exclude=['ib_logfile*', '*.sock'])

            self.my_cnf.set(directive, dirname)
            chown_r(dest, "mysql", "mysql")
            # Adding rules to apparmor config
            if disttool.is_debian_based():
                _add_apparmor_rules(dest)
开发者ID:yoyama,项目名称:scalarizr,代码行数:34,代码来源:mysql.py


示例13: on_host_init_response

	def on_host_init_response(self, message):
		with bus.initialization_op as op:
			with op.phase(self._phase_rabbitmq):
				with op.step(self._step_accept_scalr_conf):
		
					if not message.body.has_key("rabbitmq"):
						raise HandlerError("HostInitResponse message for RabbitMQ behaviour must have 'rabbitmq' property")
					
					path = os.path.dirname(self._volume_config_path)
					if not os.path.exists(path):
						os.makedirs(path)
			
					rabbitmq_data = message.rabbitmq.copy()
					
					if not rabbitmq_data['password']:
						rabbitmq_data['password'] = cryptotool.pwgen(10)
			
					if os.path.exists(self._volume_config_path):
						os.remove(self._volume_config_path)
			
					hostname = RABBIT_HOSTNAME_TPL % int(message.server_index)
					rabbitmq_data['server_index'] = message.server_index
					rabbitmq_data['hostname'] = hostname
			
					dns.ScalrHosts.set('127.0.0.1', hostname)
					with open('/etc/hostname', 'w') as f:
						f.write(hostname)
					system2(('hostname', '-F', '/etc/hostname'))
			
					if OPT_VOLUME_CNF in rabbitmq_data:
						if rabbitmq_data[OPT_VOLUME_CNF]:
							storage.Storage.backup_config(rabbitmq_data[OPT_VOLUME_CNF], self._volume_config_path)
						del rabbitmq_data[OPT_VOLUME_CNF]
			
					self._update_config(rabbitmq_data)
开发者ID:golovast,项目名称:scalarizr,代码行数:35,代码来源:rabbitmq.py


示例14: cluster_with

	def cluster_with(self, hostnames, do_reset=True):
		nodes = ['[email protected]%s' % host for host in hostnames]
		cmd = [RABBITMQCTL, 'cluster'] + nodes
		
		clustered = False
		
		while not clustered:
			self.stop_app()
			if do_reset:
				self.reset()
			system2(cmd, logger=self._logger)
			
			p = subprocess.Popen((RABBITMQCTL, 'start_app'))
			for i in range(15):
				if p.poll() is None:
					time.sleep(1)
					continue
								
				if p.returncode:
					raise Exception(p.stderr.read())
				else:
					clustered = True
					break
			else:
				p.kill()
				self.service.restart(force=True)
开发者ID:golovast,项目名称:scalarizr,代码行数:26,代码来源:rabbitmq.py


示例15: __init__

    def __init__(self):
        if not os.path.exists(MDADM_EXEC):
            if disttool.is_redhat_based():
                system2(('/usr/bin/yum', '-d0', '-y', 'install', 'mdadm', '-x', 'exim'), raise_exc=False)
            else:
                mgr = dynimp.package_mgr()
                mgr.install('mdadm', mgr.candidates('mdadm')[-1])
        for location in ['/etc ', '/lib']:
            path = os.path.join(location, 'udev/rules.d/85-mdadm.rules')
            if os.path.exists(path):

                rule = None
                with open(path, 'r') as fp:
                    rule = fp.read()

                if rule:
                    rule = re.sub(re.compile('^([^#])', re.M), '#\\1', rule)
                    with open(path, 'w') as fp:
                        fp.write(rule)

        self._raid_devices_re   = re.compile('Raid\s+Devices\s+:\s+(?P<count>\d+)')
        self._total_devices_re  = re.compile('Total\s+Devices\s+:\s+(?P<count>\d+)')
        self._state_re          = re.compile('State\s+:\s+(?P<state>.+)')
        self._rebuild_re        = re.compile('Rebuild\s+Status\s+:\s+(?P<percent>\d+)%')
        self._level_re                  = re.compile('Raid Level : (?P<level>.+)')
开发者ID:AnyBucket,项目名称:scalarizr,代码行数:25,代码来源:mdadm.py


示例16: __init__

    def __init__(self):
        if 'gce' == node.__node__['platform'].name:
            self.ensure_pid_directory()

        self.mysql_cli = MySQLClient()

        service_exec = '/usr/sbin/service' if linux.os.debian_family else '/sbin/service'
        service_name = 'mysql'
        if linux.os.redhat_family:
            if  linux.os['release'] >= (7, 0) and \
                    system2('systemctl list-unit-files | grep mariadb', raise_exc=False, shell=True)[2] == 0:
                service_name = 'mariadb'
            elif 'percona' not in node.__node__['behavior']:
                service_name = 'mysqld'

        if linux.os.redhat_family or linux.os.ubuntu:
            initd_script = (service_exec, service_name)
        else:
            initd_script = '/etc/init.d/{0}'.format(service_name)

        pid_file = None
        try:
            out = system2("my_print_defaults mysqld", shell=True, silent=True)
            m = re.search("--pid[-_]file=(.*)", out[0], re.MULTILINE)
            if m:
                pid_file = m.group(1)
            m = re.search("--socket=(.*)", out[0], re.MULTILINE)
            if m:
                self.socket_file = m.group(1)
        except:
            pass

        initdv2.ParametrizedInitScript.__init__(self, SERVICE_NAME,
                        initd_script, pid_file, socks=[initdv2.SockParam(MYSQL_DEFAULT_PORT, timeout=3600)])
开发者ID:chenleji,项目名称:scalarizr,代码行数:34,代码来源:mysql.py


示例17: on_init

    def on_init(self):
        bus.on(host_init_response=self.on_host_init_response, block_device_mounted=self.on_block_device_mounted)

        # Add internal messages to scripting skip list
        try:
            for m in (Messages.INT_SERVER_REBOOT, Messages.INT_SERVER_HALT, Messages.HOST_INIT_RESPONSE):
                scalarizr.handlers.script_executor.skip_events.add(m)
        except AttributeError:
            pass

        # Mount all filesystems
        if os_dist["family"] != "Windows":
            system2(("mount", "-a"), raise_exc=False)

        # cloud-init scripts may disable root ssh login
        for path in ("/etc/ec2-init/ec2-config.cfg", "/etc/cloud/cloud.cfg"):
            if os.path.exists(path):
                c = None
                with open(path, "r") as fp:
                    c = fp.read()
                c = re.sub(re.compile(r"^disable_root[^:=]*([:=]).*", re.M), r"disable_root\1 0", c)
                with open(path, "w") as fp:
                    fp.write(c)

        # Add firewall rules
        # if self._cnf.state in (ScalarizrState.BOOTSTRAPPING, ScalarizrState.IMPORTING):
        self._insert_iptables_rules()
        # if __node__['state'] !=  ScalarizrState.IMPORTING:
        if __node__["state"] == "running":
            scalarizr.handlers.sync_globals()
开发者ID:chenleji,项目名称:scalarizr,代码行数:30,代码来源:lifecycle.py


示例18: __init__

    def __init__(self):
        if not os.path.exists(MDADM_EXEC):
            if linux.os.redhat_family:
                system2(('/usr/bin/yum', '-d0', '-y', 'install', 'mdadm', '-x', 'exim'), raise_exc=False)
            else:
                pkgmgr.installed('mdadm')

        if not os.path.exists('/proc/mdstat'):
            coreutils.modprobe('md_mod')

        for location in ['/etc ', '/lib']:
            path = os.path.join(location, 'udev/rules.d/85-mdadm.rules')
            if os.path.exists(path):

                rule = None
                with open(path, 'r') as fp:
                    rule = fp.read()
                if rule:
                    rule = re.sub(re.compile('^([^#])', re.M), '#\\1', rule)
                    with open(path, 'w') as fp:
                        fp.write(rule)

        self._raid_devices_re   = re.compile('Raid\s+Devices\s+:\s+(?P<count>\d+)')
        self._total_devices_re  = re.compile('Total\s+Devices\s+:\s+(?P<count>\d+)')
        self._state_re          = re.compile('State\s+:\s+(?P<state>.+)')
        self._rebuild_re        = re.compile('Rebuild\s+Status\s+:\s+(?P<percent>\d+)%')
        self._level_re                  = re.compile('Raid Level : (?P<level>.+)')
开发者ID:chenleji,项目名称:scalarizr,代码行数:27,代码来源:mdadm.py


示例19: start

    def start(self):
        try:
            if not self.running:

                #TODO: think about moving this code elsewhere
                if self.port == __redis__['defaults']['port']:
                    base_dir = self.redis_conf.dir
                    snap_src = os.path.join(base_dir, __redis__['db_filename'])
                    snap_dst = os.path.join(base_dir, get_snap_db_filename(__redis__['defaults']['port']))
                    if os.path.exists(snap_src) and not os.path.exists(snap_dst):
                        shutil.move(snap_src, snap_dst)
                        if 'snapshotting' == __redis__["persistence_type"]:
                            self.redis_conf.dbfilename = snap_dst
                    aof_src = os.path.join(base_dir, __redis__['aof_filename'])
                    aof_dst = os.path.join(base_dir, get_aof_db_filename(__redis__['defaults']['port']))
                    if os.path.exists(aof_src) and not os.path.exists(aof_dst):
                        shutil.move(aof_src, aof_dst)
                        if 'aof' == __redis__["persistence_type"]:
                            self.redis_conf.appendfilename = aof_dst

                LOG.debug('Starting %s on port %s' % (__redis__['redis-server'], self.port))
                system2('%s %s -s %s -c "%s %s"' % (
                    __redis__['su'], 
                    __redis__['defaults']['user'], 
                    __redis__['bash'], 
                    __redis__['redis-server'], 
                    self.config_path), shell=True, close_fds=True, preexec_fn=os.setsid)
                wait_until(lambda: self.running)
                wait_until(lambda: self.cli.test_connection())
                LOG.debug('%s process has been started.' % SERVICE_NAME)

        except PopenError, e:
            LOG.error('Unable to start redis process: %s' % e)
            raise initdv2.InitdError(e)
开发者ID:AnyBucket,项目名称:scalarizr,代码行数:34,代码来源:redis.py


示例20: cluster_with

    def cluster_with(self, self_hostname, hostnames, disk_node=True, do_reset=True):
        if RABBITMQ_VERSION >= (3, 0, 0):
            # New way of clustering was introduced in rabbit 3.0.0
            one_node = NODE_HOSTNAME_TPL % hostnames[0]
            cmd = [RABBITMQCTL, 'join_cluster', one_node]
            if not disk_node:
                cmd.append('--ram')
        else:
            nodes = [NODE_HOSTNAME_TPL % host for host in hostnames]
            if disk_node:
                nodes.append(NODE_HOSTNAME_TPL % self_hostname)
            cmd = [RABBITMQCTL, 'cluster'] + nodes

        clustered = False

        while not clustered:
            self.stop_app()
            if do_reset:
                self.reset()
            system2(cmd, logger=self._logger)

            p = subprocess.Popen((RABBITMQCTL, 'start_app'))
            for i in range(15):
                if p.poll() is None:
                    time.sleep(1)
                    continue

                if p.returncode:
                    raise Exception(p.stderr.read())
                else:
                    clustered = True
                    break
            else:
                p.kill()
                self.service.restart(force=True)
开发者ID:chenleji,项目名称:scalarizr,代码行数:35,代码来源:rabbitmq.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python util.wait_until函数代码示例发布时间:2022-05-27
下一篇:
Python util.firstmatched函数代码示例发布时间: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