def run(self):
     if not self.args:
         self.usage('no git directory args given')
     self.origin = self.get_opt('origin')
     args = uniq_list_ordered(self.args)
     self.branch_prefix = self.get_opt('branch_prefix')
     if self.branch_prefix is not None:
         validate_regex(self.branch_prefix, 'branch prefix')
         self.branch_prefix = re.compile(self.branch_prefix)
     for arg in args:
         if not os.path.exists(arg):
             print("'%s' not found" % arg)
             sys.exit(ERRORS['WARNING'])
         if os.path.isfile(arg):
             log_option('file', arg)
         elif os.path.isdir(arg):
             log_option('directory', arg)
         else:
             die("path '%s' could not be determined as either a file or directory" % arg)
     for arg in args:
         self.check_git_branches_upstream(arg)
     if self.status == "OK":
         log.info('SUCCESS - All Git branches are tracking the expected upstream origin branches')
     else:
         log.critical('FAILED')
         sys.exit(ERRORS['CRITICAL'])
 def run(self):
     if not self.args:
         self.usage('no git directory args given')
     self.origin = self.get_opt('origin')
     args = uniq_list_ordered(self.args)
     self.branch_prefix = self.get_opt('branch_prefix')
     if self.branch_prefix is not None:
         validate_regex(self.branch_prefix, 'branch prefix')
         self.branch_prefix = re.compile(self.branch_prefix)
     for arg in args:
         if not os.path.exists(arg):
             print("'%s' not found" % arg)
             sys.exit(ERRORS['WARNING'])
         if os.path.isfile(arg):
             log_option('file', arg)
         elif os.path.isdir(arg):
             log_option('directory', arg)
         else:
             die("path '%s' could not be determined as either a file or directory"
                 % arg)
     for arg in args:
         self.check_git_branches_upstream(arg)
     if self.status == "OK":
         log.info(
             'SUCCESS - All Git branches are tracking the expected upstream origin branches'
         )
     else:
         log.critical('FAILED')
         sys.exit(ERRORS['CRITICAL'])
示例#3
0
 def save(self, name, path, data): # pylint: disable=no-self-use
     # log.debug('save(%s, %s)' % (name, data))
     if data is None:
         err = "blueprint '%s' returned None" % name
         log.critical(err)
         qquit('CRITICAL', err)
     # blueprint_file = os.path.basename(name).lower().rstrip('.json') + '.json'
     # if not os.pathsep not in blueprint_file:
     #     blueprint_file = os.path.normpath(os.path.join(self.blueprint_dir, blueprint_file))
     if os.path.splitext(path)[1] != '.json':
         path += '.json'
     try:
         log.info("writing blueprint '%s' to file '%s'" % (name, path))
         _ = open(path, 'w')
         _.write(data)
         _.close()
         print("Saved blueprint '%s' to file '%s'" % (name, path))
     except IOError as _:
         qquit('CRITICAL', "failed to write blueprint file to '%s': %s" % (path, _))
示例#4
0
 def save(self, name, path, data): # pylint: disable=no-self-use
     # log.debug('save(%s, %s)' % (name, data))
     if data is None:
         err = "blueprint '%s' returned None" % name
         log.critical(err)
         qquit('CRITICAL', err)
     # blueprint_file = os.path.basename(name).lower().rstrip('.json') + '.json'
     # if not os.pathsep not in blueprint_file:
     #     blueprint_file = os.path.normpath(os.path.join(self.blueprint_dir, blueprint_file))
     if os.path.splitext(path)[1] != '.json':
         path += '.json'
     try:
         log.info("writing blueprint '%s' to file '%s'" % (name, path))
         _ = open(path, 'w')
         _.write(data)
         _.close()
         print("Saved blueprint '%s' to file '%s'" % (name, path))
     except IOError as _:
         qquit('CRITICAL', "failed to write blueprint file to '%s': %s" % (path, _))