本文整理汇总了Python中migasfree_client.utils.execute函数的典型用法代码示例。如果您正苦于以下问题:Python execute函数的具体用法?Python execute怎么用?Python execute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了execute函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: clean_all
def clean_all(self):
"""
bool clean_all(void)
"""
self._cmd = '{0} clean'.format(self._pms)
logging.debug(self._cmd)
if execute(self._cmd)[0] == 0:
self._cmd = '{0} -o Acquire::Languages=none --assume-yes update'.format(self._pms)
logging.debug(self._cmd)
return execute(self._cmd)[0] == 0
return False
开发者ID:migasfree,项目名称:migasfree-client,代码行数:13,代码来源:apt.py
示例2: clean_all
def clean_all(self):
'''
bool clean_all(void)
'''
self._cmd = '%s clean all' % self._pms
logging.debug(self._cmd)
if execute(self._cmd)[0] == 0:
self._cmd = '%s --assumeyes check-update' % self._pms
logging.debug(self._cmd)
return (execute(self._cmd)[0] == 0)
return False
开发者ID:jpueyob,项目名称:migasfree-client,代码行数:13,代码来源:yum.py
示例3: clean_all
def clean_all(self):
"""
bool clean_all(void)
"""
self._cmd = '{0} clean all'.format(self._pms)
logging.debug(self._cmd)
if execute(self._cmd)[0] == 0:
self._cmd = '{0} --assumeyes check-update'.format(self._pms)
logging.debug(self._cmd)
ret, _, _ = execute(self._cmd)
return ret == 0 or ret == 100
return False
开发者ID:migasfree,项目名称:migasfree-client,代码行数:14,代码来源:yum.py
示例4: remove_silent
def remove_silent(self, package_set):
"""
(bool, string) remove_silent(list package_set)
"""
if not isinstance(package_set, list):
return False, 'package_set is not a list: %s' % package_set
for pkg in package_set[:]:
if not self.is_installed(pkg):
package_set.remove(pkg)
if not package_set:
return True, None
self._cmd = '{0} {1} purge {2}'.format(
self._pms,
self._silent_options,
' '.join(package_set)
)
logging.debug(self._cmd)
_ret, _, _error = execute(
self._cmd,
interactive=False,
verbose=True
)
return _ret == 0, _error
开发者ID:migasfree,项目名称:migasfree-client,代码行数:28,代码来源:apt.py
示例5: update_silent
def update_silent(self):
"""
(bool, string) update_silent(void)
"""
self._cmd = '%s --non-interactive update --no-force-resolution "*"' % self._pms
logging.debug(self._cmd)
_ret, _output, _error = execute(self._cmd, interactive=False, verbose=True)
if _ret != 0:
return (False, "%s\n%s\n%s" % (str(_ret), _output, _error))
self._cmd = "%s lu -a" % self._pms
logging.debug(self._cmd)
_ret, _output, _error = execute(self._cmd, interactive=False, verbose=True)
return (_ret == 0, "%s\n%s\n%s" % (str(_ret), _output, _error))
开发者ID:migasfree,项目名称:migasfree-client,代码行数:16,代码来源:zypper.py
示例6: install_silent
def install_silent(self, package_set):
"""
(bool, string) install_silent(list package_set)
"""
if not isinstance(package_set, list):
return False, 'package_set is not a list: %s' % package_set
for pkg in package_set[:]:
if self.is_installed(pkg):
package_set.remove(pkg)
if not package_set:
return True, None
self._cmd = '{0} --non-interactive install --no-force-resolution {1}'.format(
self._pms,
' '.join(package_set)
)
logging.debug(self._cmd)
_ret, _output, _error = execute(
self._cmd,
interactive=False,
verbose=True
)
return _ret == 0, '{0}\n{1}\n{2}'.format(_ret, _output, _error)
开发者ID:migasfree,项目名称:migasfree-client,代码行数:27,代码来源:zypper.py
示例7: install_silent
def install_silent(self, package_set):
'''
(bool, string) install_silent(list package_set)
'''
if not type(package_set) is list:
return (False, 'package_set is not a list: %s' % package_set)
for pkg in package_set[:]:
if self.is_installed(pkg):
package_set.remove(pkg)
if not package_set:
return (True, None)
self._cmd = '%s --assumeyes install %s' % (
self._pms,
' '.join(package_set)
)
logging.debug(self._cmd)
_ret, _output, _error = execute(
self._cmd,
interactive=False,
verbose=True
)
return (_ret == 0, _error)
开发者ID:jpueyob,项目名称:migasfree-client,代码行数:27,代码来源:yum.py
示例8: import_server_key
def import_server_key(self, file_key):
"""
bool import_server_key( file )
"""
self._cmd = "rpm --import %s > /dev/null" % file_key
logging.debug(self._cmd)
return execute(self._cmd)[0] == 0
开发者ID:migasfree,项目名称:migasfree-client,代码行数:8,代码来源:zypper.py
示例9: import_server_key
def import_server_key(self, file_key):
"""
bool import_server_key(string file_key)
"""
self._cmd = 'apt-key add {0} >/dev/null'.format(file_key)
logging.debug(self._cmd)
return execute(self._cmd)[0] == 0
开发者ID:migasfree,项目名称:migasfree-client,代码行数:8,代码来源:apt.py
示例10: is_installed
def is_installed(self, package):
"""
bool is_installed(string package)
"""
self._cmd = "%s -q %s" % (self._pm, package.strip())
logging.debug(self._cmd)
return execute(self._cmd, interactive=False)[0] == 0
开发者ID:migasfree,项目名称:migasfree-client,代码行数:9,代码来源:zypper.py
示例11: search
def search(self, pattern):
'''
bool search(string pattern)
'''
self._cmd = '%s search %s' % (self._pms, pattern.strip())
logging.debug(self._cmd)
return (execute(self._cmd)[0] == 0)
开发者ID:jpueyob,项目名称:migasfree-client,代码行数:9,代码来源:yum.py
示例12: remove
def remove(self, package):
'''
bool remove(string package)
'''
self._cmd = '%s remove %s' % (self._pms, package.strip())
logging.debug(self._cmd)
return (execute(self._cmd)[0] == 0)
开发者ID:jpueyob,项目名称:migasfree-client,代码行数:9,代码来源:yum.py
示例13: install
def install(self, package):
'''
bool install(string package)
'''
self._cmd = '%s install %s' % (self._pms, package.strip())
logging.debug(self._cmd)
return (execute(self._cmd)[0] == 0)
开发者ID:jpueyob,项目名称:migasfree-client,代码行数:9,代码来源:yum.py
示例14: install
def install(self, package):
"""
bool install(string package)
"""
self._cmd = '{0} install {1}'.format(self._pms, package.strip())
logging.debug(self._cmd)
return execute(self._cmd)[0] == 0
开发者ID:migasfree,项目名称:migasfree-client,代码行数:9,代码来源:yum.py
示例15: search
def search(self, pattern):
"""
bool search(string pattern)
"""
self._cmd = '{0} search {1}'.format(self._pms, pattern.strip())
logging.debug(self._cmd)
return execute(self._cmd)[0] == 0
开发者ID:migasfree,项目名称:migasfree-client,代码行数:9,代码来源:zypper.py
示例16: remove
def remove(self, package):
"""
bool remove(string package)
"""
self._cmd = '{0} remove {1}'.format(self._pms, package.strip())
logging.debug(self._cmd)
return execute(self._cmd)[0] == 0
开发者ID:migasfree,项目名称:migasfree-client,代码行数:9,代码来源:zypper.py
示例17: is_installed
def is_installed(self, package):
'''
bool is_installed(string package)
'''
self._cmd = '%s -q %s' % (self._pm, package.strip())
logging.debug(self._cmd)
return (execute(self._cmd, interactive=False)[0] == 0)
开发者ID:jpueyob,项目名称:migasfree-client,代码行数:9,代码来源:yum.py
示例18: cmd_reboot
def cmd_reboot(self):
ret, _, _ = execute('which ck-list-sessions')
if ret == 0:
cmd = 'dbus-send --system --print-reply '
'--dest=org.freedesktop.ConsoleKit '
'/org/freedesktop/ConsoleKit/Manager '
'org.freedesktop.ConsoleKit.Manager.Restart'
else:
ret, _, _ = execute('which systemctl')
if ret == 0:
cmd = 'systemctl reboot -i'
else:
cmd = 'dbus-send --system --print-reply '
'--dest=org.freedesktop.login1 '
'/org/freedesktop/login1 '
'"org.freedesktop.login1.Manager.Reboot" boolean:true'
execute(cmd, interactive=True, verbose=True)
开发者ID:migasfree,项目名称:migasfree-launcher,代码行数:18,代码来源:indicator.py
示例19: install
def install(self, package):
"""
bool install(string package)
"""
self._cmd = "%s install --no-force-resolution %s" % (self._pms, package.strip())
logging.debug(self._cmd)
return execute(self._cmd)[0] == 0
开发者ID:migasfree,项目名称:migasfree-client,代码行数:9,代码来源:zypper.py
注:本文中的migasfree_client.utils.execute函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论