MCPcopy
hub / github.com/retspen/webvirtcloud / set_console_passwd

Method set_console_passwd

vrtManager/instance.py:482–501  ·  view source on GitHub ↗
(self, passwd)

Source from the content-addressed store, hash-verified

480 "/domain/devices/graphics/@passwd")
481
482 def set_console_passwd(self, passwd):
483 xml = self._XMLDesc(VIR_DOMAIN_XML_SECURE)
484 root = ElementTree.fromstring(xml)
485 console_type = self.get_console_type()
486 try:
487 graphic = root.find("devices/graphics[@type='%s']" % console_type)
488 except SyntaxError:
489 # Little fix for old version ElementTree
490 graphic = root.find("devices/graphics")
491 if graphic is None:
492 return False
493 if passwd:
494 graphic.set('passwd', passwd)
495 else:
496 try:
497 graphic.attrib.pop('passwd')
498 except:
499 pass
500 newxml = ElementTree.tostring(root)
501 return self._defineXML(newxml)
502
503 def set_console_keymap(self, keymap):
504 xml = self._XMLDesc(VIR_DOMAIN_XML_SECURE)

Callers 1

instanceFunction · 0.80

Calls 3

_XMLDescMethod · 0.95
get_console_typeMethod · 0.95
_defineXMLMethod · 0.95

Tested by

no test coverage detected