Esempio n. 1
0
 def use_verifier(self, api, verifier_id):
     """Choose a verifier to use for the future operations."""
     verifier = api.verifier.get(verifier_id=verifier_id)
     envutils.update_globals_file(envutils.ENV_VERIFIER, verifier["uuid"])
     print("Using verifier '%s' (UUID=%s) as the default verifier "
           "for the future CLI operations." %
           (verifier["name"], verifier["uuid"]))
Esempio n. 2
0
    def use(self, api, deployment):
        """Set active deployment."""
        # TODO(astudenov): make this method platform independent
        try:
            if not isinstance(deployment, dict):
                deployment = api.deployment.get(deployment=deployment)
        except exceptions.DBRecordNotFound:
            print("Deployment %s is not found." % deployment)
            return 1
        print("Using deployment: %s" % deployment["uuid"])

        envutils.update_globals_file(envutils.ENV_DEPLOYMENT,
                                     deployment["uuid"])
        envutils.update_globals_file(envutils.ENV_ENV,
                                     deployment["uuid"])

        if "openstack" in deployment["credentials"]:
            creds = deployment["credentials"]["openstack"][0]
            self._update_openrc_deployment_file(
                deployment["uuid"], creds["admin"] or creds["users"][0])
            print("~/.rally/openrc was updated\n\nHINTS:\n"
                  "\n* To use standard OpenStack clients, set up your env by "
                  "running:\n\tsource ~/.rally/openrc\n"
                  "  OpenStack clients are now configured, e.g run:\n\t"
                  "openstack image list")
Esempio n. 3
0
    def use(self, api, verification_uuid):
        """Choose a verification to use for the future operations."""

        verification = api.verification.get(
            verification_uuid=verification_uuid)
        envutils.update_globals_file(envutils.ENV_VERIFICATION,
                                     verification["uuid"])
        print("Using verification (UUID=%s) as the default verification "
              "for the future operations." % verification["uuid"])
Esempio n. 4
0
    def use(self, api, task_id):
        """Set active task."""

        print("Using task: %s" % task_id)
        api.task.get(task_id=task_id)
        envutils.update_globals_file("RALLY_TASK", task_id)
Esempio n. 5
0
 def _use(self, env_uuid, to_json):
     _print("Using environment: %s" % env_uuid, to_json)
     envutils.update_globals_file(envutils.ENV_ENV, env_uuid)