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


Python Common.client_name方法代码示例

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

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

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

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

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

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


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