Exemplo n.º 1
0
	def __init__(self,device_type='',hostname='',username=config.username,password=config.password,debug=config.debug,sshkey=config.sshkey):
		try:
			self.device=devices(device_type,hostname,username,password)
		except Exception, e:
			print "LOL give it up, you can't win!"
			for i in e:
				print i
Exemplo n.º 2
0
	def chef_knife(self,cmds):
		msg="Performing knife cmd "+cmds
		self.debugit(msg)
		# sanity check
		
		# generate command to run
		try:
			cmd=devices(self.device_type,self.hostname,self.username,self.password).chefserver_knife(cmds)
			# execute based on access_type to device_type mapping
			self.debugit("cmd chat script:")
			self.debugit(cmd)
		except Exception,e:
			print "Exception generating chat script for device %s, continue..." % self.device_type
			for i in e:
				print i
			pass
Exemplo n.º 3
0
	def chef_bootstrap(self,cmds):
		msg="Performing bootstrap "+cmds
		self.debugit(msg)
		# sanity check
		
		# generate command to run
		try:
			cmd=devices(self.device_type,self.hostname,self.username,self.password).chefserver_bootstrap(cmds)
			# execute based on access_type to device_type mapping
			self.debugit("cmd chat script:")
			self.debugit(cmd)
		except:
			print "Exception generating chat script for device %s, continue..." % self.device_type
			pass
		try:
			if cmd:
				return access(self.device_type,self.hostname,"ubuntu",self.password,debug=self.debug,sshkey="/home/ubuntu/.ssh/dtaylor-openstack.priv")._ssh_access(cmd)
		except:
			print "Exception in chef bootstrap."
			pass