def postoptparse(self): level = None if (self.options.debug): level = logging.DEBUG elif (self.options.verbose): level = logging.INFO logging.basicConfig(level=level, format='[%(levelname).1s] %(message)s') self.logger = logging.getLogger(self.optparser.prog) conf.get_config(override_apiurl = self.options.apiurl) if (self.options.osc_debug): conf.config['debug'] = 1 self.checker = self.setup_checker() if self.options.config: self.checker.load_config(self.options.config) if self.options.review_mode: self.checker.review_mode = self.options.review_mode if self.options.fallback_user: self.checker.fallback_user = self.options.fallback_user if self.options.fallback_group: self.checker.fallback_group = self.options.fallback_group
def postoptparse(self): level = None if (self.options.debug): level = logging.DEBUG elif (self.options.verbose): level = logging.INFO logging.basicConfig(level=level, format='[%(levelname).1s] %(message)s') self.logger = logging.getLogger(self.optparser.prog) conf.get_config(override_apiurl=self.options.apiurl) if (self.options.osc_debug): conf.config['debug'] = 1 self.checker = self.setup_checker() if self.options.config: self.checker.load_config(self.options.config) if self.options.review_mode: self.checker.review_mode = self.options.review_mode if self.options.fallback_user: self.checker.fallback_user = self.options.fallback_user if self.options.fallback_group: self.checker.fallback_group = self.options.fallback_group sentry_sdk = sentry_init( conf.config['apiurl'], { 'review_bot': self.clazz.__name__, 'review_user': self.checker.review_user, })
def __init__(self, apiurl=None): QtCore.QObject.__init__(self) conf.get_config() if apiurl: self.apiurl = apiurl else: self.apiurl = conf.config['apiurl']
def oscParse(self): # Otherwise, will stick to first user for a given apiurl. conf._build_opener.last_opener = (None, None) # Otherwise, will not re-parse same config file. if 'cp' in conf.get_configParser.__dict__: del conf.get_configParser.cp conf.get_config(override_conffile=OSCRC, override_no_keyring=True, override_no_gnome_keyring=True)
def main(args): conf.get_config() # Allow sentry DSN to be available. sentry_sdk = sentry_init() RequestHandler.apiurl = args.apiurl RequestHandler.session = args.session RequestHandler.debug = args.debug with ThreadedHTTPServer((args.host, args.port), RequestHandler) as httpd: print('listening on {}:{}'.format(args.host, args.port)) httpd.serve_forever()
def __init__(self, apiurl=None, oscrc=None): if oscrc: try: conf.get_config(override_conffile = oscrc) except OSError, e: if e.errno == 1: # permission problem, should be the chmod(0600) issue raise RuntimeError, 'Current user has no write permission for specified oscrc: %s' % oscrc raise # else
def __init__(self, apiurl=None, oscrc=None): if oscrc: try: conf.get_config(override_conffile = oscrc) except OSError, err: if err.errno == 1: # permission problem, should be the chmod(0600) issue raise ObsError('Current user has no write permission '\ 'for specified oscrc: %s' % oscrc) raise # else except urllib2.URLError: raise ObsError("invalid service apiurl: %s" % apiurl)
def __init__(self, apiurl=None, oscrc=None): if oscrc: try: conf.get_config(override_conffile=oscrc) except OSError, err: if err.errno == 1: # permission problem, should be the chmod(0600) issue raise ObsError('Current user has no write permission '\ 'for specified oscrc: %s' % oscrc) raise # else except urllib2.URLError: raise ObsError("invalid service apiurl: %s" % apiurl)
def __init__(self, file='', use_opensuse=False): """ Arguments: file -- configuration file to use """ self.filename = file self.use_opensuse = use_opensuse self.apiurl = None self.hermes_baseurl = '' self.hermes_feeds = '' self._hermes_feeds_helper = [] self.cache_dir = os.path.realpath('cache') self.ignore_conf_mtime = False self.no_full_check = False self.allow_project_catchup = False self.threads = 10 self.sockettimeout = 30 self.threads_sockettimeout = 30 self.debug = False self.mirror_only_new = False self.force_hermes = False self.force_upstream = False self.force_db = False self.force_xml = False self.skip_hermes = False self.skip_mirror = False self.skip_upstream = False self.skip_db = False self.skip_xml = False self.projects = {} if use_opensuse: self._parse_opensuse() self._parse() # Workaround to remove warning coming from osc.conf when we don't use # SSL checks buffer = StringIO.StringIO() oldstderr = sys.stderr sys.stderr = buffer try: oscconf.get_config(override_apiurl=self.apiurl) except oscerr.NoConfigfile, e: sys.stderr = oldstderr buffer.close() raise ConfigException(e)
def __init__(self, file = '', use_opensuse = False): """ Arguments: file -- configuration file to use """ self.filename = file self.use_opensuse = use_opensuse self.apiurl = None self.hermes_baseurl = '' self.hermes_feeds = '' self._hermes_feeds_helper = [] self.cache_dir = os.path.realpath('cache') self.ignore_conf_mtime = False self.no_full_check = False self.allow_project_catchup = False self.threads = 10 self.sockettimeout = 30 self.threads_sockettimeout = 30 self.debug = False self.mirror_only_new = False self.force_hermes = False self.force_upstream = False self.force_db = False self.force_xml = False self.skip_hermes = False self.skip_mirror = False self.skip_upstream = False self.skip_db = False self.skip_xml = False self.projects = {} if use_opensuse: self._parse_opensuse() self._parse() # Workaround to remove warning coming from osc.conf when we don't use # SSL checks buffer = StringIO.StringIO() oldstderr = sys.stderr sys.stderr = buffer try: oscconf.get_config(override_apiurl = self.apiurl) except oscerr.NoConfigfile, e: sys.stderr = oldstderr buffer.close() raise ConfigException(e)
def __init__(self, myFactory, myParent, myConfigDict): """Transfer from/to obs @param myFactory: widgetFactory to use @type myFactory: Instance of widgetFactory @param myParent: parent widget @type myParent: Instance of YDialog @param myConfigDict: configDict @type myConfigDict: Dictionary """ self.factory = myFactory if myParent: self.myParent = myParent else: self.myParent = None self.errormsg = None self.configDict = myConfigDict.copy() self.error = False self.apiobject = None self.apiuser = None self.apipass = None self.oscconf = conf.get_config() self.project = "" self.prjname = "imaging:foo" self.pkgname = "imaging" self.reponame = "image" self.architecture = "i586" self.outputDir = os.path.join(self.configDict['output_dir']) self.bsDir = os.path.join(str(self.outputDir)+str("/upload"))
if __name__ == '__main__': if len(sys.argv) != 4: print "Call this script with <project> <repository> <architecture> arguments.\n" print "To mirror openSUSE 10.2 as base distro, please call:\n\n" print " obs_mirror_project.py openSUSE:10.2 standard i586 \n" sys.exit(1) project = sys.argv[1] repository = sys.argv[2] architecture = sys.argv[3] destinationdir = "%s/build/%s/%s/%s/:full/" % (rootdir, project, repository, architecture) downloadurl = "%s/%s/%s" % (downloadmirror, project, repository) # Initialise osc lib conf.get_config() conf.config['apiurl'] = conf.config['scheme'] + '://' + conf.config['apisrv'] conf.config['user'] = conf.config['auth_dict'][conf.config['apisrv']]['user'] conf.init_basicauth(conf.config) # Create target directories for d in (destinationdir, projectdir): if not os.path.isdir(d): print "Creating %s" % d os.makedirs(d, 0755) os.chown(d, owneruid, -1) # # Copy project metadata from upstream server # print "Updating project metadata" # f = open("%s/%s.xml" % (projectdir, project), 'w')
class BuildService(): "Interface to Build Service API" def __init__(self, apiurl=None, oscrc=None): if oscrc: try: conf.get_config(override_conffile = oscrc) except OSError, e: if e.errno == 1: # permission problem, should be the chmod(0600) issue raise RuntimeError, 'Current user has no write permission for specified oscrc: %s' % oscrc raise # else else: conf.get_config() if apiurl: self.apiurl = apiurl else: self.apiurl = conf.config['apiurl'] def getAPIServerList(self): """getAPIServerList() -> list Get list of API servers configured in .oscrc """ apiservers = [] for host in conf.config['api_host_options'].keys(): apiurl = "%s://%s" % (conf.config['scheme'], host) return apiservers
def __init__(self, file='', use_opensuse=False): """ Arguments: file -- configuration file to use """ self.filename = file self.use_opensuse = use_opensuse self.apiurl = None self.hermes_baseurl = '' self.hermes_feeds = '' self._hermes_feeds_helper = [] self.cache_dir = os.path.realpath('cache') self.ignore_conf_mtime = False self.no_full_check = False self.allow_project_catchup = False self.threads = 10 self.sockettimeout = 30 self.threads_sockettimeout = 30 self.debug = False self.mirror_only_new = False self.force_hermes = False self.force_upstream = False self.force_db = False self.force_xml = False self.skip_hermes = False self.skip_mirror = False self.skip_upstream = False self.skip_db = False self.skip_xml = False self.projects = {} if use_opensuse: self._parse_opensuse() self._parse() # Workaround to remove warning coming from osc.conf when we don't use # SSL checks buffer = StringIO.StringIO() oldstderr = sys.stderr sys.stderr = buffer try: oscconf.get_config(override_apiurl=self.apiurl) except oscerr.NoConfigfile as e: sys.stderr = oldstderr buffer.close() raise ConfigException(e) except Exception as e: sys.stderr = oldstderr buffer.close() raise e # Workaround to remove warning coming from osc.conf when we don't use # SSL checks sys.stderr = oldstderr self._copy_stderr_without_ssl(buffer) buffer.close() # Make sure apiurl points to the right value self.apiurl = oscconf.config['apiurl'] # M2Crypto and socket timeout are not friends. See # https://bugzilla.osafoundation.org/show_bug.cgi?id=2341 if ('sslcertck' in oscconf.config['api_host_options'][self.apiurl] and oscconf.config['api_host_options'][self.apiurl]['sslcertck']): self.sockettimeout = 0 # obviously has to be done after self.sockettimeout has been set to its # final value if self.threads_sockettimeout <= 0: self.threads_sockettimeout = self.sockettimeout
def main(args): conf.get_config(override_apiurl=args.apiurl) conf.config['debug'] = args.debug apiurl = conf.config['apiurl'] return not status(apiurl)
def main(args): conf.get_config(override_apiurl=args.apiurl) conf.config['debug'] = args.debug apiurl = conf.config['apiurl'] return not unmaintained(apiurl, args.project_target)