当前位置: 首页>>代码示例>>Python>>正文


Python Common.banner方法代码示例

本文整理汇总了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
开发者ID:emphanos,项目名称:fab2puppet,代码行数:35,代码来源:manager.py

示例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')
开发者ID:emphanos,项目名称:fab2puppet,代码行数:45,代码来源:manager.py

示例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
开发者ID:emphanos,项目名称:fab2puppet,代码行数:23,代码来源:manager.py


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