- # Check to see if datacenter is valid
- if self._dc:
- dc_url = "{url}/datacenters". format(url=self._oper_url)
- output = self._exec_cmd(dc_url)
- if (output is None) or (len(output) == 0):
- # Account not found
- raise OnboardPkgDcError("Datacenter {} provided is not valid".
- format(self._dc))
- found = False
- js = json.loads(output)
- if "ro-accounts" in js["rw-launchpad:datacenters"]:
- for ro in js["rw-launchpad:datacenters"]["ro-accounts"]:
- if "datacenters" in ro:
- for dc in ro["datacenters"]:
- if dc["uuid"] == self._dc:
- self.log.debug("Found datacenter {}".format(dc))
- found = True
- break
- if found:
- break
-
- if found is False:
- raise OnboardPkgDcError("Datacenter {} provided is not valid".
- format(self._dc))
-
-
- # Check cloud account is valid, if provided
- if self._account:
- acct_url = "{url}/cloud/account/{acct}". \
- format(url=self._conf_url, acct=self._account)
- output = self._exec_cmd(acct_url)
- if (output is None) or (len(output) == 0):
- # Account not found
- raise OnboardPkgAcctError("VIM/Cloud account {} provided is not valid".
- format(self._account))
-