rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
repodata = {'id' : 'test-f12', 'name' : 'f12', 'arch' : 'i386', 'feed' : 'yum:http://mmccune.fedorapeople.org/pulp/'} repo = rconn.create(repodata)
repo = rconn.create('test-f12', 'f12','i386', 'yum:http://mmccune.fedorapeople.org/pulp/')
def clean(self): pass
consumerdata = { 'id' : "1", 'description' : 'prad.rdu.redhat.com', }
def clean(self): pass
print "Create Consumer", cconn.create(consumerdata)
print "Create Consumer", cconn.create("test", 'prad.rdu.redhat.com')
def clean(self): pass
packages = API.packages(id).avlues()
packages = API.packages(id).values()
def packages(self, id): """ Get a consumer's set of packages @param id: consumer id @return: consumer's installed packages """ valid_filters = ('name', 'arch') filters = self.filters(valid_filters) packages = API.packages(id).avlues() filtered_packages = self.filter_results(packages, filters, valid_filters) return self...
os.mkdir(self.published_path)
os.makedirs(self.published_path)
def _create_published_link(self, repo): if not os.path.isdir(self.published_path): os.mkdir(self.published_path) source_path = os.path.join(pulp.server.util.top_repos_location(), repo["relative_path"]) link_path = os.path.join(self.published_path, repo["relative_path"]) pulp.server.util.create_symlinks(source_path, lin...
if not self.options.userlogin: print("userlogin required. Try --help")
if not self.options.newusername: print("newusername required. Try --help")
def _create(self): if not self.options.userlogin: print("userlogin required. Try --help") sys.exit(0) if not self.options.name: self.options.name = "" if not self.options.userpassword: self.options.userpassword = "" try: user = self.userconn.create(self.options.newusername, self.options.newpassword, self.options.name) ...
if not self.options.userpassword: self.options.userpassword = ""
if not self.options.newpassword: self.options.newpassword = ""
def _create(self): if not self.options.userlogin: print("userlogin required. Try --help") sys.exit(0) if not self.options.name: self.options.name = "" if not self.options.userpassword: self.options.userpassword = "" try: user = self.userconn.create(self.options.newusername, self.options.newpassword, self.options.name) ...
columns = ["login", "name"]
def _list(self): try: users = self.userconn.users() columns = ["login", "name"] if not len(users): print _("No users available to list") sys.exit(0) print "+-------------------------------------------+" print " Available Users " print "+-------------------------------------------+" for user ...
pids.append(pinfo) try: if pinfo: self.pconn.remove_package(id, pids) else: print _("Package [%s] is not part of the source repository [%s]" % (pkg, id)) except Exception: raise print _("Unable to remove package [%s] to repo [%s]" % (pkg, id)) print _("Successfully removed package(s) %s to repo [%s]." %(self.opts.pkgna...
try: if pinfo: self.pconn.remove_package(id, [pinfo]) print _("Successfully removed package %s from repo [%s]." %(pkg, id)) else: print _("Package [%s] does not exist in repository [%s]" % (pkg, id)) except Exception: print _("Unable to remove package [%s] to repo [%s]" % (pkg, id))
def run(self): id = self.get_required_option('id') if not self.opts.pkgname: system_exit(os.EX_USAGE, _("Error, atleast one package id is required to perform a delete.")) pids = [] for pkg in self.opts.pkgname: pinfo = self.pconn.get_package_by_filename(id, pkg) pids.append(pinfo) try: if pinfo: self.pconn.remove_packa...
raise print _("Unable to add errata [%s] to repo [%s]" % (errataids, id))
system_exit(os.EX_DATAERR, _("Unable to add errata [%s] to repo [%s]" % (errataids, id)))
def run(self): id = self.get_required_option('id') if not self.opts.errataid: system_exit(os.EX_USAGE, _("Error, atleast one erratum id is required to perform an add.")) if not self.opts.srcrepo: system_exit(os.EX_USAGE, _("Error, a source respository where erratum exists is required")) errataids = self.opts.errataid t...
raise
def run(self): id = self.get_required_option('id') if not self.opts.errataid: system_exit(os.EX_USAGE, _("Error, atleast one erratum id is required to perform a delete.")) errataids = self.opts.errataid try: self.pconn.delete_errata(id, errataids) except Exception: raise print _("Unable to remove errata [%s] to repo [%...
print _(" Failed to Upload %s to Repo [ %s ] " % self.options.id)
print _(" Failed to Upload [%s] to Repo [ %s ] " % (pkginfo['pkgname'], self.options.id))
def _upload(self): (self.options, files) = self.parser.parse_args() # ignore the command and pick the files files = files[2:] if not self.options.id: print("repo id required. Try --help") sys.exit(0) if self.options.dir: files += utils.processDirectory(self.options.dir, "rpm") if not files: print("Need to provide atlea...
for path in self.keyfiles():
for path, content in self.keyfiles():
def relink(self): """ Relink GPG key files. """ linked = [] self.clean() for path in self.keyfiles(): fn = os.path.basename(path) dst = os.path.join(lnkdir(), self.path, fn) self.link(path, dst) entry = os.path.join(self.path, fn) linked.append(entry) return linked
print("repo id required. Try --help")
print _("repo id required. Try --help")
def _create(self): if not self.options.id: print("repo id required. Try --help") sys.exit(0) if not self.options.name: self.options.name = self.options.id if not self.options.arch: self.options.arch = "noarch"
print _(" Successfully created Repo [ %s ]" % repo['id'])
print _(" Successfully created Repo [ %s ]") % repo['id']
def _create(self): if not self.options.id: print("repo id required. Try --help") sys.exit(0) if not self.options.name: self.options.name = self.options.id if not self.options.arch: self.options.arch = "noarch"
print("repo id required. Try --help")
print _("repo id required. Try --help")
def _sync(self): if not self.options.id: print("repo id required. Try --help") sys.exit(0) try: task_object = self.pconn.sync(self.options.id, self.options.timeout) state = "waiting" print "Task created with ID::", task_object['id'] while state not in ["finished", "error", 'timed out', 'canceled']: time.sleep(5) status...
print "Task created with ID::", task_object['id']
print _("Task created with ID::"), task_object['id']
def _sync(self): if not self.options.id: print("repo id required. Try --help") sys.exit(0) try: task_object = self.pconn.sync(self.options.id, self.options.timeout) state = "waiting" print "Task created with ID::", task_object['id'] while state not in ["finished", "error", 'timed out', 'canceled']: time.sleep(5) status...
print "Sync Status::", state
print _("Sync Status::"), state
def _sync(self): if not self.options.id: print("repo id required. Try --help") sys.exit(0) try: task_object = self.pconn.sync(self.options.id, self.options.timeout) state = "waiting" print "Task created with ID::", task_object['id'] while state not in ["finished", "error", 'timed out', 'canceled']: time.sleep(5) status...
print _(" Sync Successful. Repo [ %s ] now has a total of [ %s ] packages" % (self.options.id, pkg_count))
print _(" Sync Successful. Repo [ %s ] now has a total of [ %s ] packages") % \ (self.options.id, pkg_count)
def _sync(self): if not self.options.id: print("repo id required. Try --help") sys.exit(0) try: task_object = self.pconn.sync(self.options.id, self.options.timeout) state = "waiting" print "Task created with ID::", task_object['id'] while state not in ["finished", "error", 'timed out', 'canceled']: time.sleep(5) status...
print("repo id required. Try --help")
print _("repo id required. Try --help")
def _cancel_sync(self): if not self.options.id: print("repo id required. Try --help") sys.exit(0) if not self.options.taskid: print("task id required. Try --help") sys.exit(0) try: repos = self.pconn.cancel_sync(self.options.id, self.options.taskid) print _(" Sync task %s cancelled") % self.options.taskid except Restli...
print("task id required. Try --help")
print _("task id required. Try --help")
def _cancel_sync(self): if not self.options.id: print("repo id required. Try --help") sys.exit(0) if not self.options.taskid: print("task id required. Try --help") sys.exit(0) try: repos = self.pconn.cancel_sync(self.options.id, self.options.taskid) print _(" Sync task %s cancelled") % self.options.taskid except Restli...
print _(" Sync task %s cancelled") % self.options.taskid
print _(" Sync task %s canceled") % self.options.taskid
def _cancel_sync(self): if not self.options.id: print("repo id required. Try --help") sys.exit(0) if not self.options.taskid: print("task id required. Try --help") sys.exit(0) try: repos = self.pconn.cancel_sync(self.options.id, self.options.taskid) print _(" Sync task %s cancelled") % self.options.taskid except Restli...
print("repo id required. Try --help")
print _("repo id required. Try --help")
def _delete(self): if not self.options.id: print("repo id required. Try --help") sys.exit(0) try: self.pconn.delete(id=self.options.id) print _(" Successful deleted Repo [ %s ] " % self.options.id) except RestlibException, re: print _(" Deleted operation failed on Repo [ %s ] " % self.options.id) log.error("Error: %s" ...
print _(" Successful deleted Repo [ %s ] " % self.options.id) except RestlibException, re: print _(" Deleted operation failed on Repo [ %s ] " % self.options.id)
print _(" Successful deleted Repo [ %s ]") % self.options.id except RestlibException, re: print _(" Deleted operation failed on Repo [ %s ]") % self.options.id
def _delete(self): if not self.options.id: print("repo id required. Try --help") sys.exit(0) try: self.pconn.delete(id=self.options.id) print _(" Successful deleted Repo [ %s ] " % self.options.id) except RestlibException, re: print _(" Deleted operation failed on Repo [ %s ] " % self.options.id) log.error("Error: %s" ...
print _(" Deleted operation failed on Repo [ %s ]. " % self.options.id)
print _(" Deleted operation failed on Repo [ %s ].") % self.options.id
def _delete(self): if not self.options.id: print("repo id required. Try --help") sys.exit(0) try: self.pconn.delete(id=self.options.id) print _(" Successful deleted Repo [ %s ] " % self.options.id) except RestlibException, re: print _(" Deleted operation failed on Repo [ %s ] " % self.options.id) log.error("Error: %s" ...
print("repo id required. Try --help")
print _("repo id required. Try --help")
def _upload(self): (self.options, files) = self.parser.parse_args() # ignore the command and pick the files files = files[2:] if not self.options.id: print("repo id required. Try --help") sys.exit(0) if self.options.dir: files += utils.processDirectory(self.options.dir, "rpm") if not files: print("Need to provide atlea...
print("Need to provide atleast one file to perform upload")
print _("Need to provide at least one file to perform upload")
def _upload(self): (self.options, files) = self.parser.parse_args() # ignore the command and pick the files files = files[2:] if not self.options.id: print("repo id required. Try --help") sys.exit(0) if self.options.dir: files += utils.processDirectory(self.options.dir, "rpm") if not files: print("Need to provide atlea...
print('Error: %s' % e)
print _('Error: %s') % e
def _upload(self): (self.options, files) = self.parser.parse_args() # ignore the command and pick the files files = files[2:] if not self.options.id: print("repo id required. Try --help") sys.exit(0) if self.options.dir: files += utils.processDirectory(self.options.dir, "rpm") if not files: print("Need to provide atlea...
print("Package %s is Not an RPM Skipping" % frpm)
print _("Package %s is Not an RPM Skipping") % frpm
def _upload(self): (self.options, files) = self.parser.parse_args() # ignore the command and pick the files files = files[2:] if not self.options.id: print("repo id required. Try --help") sys.exit(0) if self.options.dir: files += utils.processDirectory(self.options.dir, "rpm") if not files: print("Need to provide atlea...
print _(" Successful uploaded [%s] to Repo [ %s ]" % (pkginfo['pkgname'], self.options.id))
print _(" Successful uploaded [%s] to Repo [ %s ]") % \ (pkginfo['pkgname'], self.options.id)
def _upload(self): (self.options, files) = self.parser.parse_args() # ignore the command and pick the files files = files[2:] if not self.options.id: print("repo id required. Try --help") sys.exit(0) if self.options.dir: files += utils.processDirectory(self.options.dir, "rpm") if not files: print("Need to provide atlea...
print _(" Failed to Upload %s to Repo [ %s ]" % self.options.id)
print _(" Failed to Upload %s to Repo [ %s ]") % self.options.id
def _upload(self): (self.options, files) = self.parser.parse_args() # ignore the command and pick the files files = files[2:] if not self.options.id: print("repo id required. Try --help") sys.exit(0) if self.options.dir: files += utils.processDirectory(self.options.dir, "rpm") if not files: print("Need to provide atlea...
@remotemethod
@remote
def bark(self, words): return self.BRKMSG % words
r = agent.dog.bark('pulp rocks!')
r = dog.bark('pulp rocks!')
def testSynchronous(self): results = [] __agent = TestAgent(self.ID) agent = RemoteAgent(self.ID) dog = agent.Dog() r = agent.dog.bark('pulp rocks!') results.append(r) r = dog.wag(self.WAGS) results.append(r) self.validate(results) agent.close()
pattern = '%s/' % self.path
pattern = self.path if not pattern.endswith('/'): pattern += '/'
def delete(self, prev): """ Delete for this repository. Pattern matching used to be sure that only keys stored for this repository are deleted. A cloned repo may have it's parent's keys in the keylist. @param prev: The current list of (relateive paths) keys. @type prev: [str,..] @return: A list of deleted (relateive p...
class InterruptableThread(threading.Thread):
class InterruptableThread(TrackableThread):
def _raise_exception_in_thread(tid, exc_type): """ Raises an exception in the threads with id tid. """ assert inspect.isclass(exc_type) # NOTE this returns the number of threads that it modified, which should # only be 1 or 0 (if the thread id wasn't found) long_tid = ctypes.c_long(tid) exc_ptr = ctypes.py_object(exc_t...
return self.ok(consumer_api.list_package_updates(id))
return self.ok(consumer_api.list_package_updates(id)['packages'])
def package_updates(self, id): """ list applicable package updates for a given consumerid. @type id: str @param id: consumer id """ return self.ok(consumer_api.list_package_updates(id))
method = "/users/%s/" % consumergroup['id']
method = "/users/%s/" % user['id']
def update(self, user): method = "/users/%s/" % consumergroup['id'] return self.conn.request_put(method, params=user)
log.debug('Expected Package Location: %s' % pkg_location)
def sync(self, repo, repo_source, progress_callback=None): pkg_dir = urlparse(repo_source['url']).path.encode('ascii', 'ignore') log.debug("sync of %s for repo %s" % (pkg_dir, repo['id'])) try: repo_dir = "%s/%s" % (repos_location(), repo['id']) if not os.path.exists(pkg_dir): raise InvalidPathError("Path %s is invalid...
pass
self.clean()
def tearDown(self): # self.clean() pass
log.error("Unable to parse comps info for %s" % (compspath))
log.error("Unable to parse comps info for %s" % (compsfile))
def import_groups_data(self, compsfile, repo): """ Reads a comps.xml or comps.xml.gz under repodata from dir Loads PackageGroup and Category info our db """ try: comps = yum.comps.Comps() comps.add(compsfile) for c in comps.categories: ctg = model.PackageGroupCategory(c.categoryid, c.name, c.description, c.display_orde...
self.actions = {"info" : "Register this system as a consumer",
self.actions = {"info" : "lookup information for a package",
def __init__(self): usage = "usage: %prog package [OPTIONS]" shortdesc = "package specific actions to pulp server." desc = ""
self.parser.add_option("-p", "--name", dest="name",
self.parser.add_option("-n", "--name", dest="name",
def generate_options(self): self.action = self._get_action() if self.action == "info": usage = "package info [OPTIONS]" self.setup_option_parser(usage, "", True) self.parser.add_option("-p", "--name", dest="name", help="package name to lookup") self.parser.add_option("--repoid", dest="repoid", help="Repository Label") ...
self.parser.add_option("-p", "--name", action="append", dest="pnames",
self.parser.add_option("-n", "--name", action="append", dest="pnames",
def generate_options(self): self.action = self._get_action() if self.action == "info": usage = "package info [OPTIONS]" self.setup_option_parser(usage, "", True) self.parser.add_option("-p", "--name", dest="name", help="package name to lookup") self.parser.add_option("--repoid", dest="repoid", help="Repository Label") ...
self.parser.add_option("--schedule", dest="schedule",
self.parser.add_option("--schedule", dest="sync_schedule",
def setup_parser(self): super(Update, self).setup_parser() self.parser.add_option("--name", dest="name", help=_("common repository name")) self.parser.add_option("--arch", dest="arch", help=_("package arch the repository should support")) self.parser.add_option("--feed", dest="feed", help=_("url feed to populate the re...
for p in sorted(packages): print ' ' + p
for p in sorted(packages, key=lambda p: p['filename']): print ' ' + p['filename']
def run(self): id = self.get_required_option('id') repo = self.pconn.repository(id) files = repo['files'] packages = self.pconn.packages(id) print_header(_('Contents of %s') % id) print _('files in %s:') % id if not files: print _(' none') else: for f in sorted(repo['files']): print ' ' + f print _('packages in %s:') %...
def GET(self, id, action_name):
def GET(self):
def GET(self, id, action_name): ''' Retrieve a map of all repository IDs to their associated synchronization schedules.
distro = self.dapi.create(id, None, None, []) assert(distro is not None) status = False try: distro = self.dapi.create(id, None, None, []) except DuplicateKeyError: status = True self.assertTrue(status)
distro1 = self.dapi.create(id, None, None, []) assert(distro1 is not None) distro2 = self.dapi.create(id, None, None, []) assert(distro2 is not None) self.assertTrue(distro1 == distro2)
def test_duplicate(self): id = 'test_duplicate_distro' distro = self.dapi.create(id, None, None, []) assert(distro is not None) status = False try: distro = self.dapi.create(id, None, None, []) except DuplicateKeyError: status = True self.assertTrue(status)
if (consumerids.contains(consumer["id"])):
if consumer["id"] in consumerids:
def _add_consumer(self, consumergroup, consumer): """ Responsible for properly associating a Consumer to a ConsumerGroup """ consumerids = consumergroup['consumerids'] if (consumerids.contains(consumer["id"])): # No need to update group return consumerids.append(consumer["id"]) consumergroup["consumerids"] = consumerid...
data.append(info)
data.append(pkg)
def installpackages(self, id, packagenames=[]): """ Install packages on the consumer. @param id: A consumer id. @type id: str @param packagenames: The package names to install. @type packagenames: [str,..] """ agent = Agent(id) data = [] for pkg in packagenames: info = pkg.split('.') if len(info) > 1: data.append(('.'....
print('-----') print(info['name']) print(info['version']) print(info['epoch']) print(info['release']) print(info['arch'])
def import_package(self, pkg_path, repo): packages = repo['packages'] if (pkg_path.endswith(".rpm")): try: info = pulp.util.getRPMInformation(pkg_path) p = self.package_api.package(info['name']) if not p: p = self.package_api.create(info['name'], info['description'])
def __init__(self, id=getuuid(), host='localhost', port=5672):
def __init__(self, id=None, host='localhost', port=5672):
def __init__(self, id=getuuid(), host='localhost', port=5672): """ @param host: The broker fqdn or IP. @type host: str @param port: The broker port. @type port: str """ self.id = id self.host = host self.port = port self.__session = None self.connect() self.open()
self.id = id
self.id = ( id or getuuid() )
def __init__(self, id=getuuid(), host='localhost', port=5672): """ @param host: The broker fqdn or IP. @type host: str @param port: The broker port. @type port: str """ self.id = id self.host = host self.port = port self.__session = None self.connect() self.open()
self._dipatcher_timeout = dispatcher_timeout
def __init__(self, storage, dispatcher_timeout=0.5): """ @type dispatcher_timeout: float @param dispatcher_timeout: the max number of seconds before the dispatcher wakes up to run tasks """ self._storage = storage self._lock = threading.RLock() self._condition = threading.Condition(self._lock) self._dispatcher = thre...
self._condition.wait(self._dipatcher_timeout)
self._condition.wait(self._dispatcher_timeout)
def _dispatch(self): """ Scheduling method that that executes the scheduling hooks This should not be overridden by a derived class """ self._lock.acquire() while True: self._condition.wait(self._dipatcher_timeout) self._initial_runs() for task in self._get_tasks(): self._pre_run(task) self._run(task) self._post_run(ta...
task = self.find_task(id)
task = self.find_task(action_id)
def DELETE(self, id, action_name, action_id): """ Cancel an action """ task = self.find_task(id) if task is None: return self.not_found('No %s with id %s found' % (action_name, action_id)) if self.cancel_task(id): return self.accepted({'status_uri': http.uri_path()}) # action is complete and, therfore, not cancelled # ...
if self.cancel_task(id): return self.accepted({'status_uri': http.uri_path()})
if self.cancel_task(action_id): return self.accepted(self._task_to_dict(task))
def DELETE(self, id, action_name, action_id): """ Cancel an action """ task = self.find_task(id) if task is None: return self.not_found('No %s with id %s found' % (action_name, action_id)) if self.cancel_task(id): return self.accepted({'status_uri': http.uri_path()}) # action is complete and, therfore, not cancelled # ...
user = self.uapi.create(login, id)
user = self.uapi.create(login=login, id=id)
def test_duplicate(self): id = uuid.uuid4() login = 'dupe-test' user = self.uapi.create(login, id) try: user = self.uapi.create(login, id) raise Exception, 'Duplicate allowed' except: pass
credentials = web.ctx.environ.get('HTTP_AUTHORIZATION', None) return credentials
return web.ctx.environ.get('HTTP_AUTHORIZATION', None)
def http_authorization(): """ Return the current http authorization credentials, if any @return: str representing the http authorization credentials if found, None otherwise """ credentials = web.ctx.environ.get('HTTP_AUTHORIZATION', None) return credentials
parts = [p for p in uri_path().split('/') if p][2:]
parts = [p for p in uri_path().split('/') if p] assert parts[:2] == ('pulp', 'api') parts = parts[2:]
def resource_path(): """ Return the uri path with the /pulp/api prefix stripped off @rtype: str @return: uri formatted path """ parts = [p for p in uri_path().split('/') if p][2:] if not parts: return '/' return '/%s/' % '/'.join(parts)
if hasattr(self, id):
if hasattr(self, 'id'):
def setup_parser(self): help = _("consumer identifier eg: foo.example.com") default = None if hasattr(self, id): help = SUPPRESS_HELP default = self.id self.parser.add_option("--id", dest="id", default=default, help=help)
repo['distributionid'].append(distro['id']) log.info("Created a distributionID %s" % distro['id'])
if distro['id'] not in repo['distributionid']: repo['distributionid'].append(distro['id']) log.info("Created a distributionID %s" % distro['id'])
def _process_repo_images(self, repodir, repo): log.debug("Processing any images synced as part of the repo") images_dir = os.path.join(repodir, "images") if not os.path.exists(images_dir): log.info("No image files to import to repo..") return # Handle distributions that are part of repo syncs files = pulp.server.util.l...
yfetch.fetchYumRepo(config.config.get('paths', 'local_storage'))
yfetch.fetchYumRepo(config.config.get('paths', 'local_storage'), callback=progressCallback)
def sync(self, repo, repo_source): cacert = clicert = clikey = None if repo['ca'] and repo['cert'] and repo['key']: cacert = repo['ca'].encode('utf8') clicert = repo['cert'].encode('utf8') clikey = repo['key'].encode('utf8') yfetch = YumRepoGrinder(repo['id'], repo_source['url'].encode('ascii', 'ignore'), 1, cacert=cac...
s.syncPackages(channel, savePath=dest_dir)
s.syncPackages(channel, savePath=dest_dir, callback=progressCallback)
def sync(self, repo, repo_source): # Parse the repo source for necessary pieces # Expected format: <server>/<channel> pieces = repo_source['url'].split('/') if len(pieces) < 2: raise PulpException('Feed format for RHN type must be <server>/<channel>. Feed: %s', repo_source['url'])
repo_dir = "%s/%s/" % (pulp.server.util.top_repos_location(), repo['id'])
repo_dir = "%s/%s/" % (pulp.server.util.top_repos_location(), repo['relative_path'])
def generate_updateinfo(repo): """ Method to generate updateinfo xml for a given repo, write to file and update repomd.xml with new updateinfo @param repo: repo object with errata to generate updateinfo.xml @type repo: repository object """ um = UpdateMetadata() un = UpdateNotice() eapi = ErrataApi() if not repo['err...
assert _version_db is not None
_init_db()
def _get_latest_version(): """ Utility function to fetch the latest DataModelVersion model from the db. @rtype: L{DataModelVersion} instance @return: the data model intance with the most recent version """ assert _version_db is not None versions = _version_db.find() if not versions: return None versions.sort({'version'...
if not versions:
if versions.count() == 0:
def _get_latest_version(): """ Utility function to fetch the latest DataModelVersion model from the db. @rtype: L{DataModelVersion} instance @return: the data model intance with the most recent version """ assert _version_db is not None versions = _version_db.find() if not versions: return None versions.sort({'version'...
versions.sort({'version': pymongo.DESCENDING}).limit(1)
versions.sort('version', pymongo.DESCENDING).limit(1)
def _get_latest_version(): """ Utility function to fetch the latest DataModelVersion model from the db. @rtype: L{DataModelVersion} instance @return: the data model intance with the most recent version """ assert _version_db is not None versions = _version_db.find() if not versions: return None versions.sort({'version'...
assert _version_db is not None
def get_version_in_use(): """ Fetch the data model version currently in use in the db. @rtype: int @return: integer data model version """ assert _version_db is not None v = _get_latest_version() return v.version
assert _version_db is not None
def check_version(): """ Check for a version mismatch between the current data model version and the data model version in use in the db. If a mismatch is detected, the mismatch is logged and the application exits. """ assert _version_db is not None v = _get_latest_version() if v.version == VERSION: return _log.critica...
if v.version == VERSION:
if v is not None and v.version == VERSION:
def check_version(): """ Check for a version mismatch between the current data model version and the data model version in use in the db. If a mismatch is detected, the mismatch is logged and the application exits. """ assert _version_db is not None v = _get_latest_version() if v.version == VERSION: return _log.critica...
_log.critical('data model version mismatch: %d in use, but needs to be %d' % v.version, VERSION) _log.critical('pulp exiting: please migrate your database to the latest data model') sys.exit(os.EX_DATAERR)
msg = 'data model version mismatch: %s in use, but needs to be %s' % \ (v and v.version, VERSION) log = logging.getLogger('pulp') log.critical(msg) log.critical("use the 'pulp-migrate' tool to fix this before restarting the web server") raise RuntimeError(msg)
def check_version(): """ Check for a version mismatch between the current data model version and the data model version in use in the db. If a mismatch is detected, the mismatch is logged and the application exits. """ assert _version_db is not None v = _get_latest_version() if v.version == VERSION: return _log.critica...
assert _version_db is not None
def set_version(version): """ Set the data model version in the database. @type version: int @param version: data model version """ assert _version_db is not None v = DataModelVersion(version) _version_db.save(v, safe=True)
_version_db.save(v, safe=True)
_set_version(v)
def set_version(version): """ Set the data model version in the database. @type version: int @param version: data model version """ assert _version_db is not None v = DataModelVersion(version) _version_db.save(v, safe=True)
assert _version_db is not None
def is_validated(): """ Check to see if the latest data model version has been validated. @rtype: bool @return: True if the data model has been validated, False otherwise """ assert _version_db is not None v = _get_latest_version() return v.validated
assert _version_db is not None
def set_validated(): """ Flag the latest data model version as validated. """ assert _version_db is not None v = _get_latest_version() v.validated = True _version_db.save(v, safe=True)
_version_db.save(v, safe=True) _init_db() check_version()
_set_version(v)
def set_validated(): """ Flag the latest data model version as validated. """ assert _version_db is not None v = _get_latest_version() v.validated = True _version_db.save(v, safe=True)
log.info("Progress: %s on <%s>, %s/%s items %s/%s bytes" % values)
log.debug("Progress: %s on <%s>, %s/%s items %s/%s bytes" % values)
def yum_rhn_progress_callback(info): fields = ('status', 'item_name', 'items_left', 'items_total', 'size_left', 'size_total') values = tuple(getattr(info, f) for f in fields) log.info("Progress: %s on <%s>, %s/%s items %s/%s bytes" % values) return dict(zip(fields, values))
help="Repository Label")
help="package name to lookup")
def generate_options(self): possiblecmd = []
pv = self.packageVersionApi.create(p.packageid, info['epoch'],
pv = self.packageVersionApi.create(p["packageid"], info['epoch'],
def _add_packages_from_dir(self, dir, repo): dirList = os.listdir(dir) packages = repo['packages'] package_count = 0 for fname in dirList: if (fname.endswith(".rpm")): try: info = getRPMInformation(dir + fname) #p = self.packageApi.package(info['name']) p = self.package(repo["id"], info['name']) if not p: p = self.crea...
p.versions.append(pv)
p["versions"].append(pv)
def _add_packages_from_dir(self, dir, repo): dirList = os.listdir(dir) packages = repo['packages'] package_count = 0 for fname in dirList: if (fname.endswith(".rpm")): try: info = getRPMInformation(dir + fname) #p = self.packageApi.package(info['name']) p = self.package(repo["id"], info['name']) if not p: p = self.crea...
log.debug("repo = %s" % (repo)) log.debug("packages = %s" % (packages))
def _add_packages_from_dir(self, dir, repo): dirList = os.listdir(dir) packages = repo['packages'] package_count = 0 for fname in dirList: if (fname.endswith(".rpm")): try: info = getRPMInformation(dir + fname) #p = self.packageApi.package(info['name']) p = self.package(repo["id"], info['name']) if not p: p = self.crea...
conflicting_consumers = self.find_conflicting_keyvalues(id, key, value)
conflicting_consumers = self.find_consumers_with_conflicting_keyvalues(id, key, value)
def add_key_value_pair(self, id, key, value): """ Add key-value info to a consumer group. @param id: A consumer group id. @type id: str @param repoid: key @type repoid: str @param value: value @type: str @raise PulpException: When consumer group is not found. """ consumergroup = self.consumergroup(id) if not consumergr...
conflicting_consumers = self.find_conflicting_keyvalues(id, key, value)
conflicting_consumers = self.find_consumers_with_conflicting_keyvalues(id, key, value)
def update_key_value_pair(self, id, key, value): """ Update key-value info of a consumer group. @param id: A consumer group id. @type id: str @param repoid: key @type repoid: str @param value: value @type: str @raise PulpException: When consumer group is not found. """ consumergroup = self.consumergroup(id) if not cons...
user = self.userconn.create(self.options.newusername, self.options.newpassword, self.options.name)
user = self.userconn.create(login=self.options.newusername, password=self.options.newpassword, name=self.options.name)
def _create(self): if not self.options.newusername: print("newusername required. Try --help") sys.exit(0) if not self.options.name: self.options.name = "" if not self.options.newpassword: self.options.newpassword = "" try: user = self.userconn.create(self.options.newusername, self.options.newpassword, self.options.name...
descendants.extend(_thread_tree.get(d(), [])) return [d() for d in descendants if d() is not None]
t = d() if t is None: continue descendants.extend(_thread_tree.get(t, [])) return filter(lambda d: d is not None, [d() for d in descendants])
def get_descendants(thread): """ Get a list of all the descendant threads for the given thread. @type thread: L{TrackedThread} instance @param thread: thread to find the descendants of @raise RuntimeError: if the thread is not an instance of TrackedThread @return: list of TrackedThread instances """ if not isinstance(t...
exists.
exits.
def raise_exception(self, exc_type): """ Raise an exception in this thread. NOTE this is executed in the context of the calling thread and blocks until the exception has been delivered to this thread and this thread exists. """ # embedded methods to reduce code duplication def test_exception_event(): return not self._...
os.system('chmod 3775 /var/www/pulp')
os.system('chmod 3775 /var/www/pub')
def install(opts): create_dirs(opts) currdir = os.path.abspath(os.path.dirname(__file__)) for l in LINKS: debug(opts, 'creating link: /%s' % l) if os.path.exists('/'+l): debug(opts, '/%s exists, skipping' % l) continue os.symlink(os.path.join(currdir, l), '/'+l) # Link between pulp and apache if not os.path.exists('/v...
self.name = "consumer"
def __init__(self): usage = "usage: %prog consumer [OPTIONS]" shortdesc = "consumer specific actions to pulp server." desc = ""
elif len(possiblecmd) == 1:
elif len(possiblecmd) == 1 and possiblecmd[0] == self.name:
def generate_options(self): possiblecmd = []
self.generate_options()
def _do_core(self): self.generate_options() self._validate_options() if self.action == "create": self._create() if self.action == "list": self._list() if self.action == "delete": self._delete() if self.action == "bind": self._bind() if self.action == "unbind": self._unbind()
elif len(possiblecmd) == 1:
elif len(possiblecmd) == 1 and possiblecmd[0] == self.name:
def generate_options(self):
self.generate_options()
def _do_core(self): self.generate_options() self._validate_options() if self.action == "create": self._create() if self.action == "list": self._list() if self.action == "sync": self._sync()
assert(found['relative_path'] == "mypath/")
assert(found['relative_path'] == "mypath")
def test_repository_with_relativepath(self): repo = self.rapi.create('some-id-mypath', 'some name', \ 'i386', 'yum:http://example.com/mypath', relative_path="/mypath/") found = self.rapi.repository('some-id-mypath') assert(found is not None) assert(found['id'] == 'some-id-mypath') assert(found['relative_path'] == "mypa...
_log.info('%s called %s.%s on %s' % (principal, api, method_name, params_repr))
_log.info('%s called %s.%s' % (principal, api, method_name))
def _record_event(): _objdb.insert(event, safe=False, check_keys=False) _log.info('%s called %s.%s on %s' % (principal, api, method_name, params_repr))
tb = ''.join(traceback.format_exception_only(*exc))
tb = ''.join(traceback.format_exception(*exc))
def _record_event(): _objdb.insert(event, safe=False, check_keys=False) _log.info('%s called %s.%s on %s' % (principal, api, method_name, params_repr))
self.repolib.update()
if not self.is_admin: self.repolib.update()
def _bind(self): consumerid = self.getConsumer() if not self.options.repoid: print _("repo id required. Try --help") sys.exit(0) try: self.cconn.bind(consumerid, self.options.repoid) self.repolib.update() print _(" Successfully subscribed consumer [%s] to repo [%s]") % \ (consumerid, self.options.repoid) except Restlib...
self.repolib.update()
if not self.is_admin: self.repolib.update()
def _unbind(self): consumerid = self.getConsumer() if not self.options.repoid: print _("repo id required. Try --help") sys.exit(0) try: self.cconn.unbind(consumerid, self.options.repoid) self.repolib.update() print _(" Successfully unsubscribed consumer [%s] from repo [%s]") % \ (consumerid, self.options.repoid) except...
user = api.create(user_data['login'], user_data['password'], user_data['name'])
user = api.create(login=user_data['login'], password=user_data['password'], name=user_data['name'])
def PUT(self): """ Create a new user @return: user that was created """ user_data = self.params() user = api.create(user_data['login'], user_data['password'], user_data['name']) return self.created(user['id'], user)
cert_files[key] = fname
cert_files[key] = str(fname)
def _write_certs_to_disk(self, repoid, cert_data): CONTENT_CERTS_PATH = config.config.get("repos", "content_cert_location") cert_dir = os.path.join(CONTENT_CERTS_PATH, repoid)
'{inbound} method %s()", not found' % (action)
'{inbound} method %s()", not found' % action
def inbound(cls, action): """ Find the handler B{inbound} method for the specified I{action}. @param action: The I{action} part of an event subject. @type action: str @return: The handler instance method. @rtype: instancemethod """ mutex.acquire() try: method = cls.inbounds.get(action) if method is None: raise Exceptio...