示例#1
0
def org_connect(config, org_name, sandbox, login_url, default, global_org):
    config.check_org_overwrite(org_name)

    try:
        connected_app = config.keychain.get_service("connected_app")
    except ServiceNotConfigured as e:
        raise ServiceNotConfigured(
            "Connected App is required but not configured. " +
            "Configure the Connected App service:\n" +
            "http://cumulusci.readthedocs.io/en/latest/" +
            "tutorial.html#configuring-the-project-s-connected-app")
    if sandbox:
        login_url = "https://test.salesforce.com"

    oauth_capture = CaptureSalesforceOAuth(
        client_id=connected_app.client_id,
        client_secret=connected_app.client_secret,
        callback_url=connected_app.callback_url,
        auth_site=login_url,
        scope="web full refresh_token",
    )
    oauth_dict = oauth_capture()
    org_config = OrgConfig(oauth_dict, org_name)
    org_config.load_userinfo()

    config.keychain.set_org(org_config, global_org)

    if default:
        org = config.keychain.set_default_org(org_name)
        click.echo("{} is now the default org".format(org_name))
示例#2
0
 def _raise_service_not_configured(self, name):
     raise ServiceNotConfigured(
         'Service configuration could not be found.  Expected to find encrypted file at {}/{}.org'.format(
             self.project_local_dir, 
             name
         )
     )
示例#3
0
 def get_service(self, service_name):
     try:
         service = Service.objects.get(name=service_name)
         service_config = json.loads(service.json)
         return ServiceConfig(service_config)
     except Service.DoesNotExist:
         raise ServiceNotConfigured(service_name)
示例#4
0
 def _raise_service_not_configured(self, name):
     services = ", ".join(list(self.services))
     raise ServiceNotConfigured(
         f"Service named {name} is not configured for this project. Configured services are: {services}"
     )
示例#5
0
 def _raise_service_not_configured(self, name):
     raise ServiceNotConfigured(
         'Service named {} is not configured for this project. Configured services are: {}'
         .format(name, ', '.join(list(self.services))))
示例#6
0
 def _raise_service_not_configured(self, name):
     raise ServiceNotConfigured(
         'Service named {} is not configured for this project'.format(name)
     )
 def _raise_service_not_configured(self, name):
     raise ServiceNotConfigured(
         "'{}' service configuration could not be found. "
         "Maybe you need to run: cci service connect {}".format(name, name))
 def _raise_service_not_configured(self, name):
     raise ServiceNotConfigured(
         f"'{name}' service configuration could not be found. "
         f"Maybe you need to run: cci service connect {name}")