本文整理汇总了Python中common.Common.client_name方法的典型用法代码示例。如果您正苦于以下问题:Python Common.client_name方法的具体用法?Python Common.client_name怎么用?Python Common.client_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.Common
的用法示例。
在下文中一共展示了Common.client_name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: install
# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import client_name [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: run
# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import client_name [as 别名]
def run(self):
"""
"""
c = Common()
sleep(3)
subprocess.call(['/usr/sbin/puppetca', '--sign', '%s.%s' % (c.client_name(),self.domain)])
示例3: checkCertificate
# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import client_name [as 别名]
def checkCertificate(self):
""" Method used to check if the host is already linked on master on not.
return 'False' or 'True'.
"""
c = Common()
try:
checkCert = subprocess.Popen(['/usr/sbin/puppetca', '-la'],stdout=subprocess.PIPE)
checkCertPIPE = checkCert.communicate()[0]
clientCert = re.search('.*\+.*%s\.%s' % (c.client_name(),self.re_domain), checkCertPIPE)
except Exception, e:
print 'error :', e
示例4: remove
# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import client_name [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
示例5: update_host
# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import client_name [as 别名]
def update_host(self):
""" Method used to apply/noop updates on a specific host.
"""
c = Common()
l = Logger(c.client_name())
try:
if self.__noop!='apply':
self.noop_puppet()
else:
updatePuppet = AddCert()
updatePuppet.start()
updatePuppet.join()
print '\n' + '-'*60 + '\n'
return 0
except Exception, e:
print 'error :', e
示例6: remove_color
# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import client_name [as 别名]
start += 1
if self.__notification_required:
self.notification('Error(s)',streamOutput.getvalue())
print 'Warning(s) during execution :', self.__countwarn
print 'Error(s) during execution :', self.__counterr
def remove_color(self,input):
"""
"""
pattern = re.compile('\033\[[0-9;]+m')
output = re.sub(pattern,'',input)
return output
def log_parser(self):
"""
"""
self.event_counter('0')
if __name__ == "__main__":
"""
"""
c = Common()
env.host_string='puppet-client'
l = Logger(c.client_name())
l.log_parser()