How to use the cumulusci.core.config.ScratchOrgConfig function in cumulusci

To help you get started, we’ve selected a few cumulusci examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SFDO-Tooling / CumulusCI / cumulusci / cli / cci.py View on Github external
def org_import(config, username_or_alias, org_name):
    org_config = {"username": username_or_alias}
    scratch_org_config = ScratchOrgConfig(org_config, org_name)
    scratch_org_config.config["created"] = True

    info = scratch_org_config.scratch_info
    scratch_org_config.config["days"] = calculate_org_days(info)
    scratch_org_config.config["date_created"] = parse_api_datetime(info["created_date"])

    config.keychain.set_org(scratch_org_config)
    click.echo(
        "Imported scratch org: {org_id}, username: {username}".format(
            **scratch_org_config.scratch_info
        )
github SFDO-Tooling / MetaCI / metaci / cumulusci / keychain.py View on Github external
def set_org(self, org_config):
        org_json = json.dumps(org_config.config, cls=DjangoJSONEncoder)
        try:
            org = Org.objects.get(repo=self.build.repo, name=org_config.name)
            org.json = org_json
        except Org.DoesNotExist:
            org = Org(name=org_config.name, json=org_json, repo=self.build.repo)

        org.scratch = isinstance(org_config, ScratchOrgConfig)
        if not org.scratch:
            org.save()
github SFDO-Tooling / CumulusCI / cumulusci / core / keychain / BaseProjectKeychain.py View on Github external
self.project_config, "orgs__scratch__{}".format(config_name)
        )
        if days is not None:
            # Allow override of scratch config's default days
            scratch_config["days"] = days
        else:
            # Use scratch config days or default of 1 day
            scratch_config.setdefault("days", 1)
        scratch_config["set_password"] = bool(set_password)
        scratch_config["scratch"] = True
        scratch_config.setdefault("namespaced", False)
        scratch_config["config_name"] = config_name
        scratch_config["sfdx_alias"] = "{}__{}".format(
            self.project_config.project__name, org_name
        )
        org_config = ScratchOrgConfig(scratch_config, org_name)
        self.set_org(org_config)
github SFDO-Tooling / CumulusCI / cumulusci / core / keychain / EnvironmentProjectKeychain.py View on Github external
def _load_orgs(self):
        for key, value in self._get_env():
            if key.startswith(self.org_var_prefix):
                org_config = json.loads(value)
                org_name = key[len(self.org_var_prefix) :].lower()
                if org_config.get("scratch"):
                    self.orgs[org_name] = ScratchOrgConfig(json.loads(value), org_name)
                else:
                    self.orgs[org_name] = OrgConfig(json.loads(value), org_name)
github SFDO-Tooling / MetaCI / metaci / cumulusci / models.py View on Github external
def _get_org_config(self):
        org_config = json.loads(self.json)
        org_config["date_created"] = parse_datetime(org_config["date_created"])
        return ScratchOrgConfig(org_config, self.org.name)
github SFDO-Tooling / CumulusCI / cumulusci / tasks / sfdx.py View on Github external
def _get_env(self):
        env = super(SFDXOrgTask, self)._get_env()
        if not isinstance(self.org_config, ScratchOrgConfig):
            # For non-scratch keychain orgs, pass the access token via env var
            env["SFDX_INSTANCE_URL"] = self.org_config.instance_url
            env["SFDX_USERNAME"] = self.org_config.access_token
        return env
github SFDO-Tooling / CumulusCI / cumulusci / core / keychain / BaseEncryptedProjectKeychain.py View on Github external
def _construct_config(self, config_class, args):
        if args[0].get("scratch"):
            config_class = ScratchOrgConfig

        return config_class(*args)