本文整理汇总了Python中common.Common.banner方法的典型用法代码示例。如果您正苦于以下问题:Python Common.banner方法的具体用法?Python Common.banner怎么用?Python Common.banner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.Common
的用法示例。
在下文中一共展示了Common.banner方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: install
# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import banner [as 别名]
def install(self):
""" Method used to install, link, update puppet client.
"""
c = Common()
c.banner()
c.client_hosts()
hostname = Hostname()
hostname.check()
l = Logger(c.client_name())
reader = open(self.logfile)
startline = len(reader.readlines())
l.event_counter(startline)
try:
operatingSystem = run("/bin/cat /etc/issue | /usr/bin/awk '{print $1}'")
if(operatingSystem=='Debian'):
run('aptitude -y update && aptitude -y install puppet')
else:
print '--->\tOS not supported'
sys.exit(0)
puppetthread = AddCert()
puppetthread.start()
puppetthread.join()
except Exception, e:
print 'error :', e
示例2: __init__
# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import banner [as 别名]
def __init__(self,hostaddr=None,noop='noop'):
"""
"""
Conf.__init__(self)
logfile = self.logfile
c = Common()
c.banner()
c.client_hosts()
self.__host=hostaddr
self.__noop=noop
self.__counter = 0
self.__exclude = 0
self.__reader = open(logfile)
self.__startline = len(self.__reader.readlines())
self.__reader.close()
l = Logger('initiator')
l.logx('-'*70)
if self.__host=='all':
l.logx('Update command on all hosts executed')
self.update_all()
l.event_counter(self.__startline)
elif re.match(r'^\.\*$',self.__host):
print '\n[-]--> please use \'all\' instead of \'.*\'\n'
elif re.match(r'.*[\.\*\+\[\]]+.*',self.__host):
l.logx('Update regex command (%s) executed' % self.__host)
self.reget_host()
l.event_counter(self.__startline)
else:
l.logx('Update command on %s executed' % self.__host)
env.host_string=self.__host
self.update_host()
l.event_counter(self.__startline)
l.logx('End of execution')
示例3: remove
# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import banner [as 别名]
def remove(self):
""" Method used to remove puppet, erase custom facts on puppet client.
"""
c = Common()
c.banner()
c.client_hosts()
operatingSystem = run("/bin/cat /etc/issue | /usr/bin/awk '{print $1}'")
if(operatingSystem=='Debian'):
run('aptitude -y purge puppet')
run('find /var/lib/puppet -type f -print0 | xargs -0r rm')
else:
print '--->\tOS not supported'
sys.exit(0)
try:
subprocess.call(['/usr/sbin/puppetca', '--clean', '%s.%s' % (c.client_name(),self.domain)])
except Exception, e:
print 'error :', e
pass