Beispiel #1
0
    def run(self):
        try:
            if 'password' not in self.destination:
                self.destination['password'] = util.get_password_by_key(
                    self.destination['id'])
            deploy_client = MavensMateClient(
                credentials={
                    "username": self.destination['username'],
                    "password": self.destination['password'],
                    "org_type": self.destination['org_type']
                })

            # Check testRequired to find out if this is a production org.
            # This is a bit of a misnomer as runAllTests=True will run managed package tests, other
            # tests are *always* run so we should honor the UI, however Production orgs do require
            # rollbackOnError=True so we should override it here
            describe_result = deploy_client.describeMetadata(retXml=False)
            if describe_result.testRequired == True:
                self.params['rollback_on_error'] = True

            self.params['zip_file'] = self.deploy_metadata.zipFile
            deploy_result = deploy_client.deploy(self.params)
            deploy_result['username'] = self.destination['username']
            debug('>>>>>> DEPLOY RESULT >>>>>>')
            debug(deploy_result)
            self.result = deploy_result
        except BaseException, e:
            result = util.generate_error_response(e.message, False)
            result['username'] = self.destination['username']
            self.result = result
Beispiel #2
0
Datei: misc.py Projekt: azam/mm
    def execute(self):
        if 'username' not in self.params or self.params['username'] == None or self.params['username'] == '':
            raise MMException('Please enter a Salesforce.com username')
        if 'password' not in self.params or self.params['password'] == None or self.params['password'] == '':
            raise MMException('Please enter a Salesforce.com password')
        if 'org_type' not in self.params or self.params['org_type'] == None or self.params['org_type'] == '':
            raise MMException('Please select an org type')
        if 'org_type' in self.params and self.params['org_type'] == "custom" and "org_url" not in self.params:
            raise MMException('To use a custom org type, please include a org_url parameter') 
        if 'org_type' in self.params and self.params['org_type'] == "custom" and "org_url" in self.params and self.params["org_url"] == "":
            raise MMException('Please specify the org url')    

        client = MavensMateClient(credentials={
            "username" : self.params['username'],
            "password" : self.params['password'],
            "org_type" : self.params['org_type'],
            "org_url"  : self.params.get('org_url', None)
        }) 
        
        response = {
            "sid"                   : client.sid,
            "user_id"               : client.user_id,
            "metadata_server_url"   : client.metadata_server_url,
            "server_url"            : client.server_url,
            "metadata"              : client.get_org_metadata(subscription=self.params.get('subscription', None)),
            "success"               : True
        }
        return util.generate_response(response)
Beispiel #3
0
Datei: deploy.py Projekt: azam/mm
    def run(self):
        try:
            if 'password' not in self.destination:
                self.destination['password'] = util.get_password_by_key(self.destination['id'])
            deploy_client = MavensMateClient(credentials={
                "username":self.destination['username'],
                "password":self.destination['password'],
                "org_type":self.destination['org_type']
            })    

            # Check testRequired to find out if this is a production org.
            # This is a bit of a misnomer as runAllTests=True will run managed package tests, other 
            # tests are *always* run so we should honor the UI, however Production orgs do require 
            # rollbackOnError=True so we should override it here
            describe_result = deploy_client.describeMetadata(retXml=False)
            if describe_result.testRequired == True:
                self.params['rollback_on_error'] = True

            self.params['zip_file'] = self.deploy_metadata.zipFile      
            deploy_result = deploy_client.deploy(self.params)
            deploy_result['username'] = self.destination['username']
            debug('>>>>>> DEPLOY RESULT >>>>>>')
            debug(deploy_result)
            self.result = deploy_result
        except BaseException, e:
            result = util.generate_error_response(e.message, False)
            result['username'] = self.destination['username']
            self.result = result
Beispiel #4
0
    def execute(self):
        if 'username' not in self.params or self.params['username'] == None or self.params['username'] == '':
            raise MMException('Please enter a Salesforce.com username')
        if 'password' not in self.params or self.params['password'] == None or self.params['password'] == '':
            raise MMException('Please enter a Salesforce.com password')
        if 'org_type' not in self.params or self.params['org_type'] == None or self.params['org_type'] == '':
            raise MMException('Please select an org type')
        if 'org_type' in self.params and self.params['org_type'] == "custom" and "org_url" not in self.params:
            raise MMException('To use a custom org type, please include a org_url parameter') 
        if 'org_type' in self.params and self.params['org_type'] == "custom" and "org_url" in self.params and self.params["org_url"] == "":
            raise MMException('Please specify the org url')    

        config.logger.debug('=================>')
        config.logger.debug(self.params)

        client = MavensMateClient(credentials={
            "username" : self.params['username'],
            "password" : self.params['password'],
            "org_type" : self.params['org_type'],
            "org_url"  : self.params.get('org_url', None)
        }) 
        
        response = {
            "sid"                   : client.sid,
            "user_id"               : client.user_id,
            "metadata_server_url"   : client.metadata_server_url,
            "server_url"            : client.server_url,
            "metadata"              : client.get_org_metadata(subscription=self.params.get('subscription', None)),
            "org_metadata_types"    : util.metadata_types(),
            "success"               : True
        }
        return util.generate_response(response)
Beispiel #5
0
 def execute(self):
     if 'sid' in self.params:
         client = MavensMateClient(credentials={
             "sid"                   : self.params.get('sid', None),
             "metadata_server_url"   : urllib.unquote(self.params.get('metadata_server_url', None)),
             "server_url"            : urllib.unquote(self.params.get('server_url', None)),
         }) 
     elif 'username' in self.params:
         client = MavensMateClient(credentials={
             "username"              : self.params.get('username', None),
             "password"              : self.params.get('password', None),
             "org_type"              : self.params.get('org_type', None),
             "org_url"               : self.params.get('org_url', None)
         })
     return json.dumps(client.list_metadata(self.params['metadata_type']))
Beispiel #6
0
 def execute(self):
     if 'sid' in self.params:
         client = MavensMateClient(credentials={
             "sid"                   : self.params.get('sid', None),
             "metadata_server_url"   : urllib.unquote(self.params.get('metadata_server_url', None)),
             "server_url"            : urllib.unquote(self.params.get('server_url', None)),
         }) 
     elif 'username' in self.params:
         client = MavensMateClient(credentials={
             "username"              : self.params.get('username', None),
             "password"              : self.params.get('password', None),
             "org_type"              : self.params.get('org_type', None),
             "org_url"               : self.params.get('org_url', None)
         })
     return json.dumps(client.list_metadata(self.params['metadata_type']))
Beispiel #7
0
    def run(self):
        try:
            if 'password' not in self.destination:
                self.destination['password'] = util.get_password_by_key(self.destination['id'])
            deploy_client = MavensMateClient(credentials={
                "username":self.destination['username'],
                "password":self.destination['password'],
                "org_type":self.destination['org_type']
            })    

            retrieve_result = deploy_client.retrieve(package=self.package)
            retrieve_result['username'] = self.destination['username']
            debug('>>>>>> RETRIEVE RESULT >>>>>>')
            debug(retrieve_result)
            self.result = retrieve_result
        except BaseException, e:
            result = util.generate_error_response(e.message, False)
            result['username'] = self.destination['username']
            self.result = result
Beispiel #8
0
    def run(self):
        try:
            if 'password' not in self.destination:
                self.destination['password'] = util.get_password_by_key(
                    self.destination['id'])
            deploy_client = MavensMateClient(
                credentials={
                    "username": self.destination['username'],
                    "password": self.destination['password'],
                    "org_type": self.destination['org_type']
                })

            retrieve_result = deploy_client.retrieve(package=self.package)
            retrieve_result['username'] = self.destination['username']
            debug('>>>>>> RETRIEVE RESULT >>>>>>')
            debug(retrieve_result)
            self.result = retrieve_result
        except BaseException, e:
            result = util.generate_error_response(e.message, False)
            result['username'] = self.destination['username']
            self.result = result
Beispiel #9
0
 def execute(self):
     c = MavensMateClient(
         credentials={
             "username": self.params['username'],
             "password": self.params['password'],
             "org_type": self.params['org_type']
         })
     org_connection_id = util.new_mavensmate_id()
     util.put_password_by_key(org_connection_id, self.params['password'])
     org_connections = GetOrgConnectionsCommand(
         params=self.params).execute()
     org_connections.append({
         'id': org_connection_id,
         'username': self.params['username'],
         'environment': self.params['org_type']
     })
     src = open(
         os.path.join(config.project.location, "config",
                      ".org_connections"), 'wb')
     json_data = json.dumps(org_connections, sort_keys=False, indent=4)
     src.write(json_data)
     src.close()
     return util.generate_success_response(
         'Org Connection Successfully Created')