def do_validate_cloud_creds(self, account): """ Validates the cloud account credentials for the specified account. If creds are not valid, returns an error code & reason string Arguments: account - a cloud account to validate Returns: Validation Code and Details String """ status = RwcalYang.CloudConnectionStatus(status="success", details="") return status
def do_validate_cloud_creds(self, account): """ Validates the cloud account credentials for the specified account. Performs an access to the resources using underlying API. If creds are not valid, returns an error code & reason string Arguments: account - a cloud account to validate Returns: Validation Code and Details String """ status = RwcalYang.CloudConnectionStatus( status="success", details="AWS Cloud Account validation not implemented yet" ) return status
def validate_account_creds(self): status = RwcalYang.CloudConnectionStatus() try: self.env = jujuclient.Environment(self.endpoint) self.env.login(self._passwd, self._user) except jujuclient.EnvError as e: msg = "JujuClient: Invalid account credentials: %s", str(e.message) self._log.error(msg) raise Exception(msg) except ConnectionRefusedError as e: msg = "JujuClient: Wrong IP or Port: %s", str(e) self._log.error(msg) raise Exception(msg) except Exception as e: msg = "JujuClient: Connection Failed: %s", str(e) self._log.error(msg) raise Exception(msg) else: status.status = "success" status.details = "Connection was successful" self._log.info("JujuClient: Connection Successful") self.env.close() return status