def run(self): #check the user has specified a password user=CONFIGURATION.get("user") password=CONFIGURATION.get("password") if user and password: extra_reason = "" i = IEnabler( user=user, password=password, host=CONFIGURATION.get("ienabler_host"), port=CONFIGURATION.get("ienabler_port") ) if self.choice == "Enable": ok = i.enable() else: ok = i.disable() else: ok = False extra_reason = "Please Enter Password" self.emit("completed", ok, self.choice, extra_reason)
choice = "Disable" if o in ("-u", "--user"): USER = a if o in ("-p", "--password"): PASSWORD = a if o in ("-h", "--host"): HOST = a if o in ("-P", "--port"): PORT = a if USER == "": USER = raw_input("Username:"******"": PASSWORD = getpass.getpass("Password:"******"Enable": ok = i.enable() else: ok = i.disable() if ok: print "%sd OK" % choice else: print "Could not %s" % choice sys.exit(1)