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

Python linux.build_cmd_args函数代码示例

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

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



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

示例1: mysqldump

def mysqldump(*databases, **long_kwds):
    output = long_kwds.pop("output", None)
    cmd = linux.build_cmd_args(executable="/usr/bin/mysqldump", long=long_kwds, params=databases)
    kwds = {}
    if output:
        kwds["stdout"] = open(output, "w+")
    return linux.system(cmd, **kwds)
开发者ID:pombredanne,项目名称:scalarizr,代码行数:7,代码来源:mysql2.py


示例2: args

 def args(self, *params, **long_kwds):
     self.cmd = linux.build_cmd_args(
         executable=self.executable,
         long=long_kwds,
         params=params)
     LOG.debug('cmd: %s', self.cmd)
     return self
开发者ID:yoyama,项目名称:scalarizr,代码行数:7,代码来源:mysql2.py


示例3: dd

def dd(**kwds):
    short = []
    for k, v in kwds.items():
        short.append('%s=%s' % (k, v))
    return linux.system(linux.build_cmd_args(
                executable='/bin/dd',
                short=short))
开发者ID:chenleji,项目名称:scalarizr,代码行数:7,代码来源:coreutils.py


示例4: innobackupex

def innobackupex(*params, **long_kwds):
	if not os.path.exists('/usr/bin/innobackupex'):
		pkgmgr.installed('percona-xtrabackup')
	return linux.system(linux.build_cmd_args(
			executable='/usr/bin/innobackupex', 
			long=long_kwds, 
			params=params))
开发者ID:golovast,项目名称:scalarizr,代码行数:7,代码来源:mysql2.py


示例5: _gen_src

	def _gen_src(self):
		if self.file_per_database:
			for db_name in self._databases:
				self._current_db = db_name
				cmd = linux.build_cmd_args(
					executable='/usr/bin/mysqldump',
					params=__mysql__['mysqldump_options'].split() + [db_name])
				mysql_dump = subprocess.Popen(cmd, bufsize=-1, 
								stdout=subprocess.PIPE, stderr=subprocess.PIPE)
				yield mysql_dump.stdout
		else:
			cmd = linux.build_cmd_args(
				executable='/usr/bin/mysqldump',
				params=__mysql__['mysqldump_options'].split() + ['--all-databases'])
			mysql_dump = subprocess.Popen(cmd, bufsize=-1, 
							stdout=subprocess.PIPE, stderr=subprocess.PIPE)
			yield mysql_dump.stdout
开发者ID:golovast,项目名称:scalarizr,代码行数:17,代码来源:mysql2.py


示例6: mkfs

	def mkfs(self, device, *short_args):
		short_args = list(short_args)
		short_args.extend(('-t', self.type))
		args = linux.build_cmd_args(
					executable='/sbin/mkfs', 
					short=short_args, 
					params=[device])
		system(args, error_text=self.error_messages['mkfs'] % device)
开发者ID:golovast,项目名称:scalarizr,代码行数:8,代码来源:__init__.py


示例7: modprobe

def modprobe(module_name, **long_kwds):
    if not os_info['mods_enabled']:
        return (None, None, 0)

    return linux.system(linux.build_cmd_args(
                executable='/sbin/modprobe', 
                long=long_kwds,
                params=[module_name]), 
            error_text='Kernel module %s is not available' % module_name)
开发者ID:chenleji,项目名称:scalarizr,代码行数:9,代码来源:coreutils.py


示例8: mysqldump

def mysqldump(*databases, **long_kwds):
	output = long_kwds.pop('output', None)
	cmd = linux.build_cmd_args(
			executable='/usr/bin/mysqldump',
			long=long_kwds,
			params=databases)
	kwds = {}
	if output:
		kwds['stdout'] = open(output, 'w+')
	return linux.system(cmd, **kwds)
开发者ID:golovast,项目名称:scalarizr,代码行数:10,代码来源:mysql2.py


示例9: rsync

def rsync(src, dst, **long_kwds):
    if not os.path.exists('/usr/bin/rsync'):
        pkgmgr.installed('rsync')
    system(['sync'])
    output = system(build_cmd_args(executable='/usr/bin/rsync',
                                   long=long_kwds,
                                   params=[src, dst],
                                   duplicate_keys=True))
    system(['sync'])
    return output
开发者ID:AnyBucket,项目名称:scalarizr,代码行数:10,代码来源:rsync.py


示例10: vgchange

def vgchange(*volume_group_names, **long_kwds):
	try:
		return linux.system(linux.build_cmd_args(
				executable='/sbin/vgchange',
				long=long_kwds,
				params=volume_group_names))
	except linux.LinuxError, e:
		if e.returncode == 5:
			raise NotFound()
		raise
开发者ID:golovast,项目名称:scalarizr,代码行数:10,代码来源:lvm2.py


示例11: my_print_defaults

def my_print_defaults(*option_groups):
    out = linux.system(linux.build_cmd_args(executable="/usr/bin/my_print_defaults", params=option_groups))[0]
    ret = {}
    for line in out.splitlines():
        cols = line.split("=")
        ret[cols[0][2:]] = cols[1] if len(cols) > 1 else True
    for key in __mysql__["defaults"]:
        if key not in ret:
            ret[key] = __mysql__["defaults"][key]
    return ret
开发者ID:pombredanne,项目名称:scalarizr,代码行数:10,代码来源:mysql2.py


示例12: iptables

def iptables(**long_kwds):

	ordered_long = OrderedDict()
	for key in ("protocol", "match"):
		if key in long_kwds:
			ordered_long[key] = long_kwds.pop(key)
	ordered_long.update(long_kwds)

	return linux.system(linux.build_cmd_args(executable=IPTABLES_BIN,
		long=ordered_long))
开发者ID:golovast,项目名称:scalarizr,代码行数:10,代码来源:iptables.py


示例13: pvchange

def pvchange(*physical_volume_paths, **long_kwds):
	try:
		return linux.system(linux.build_cmd_args(
				executable='/sbin/pvchange',
				long=long_kwds,
				params=physical_volume_paths))
	except linux.LinuxError, e:
		if e.returncode == 5:
			raise NotFound()
		raise
开发者ID:golovast,项目名称:scalarizr,代码行数:10,代码来源:lvm2.py


示例14: lvcreate

def lvcreate(*params, **long_kwds):
    try:
        return linux.system(linux.build_cmd_args(
                        executable='/sbin/lvcreate',
                        long=long_kwds,
                        params=params))
    finally:
        if linux.os['name'] == 'GCEL':
            # Logical volumes not available for mount immediately
            # Problem posted to Google at 29 Apr 2013.
            time.sleep(1)
开发者ID:AnyBucket,项目名称:scalarizr,代码行数:11,代码来源:lvm2.py


示例15: iptables_save

def iptables_save(filename=None, *short_args, **long_kwds):
    # file name is a path string or file-like object
    # if filename is None return output
    kwds = {}
    if isinstance(filename, basestring):
        filename = open(filename, 'w+')
    if hasattr(filename, 'write'):
        kwds['stdout'] = filename
    out = linux.system(linux.build_cmd_args(executable=IPTABLES_SAVE,
            short=short_args, long=long_kwds), **kwds)[0]
    return out
开发者ID:notbrain,项目名称:scalarizr,代码行数:11,代码来源:iptables.py


示例16: lvchange

def lvchange(*logical_volume_path, **long_kwds):
    try:
        long_kwds.update({'yes': True})
        return linux.system(linux.build_cmd_args(
                        executable='/sbin/lvchange',
                        long=long_kwds,
                        params=logical_volume_path))
    except linux.LinuxError, e:
        if 'not found' in str(e).lower():
            raise NotFound()
        raise
开发者ID:AnyBucket,项目名称:scalarizr,代码行数:11,代码来源:lvm2.py


示例17: get_children

 def get_children(self):
     try:
         pgrep = linux.system(linux.build_cmd_args(
             executable="pgrep",
             short=["-P"],
             params=[str(self.pid)]))
     except linux.LinuxError:
         children = []
     else:
         children = map(int, pgrep[0].splitlines())
     return children
开发者ID:notbrain,项目名称:scalarizr,代码行数:11,代码来源:mysql2.py


示例18: vgremove

def vgremove(*volume_group_names, **long_kwds):
	try:
		long_kwds.update({'force': True})
		return linux.system(linux.build_cmd_args(
				executable='/sbin/vgremove',
				long=long_kwds,
				params=volume_group_names))
	except linux.LinuxError, e:
		if e.returncode == 5:
			raise NotFound()
		raise
开发者ID:golovast,项目名称:scalarizr,代码行数:11,代码来源:lvm2.py


示例19: umount

def umount(device_or_mpoint, **long_kwds):
    args = linux.build_cmd_args(
            executable='/bin/umount',
            short=('-f', device_or_mpoint),
            long=long_kwds)
    try:
        linux.system(args, error_text='Cannot umount %s' % device_or_mpoint)
    except linux.LinuxError, e:
        if 'not mounted' in e.err or 'not found' in e.err:
            return
        raise
开发者ID:chenleji,项目名称:scalarizr,代码行数:11,代码来源:mount.py


示例20: lvremove

def lvremove(*logical_volume_paths, **long_kwds):
	try:
		long_kwds.update({'force': True})
		return linux.system(linux.build_cmd_args(
				executable='/sbin/lvremove',
				long=long_kwds,
				params=logical_volume_paths))
	except linux.LinuxError, e:
		if e.returncode == 5:
			raise NotFound()
		raise
开发者ID:golovast,项目名称:scalarizr,代码行数:11,代码来源:lvm2.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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