def handle(self, *args, **options): if len(args) < 2: raise CommandError('usage: <repo name> <branch>') self.logger = logging.getLogger('download') br = Branch.objects.get(repo__name__exact=args[0], name__exact=args[1]) if not br: raise CommandException("invalid repo/branch") downloadOnly = False if len(args) > 2 and args[2] == '--download-only': downloadOnly = True agent = Utils.getAgentForBranch(br, logger=self.logger) path = br.api_store types = [aType.strip() for aType in br.api_assets.split(',')] stamp = str(int(time.time())) filename = os.path.join(path, 'retrieve_{0}.zip'.format(stamp)) self.logger.info('fetching audit data..') chgmap = agent.retrieve_changesaudit(types, br.api_pod) self.logger.info('retrieving from %s:%s for %s' % (br.repo.name, br.name, br.api_assets)) agent.retrieve_meta(types, br.api_pod, filename) agent.close() self.logger.info('finished download') if not downloadOnly: from admin.management.checkin import perform_checkin, save_objectchanges perform_checkin(br.repo.location, filename, br) batch_time = datetime.datetime.now() self.logger.debug('saving audit...') save_objectchanges(br, batch_time, chgmap) os.remove(filename)
def handle(self, *args, **options): if len(args) < 2: raise CommandError('usage: runtests <repo alias> <branch>') repo = Repo.objects.get(name__exact=args[0]) self.branch = Branch.objects.get(repo=repo, name__exact=args[1]) self.agent = Utils.getAgentForBranch(self.branch) self.rest_headers = {"Authorization": "OAuth %s" % self.agent.getSessionId(), "Content-Type": "application/json" } serverloc = self.branch.api_pod + '.salesforce.com' self.rest_conn = httplib.HTTPSConnection(serverloc) self.startTests() self.monitorTests() self.rest_conn.close()
def deploy(self, objectList, from_branch, to_branch): for object in objectList: print object.status, object.filename, object.type, object.el_name, object.el_subtype output_name = generatePackage(objectList, from_branch, to_branch) agent = Utils.getAgentForBranch(to_branch); agent.deploy(output_name)
def deploy(self, objectList, from_branch, to_branch): for object in objectList: print object.status, object.filename, object.type, object.el_name, object.el_subtype output_name = generatePackage(objectList, from_branch, to_branch) agent = Utils.getAgentForBranch(to_branch) agent.deploy(output_name)