Пример #1
0
	def active(self):
		active = 0
		for machine in self.machines:
			active += machine.active()

		log.debug('rack %d: %d active' % (self.index, active))
		return active
Пример #2
0
	def _createCluster(self, mgmt):
		log.debug('mgmt: %s' % mgmt)

		# find which rack has the most machines to set others to the same height
		max_machines = 0
		for rack in mgmt.racks:
			max_machines = rack.maxMachineIndex() > max_machines and rack.maxMachineIndex() or max_machines

		for rack in mgmt.racks:
			rUi = RackUI(self, rack=rack, size=max_machines)
			rUi.grid(row=1, column=rack.realindex, sticky=EXPAND)

		# make the racks share the width equally
		racks = self.grid_size()[0]
		log.debug('we have %d racks' % racks)
		for index in range(0, racks):
			self.columnconfigure(index, weight=1)

		# create command listbox
		commands = {}
		for command in (SshSshConsole, SshRconsConsole):
			commands[command.DISPLAY] = command

		var = tk.StringVar(self)
		var.set(mgmt.command.DISPLAY)
		commandL = tk.OptionMenu(self, var, *commands.keys())
		commandL.grid(row=0, column=0, columnspan=racks)

		tmp = var.set
		def myset(text):
			log.debug('setting text to %s' % text)
			log.debug('using command: %s' % commands[text])
			mgmt.command = commands[text]
			tmp(text)
		var.set = myset
Пример #3
0
		def myset(text):
			log.debug('setting text to %s' % text)
			log.debug('using command: %s' % commands[text])
			mgmt.command = commands[text]
			tmp(text)