bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def create(self, id, name, arch, feed=None, symlinks=False, sync_schedule=None, cert_data=None, groupid=None, relative_path=None, gpgkeys=[]): """ Create a new Repository object and return it """ repo = self.repository(id) if repo is not None: raise PulpException("A Repo with id %s already exists" % id) self._validate_... | def create(self, id, name, arch, feed=None, symlinks=False, sync_schedule=None, cert_data=None, groupid=None, relative_path=None, gpgkeys=[]): """ Create a new Repository object and return it """ repo = self.repository(id) if repo is not None: raise PulpException("A Repo with id %s already exists" % id) self._validate_... | 454,100 |
def _update_groups_metadata(self, repoid): """ Updates the groups metadata (example: comps.xml) for a given repo @param repoid: repo id @return: True if metadata was successfully updated, otherwise False """ repo = self._get_existing_repo(repoid) try: # If the repomd file is not valid, or if we are missingg # a group m... | def _update_groups_metadata(self, repoid): """ Updates the groups metadata (example: comps.xml) for a given repo @param repoid: repo id @return: True if metadata was successfully updated, otherwise False """ repo = self._get_existing_repo(repoid) try: # If the repomd file is not valid, or if we are missingg # a group m... | 454,101 |
def _update_groups_metadata(self, repoid): """ Updates the groups metadata (example: comps.xml) for a given repo @param repoid: repo id @return: True if metadata was successfully updated, otherwise False """ repo = self._get_existing_repo(repoid) try: # If the repomd file is not valid, or if we are missingg # a group m... | def _update_groups_metadata(self, repoid): """ Updates the groups metadata (example: comps.xml) for a given repo @param repoid: repo id @return: True if metadata was successfully updated, otherwise False """ repo = self._get_existing_repo(repoid) try: # If the repomd file is not valid, or if we are missingg # a group m... | 454,102 |
def setup_parser(self): super(RemovePackages, self).setup_parser() self.parser.add_option("-p", "--package", action="append", dest="pkgname", help=_("Package filename to remove to this repository")) | def setup_parser(self): super(RemovePackages, self).setup_parser() self.parser.add_option("-p", "--package", action="append", dest="pkgname", help=_("Package filename to remove to this repository")) | 454,103 |
def setup_parser(self): super(RemoveErrata, self).setup_parser() self.parser.add_option("-e", "--errata", action="append", dest="errataid", help=_("Errata Id to delete to this repository")) | def setup_parser(self): super(RemoveErrata, self).setup_parser() self.parser.add_option("-e", "--errata", action="append", dest="errataid", help=_("Errata Id to delete to this repository")) | 454,104 |
def test_update_delete_schedule(self): ''' Tests multiple updates to a repo's sync schedule and the case where multiple updates are created with no schedules. ''' | def test_update_delete_schedule(self): ''' Tests multiple updates to a repo's sync schedule and the case where multiple updates are created with no schedules. ''' | 454,105 |
def get_repomd_filetype_path(path, filetype): """ @param path: path to repo @param filetype: metadata type to query, example "group", "primary", etc @return: Path for filetype, or None """ rmd = yum.repoMDObject.RepoMD("temp_pulp", repomd_path) if rmd: data = rmd.getData(filetype) return data.location[1] return None | def get_repomd_filetype_path(path, filetype): """ @param path: path to repo @param filetype: metadata type to query, example "group", "primary", etc @return: Path for filetype, or None """ rmd = yum.repoMDObject.RepoMD("temp_pulp", path) if rmd: data = rmd.getData(filetype) return data.location[1] return None | 454,106 |
def POST(self): """ @return: True on successful update or repository meta data """ repo = self.input() API.update(repo) return self.output(True) | def POST(self, id): """ @return: True on successful update or repository meta data """ repo = self.input() API.update(repo) return self.output(True) | 454,107 |
def POST(self): """ @return: True on successful update or repository meta data """ repo = self.input() API.update(repo) return self.output(True) | def POST(self): """ @return: True on successful update of repository meta data """ repo = self.input() API.update(repo) return self.output(True) | 454,108 |
def PUT(self): """ Create a new user @return: user that was created """ user_data = self.params() user = api.create(login=user_data['login'], password=user_data['password'], name=user_data['name']) return self.created(user['id'], user) | 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) | 454,109 |
def _raise_exception_in_thread(tid, exctype): """ Raises an exception in the threads with id tid. """ if not inspect.isclass(exctype): raise TypeError('Only types can be raised (not instances)') # NOTE this returns the number of threads that it modified, which should # only be 1 or 0 (if the thread id wasn't found) exc... | def _raise_exception_in_thread(tid, exc_type): """ Raises an exception in the threads with id tid. """ if not inspect.isclass(exctype): raise TypeError('Only types can be raised (not instances)') # NOTE this returns the number of threads that it modified, which should # only be 1 or 0 (if the thread id wasn't found) ex... | 454,110 |
def _raise_exception_in_thread(tid, exctype): """ Raises an exception in the threads with id tid. """ if not inspect.isclass(exctype): raise TypeError('Only types can be raised (not instances)') # NOTE this returns the number of threads that it modified, which should # only be 1 or 0 (if the thread id wasn't found) exc... | def _raise_exception_in_thread(tid, exctype): """ 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) excptr = ctypes.py_object(exctype) num = ctypes.pythonapi.PyThr... | 454,111 |
def _raise_exception_in_thread(tid, exctype): """ Raises an exception in the threads with id tid. """ if not inspect.isclass(exctype): raise TypeError('Only types can be raised (not instances)') # NOTE this returns the number of threads that it modified, which should # only be 1 or 0 (if the thread id wasn't found) exc... | def _raise_exception_in_thread(tid, exctype): """ Raises an exception in the threads with id tid. """ if not inspect.isclass(exctype): raise TypeError('Only types can be raised (not instances)') # NOTE this returns the number of threads that it modified, which should # only be 1 or 0 (if the thread id wasn't found) lon... | 454,112 |
def _raise_exception_in_thread(tid, exctype): """ Raises an exception in the threads with id tid. """ if not inspect.isclass(exctype): raise TypeError('Only types can be raised (not instances)') # NOTE this returns the number of threads that it modified, which should # only be 1 or 0 (if the thread id wasn't found) exc... | def _raise_exception_in_thread(tid, exctype): """ Raises an exception in the threads with id tid. """ if not inspect.isclass(exctype): raise TypeError('Only types can be raised (not instances)') # NOTE this returns the number of threads that it modified, which should # only be 1 or 0 (if the thread id wasn't found) exc... | 454,113 |
def _tid(self): """ Determine this thread's id. | def _tid(self): """ Determine this thread's id. | 454,114 |
def raise_exception(self, exctype): """ Raises the given exception type in the context of this thread. | def raise_exception(self, exctype): """ Raises the given exception type in the context of this thread. | 454,115 |
def raise_exception(self, exctype): """ Raises the given exception type in the context of this thread. | def raise_exception(self, exctype): """ Raises the given exception type in the context of this thread. | 454,116 |
def raise_exception(self, exctype): """ Raises the given exception type in the context of this thread. | def raise_exception(self, exctype): """ Raises the given exception type in the context of this thread. | 454,117 |
def timeout(self): """ Raise a TimeoutException in the thread. """ self._ensure_exception(TimeoutException) | def timeout(self): """ Raise a TimeoutException in the thread. """ self.raise_exception(TimeoutException) | 454,118 |
def generate_options(self): | def generate_options(self): | 454,119 |
def generate_options(self): | def generate_options(self): | 454,120 |
def add_packages_from_dir(self, dir, repo, skip={}): added_packages = {} added_errataids = [] if not skip.has_key('packages') or skip['packages'] != 1: startTime = time.time() log.debug("Begin to add packages from %s into %s" % (dir, repo['id'])) package_list = pulp.server.util.get_repo_packages(dir) log.debug("Process... | def add_packages_from_dir(self, dir, repo, skip={}): added_packages = {} added_errataids = [] if not skip.has_key('packages') or skip['packages'] != 1: startTime = time.time() log.debug("Begin to add packages from %s into %s" % (dir, repo['id'])) package_list = pulp.server.util.get_repo_packages(dir) log.debug("Process... | 454,121 |
def import_package(self, package, repo): try: retval = None file_name = package.relativepath hashtype = "sha256" checksum = package.checksum found = self.package_api.packages(name=package.name, epoch=package.epoch, version=package.version, release=package.release, arch=package.arch, filename=file_name, checksum_type=ha... | def import_package(self, package, repo): try: retval = None file_name = package.relativepath hashtype = "sha256" checksum = package.checksum found = self.package_api.packages(name=package.name, epoch=package.epoch, version=package.version, release=package.release, arch=package.arch, filename=file_name, checksum_type=ha... | 454,122 |
def generate_options(self): | def generate_options(self): | 454,123 |
def _delete(self): (self.options, self.args) = self.parser.parse_args() if not self.options.id: print("Group id required. Try --help") sys.exit(0) try: self.cgconn.delete(id=self.options.id) print _(" Successful deleted Consumer Group [ %s ] " % self.options.id) except RestlibException, re: print _(" Deleted operation ... | def _delete(self): (self.options, self.args) = self.parser.parse_args() if not self.options.id: print("Group id required. Try --help") sys.exit(0) try: self.cgconn.delete(id=self.options.id) print _(" Successful deleted Consumer Group [ %s ] " % self.options.id) except RestlibException, re: print _(" Deleted operation ... | 454,124 |
def _delete(self): (self.options, self.args) = self.parser.parse_args() if not self.options.id: print("Group id required. Try --help") sys.exit(0) try: self.cgconn.delete(id=self.options.id) print _(" Successful deleted Consumer Group [ %s ] " % self.options.id) except RestlibException, re: print _(" Deleted operation ... | def _delete(self): (self.options, self.args) = self.parser.parse_args() if not self.options.id: print("Group id required. Try --help") sys.exit(0) try: self.cgconn.delete(id=self.options.id) print _(" Successful deleted Consumer Group [ %s ] " % self.options.id) except RestlibException, re: print _(" Deleted operation ... | 454,125 |
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) | 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) | 454,126 |
def test_all_schedules(self): # Setup self.repo_api.create('repo-1', 'repo-1', 'i386', 'yum:localhost', '1 * * * *') self.repo_api.create('repo-2', 'repo-2', 'i386', 'yum:localhost', '2 * * * *') self.repo_api.create('repo-3', 'repo-3', 'i386', 'yum:localhost', None) self.repo_api.create('repo-4', 'repo-4', 'i386', 'yu... | def test_all_schedules(self): # Setup self.repo_api.create('repo-1', 'repo-1', 'i386', 'yum:localhost', sync_schedule='1 * * * *') self.repo_api.create('repo-2', 'repo-2', 'i386', 'yum:localhost', sync_schedule='2 * * * *') self.repo_api.create('repo-3', 'repo-3', 'i386', 'yum:localhost', sync_schedule=None) self.repo_... | 454,127 |
def _timeout_tasks(self): """ Stop tasks that have met or exceeded the queue's timeout length. """ if self.timeout is None: return running_tasks = self.__storage.running_tasks() if not running_tasks: return now = datetime.now() for task in running_tasks: if now - task.start_time < self.timeout: continue thread = self._... | def _timeout_tasks(self): """ Stop tasks that have met or exceeded the queue's timeout length. """ if self.timeout is None: return running_tasks = self.__storage.running_tasks() if not running_tasks: return now = datetime.now() for task in running_tasks: if task.start_time is None or now - task.start_time < self.time... | 454,128 |
def _timeout_tasks(self): """ Stop tasks that have met or exceeded the queue's timeout length. """ if self.timeout is None: return running_tasks = self.__storage.running_tasks() if not running_tasks: return now = datetime.now() for task in running_tasks: if now - task.start_time < self.timeout: continue thread = self._... | def _timeout_tasks(self): """ Stop tasks that have met or exceeded the queue's timeout length. """ if self.timeout is None: return running_tasks = self.__storage.running_tasks() if not running_tasks: return now = datetime.now() for task in running_tasks: if now - task.start_time < self.timeout: continue thread = self._... | 454,129 |
def cancel(self, task): self.__lock.acquire() try: thread = self.__threads[task] thread.cancel() while task.state not in task_complete_states: time.sleep(self._default_sleep) task.cancel() finally: self.__lock.release() | def cancel(self, task): self.__lock.acquire() try: thread = self.__threads[task] thread.cancel() self._wait_for_task(task) task.cancel() finally: self.__lock.release() | 454,130 |
def run(self): key = self.opts.key value = self.opts.value cons = self.cconn.consumers() baseurl = "%s://%s:%s" % (_cfg.server.scheme, _cfg.server.host, _cfg.server.port) for con in cons: con['package_profile'] = urlparse.urljoin(baseurl, con['package_profile']) if key is None: print_header(_("Consumer Information")) f... | def run(self): key = self.opts.key value = self.opts.value cons = self.cconn.consumers() baseurl = "%s://%s:%s" % (_cfg.server.scheme, _cfg.server.host, _cfg.server.port) for con in cons: con['package_profile'] = urlparse.urljoin(baseurl, con['package_profile']) if key is None: print_header(_("Consumer Information")) f... | 454,131 |
def setup_parser(self): super(Create, self).setup_parser() self.parser.add_option("--description", dest="description", help=_("consumer description eg: foo's web server")) | def setup_parser(self): self.parser.add_option('--id', dest='id', help=_("consumer identifier eg: foo.example.com (required)")) self.parser.add_option("--description", dest="description", help=_("consumer description eg: foo's web server")) | 454,132 |
def keyfiles(self): """ Get a list of GPG key files at the specified I{path}. @param path: An absolute path to a file containing a GPG key. @type path: str @return: A list of tuples: (key-path, key-content) @rtype: list """ keys = [] pattern = '----BEGIN PGP PUBLIC KEY BLOCK-----' path = os.path.join(keydir(), self.pat... | def keyfiles(self): """ Get a list of GPG key files at the specified I{path}. @param path: An absolute path to a file containing a GPG key. @type path: str @return: A list of tuples: (key-path, key-content) @rtype: list """ keys = [] pattern = '----BEGIN PGP PUBLIC KEY BLOCK-----' path = os.path.join(keydir(), self.pat... | 454,133 |
def setup_parser(self): self.parser.add_option('--username', dest='username', help=_('pulp account username')) self.parser.add_option('--password', dest='password', help=_('pulp account password')) | def setup_parser(self): self.parser.add_option('-u', '--username', dest='username', help=_('pulp account username')) self.parser.add_option('--password', dest='password', help=_('pulp account password')) | 454,134 |
def setup_parser(self): self.parser.add_option('--username', dest='username', help=_('pulp account username')) self.parser.add_option('--password', dest='password', help=_('pulp account password')) | def setup_parser(self): self.parser.add_option('--username', dest='username', help=_('pulp account username')) self.parser.add_option('-p', '--password', dest='password', help=_('pulp account password')) | 454,135 |
def load_server(self): self.pconn = RepoConnection(host=CFG.server.host or "localhost", port=CFG.server.port or 443, username=self.username, password=self.password, cert_file=self.cert_filename, key_file=self.key_filename) | def load_server(self): self.pconn = RepoConnection(host=CFG.server.host or "localhost", port=CFG.server.port or 443, username=self.username, password=self.password, cert_file=self.cert_filename, key_file=self.key_filename) | 454,136 |
def _add_create_update_options(self): self.parser.add_option("--id", dest="id", help="Repository Id") self.parser.add_option("--name", dest="name", help="Common repository name") self.parser.add_option("--arch", dest="arch", help="Package arch the repo should support.") self.parser.add_option("--feed", dest="feed", hel... | def _add_create_update_options(self): self.parser.add_option("--id", dest="id", help="Repository Id") self.parser.add_option("--name", dest="name", help="Common repository name") self.parser.add_option("--arch", dest="arch", help="Package arch the repo should support.") self.parser.add_option("--feed", dest="feed", hel... | 454,137 |
def _get_cert_options(self): cert_data = None if self.options.cacert and self.options.cert and self.options.key: cert_data = {"ca": utils.readFile(self.options.cacert), "cert": utils.readFile(self.options.cert), "key": utils.readFile(self.options.key)} return cert_data | def _get_cert_options(self): cert_data = None if self.options.cacert and self.options.cert and self.options.key: cert_data = {"ca": utils.readFile(self.options.cacert), "cert": utils.readFile(self.options.cert), "key": utils.readFile(self.options.key)} return cert_data | 454,138 |
def _update(self): if not self.options.id: print("repo id required. Try --help") sys.exit(1) try: repo = self.pconn.repository(self.options.id) if not repo: print("repo with id: [%s] not found." % self.options.id) sys.exit(1) optdict = vars(self.options) for field in optdict.keys(): if (repo.has_key(field) and optdict[... | def _update(self): if not self.options.id: print("repo id required. Try --help") sys.exit(1) try: repo = self.pconn.repository(self.options.id) if not repo: print("repo with id: [%s] not found." % self.options.id) sys.exit(1) optdict = vars(self.options) for field in optdict.keys(): if (repo.has_key(field) and optdict[... | 454,139 |
def _print_sync_finsih(self, state, progress): self._print_sync_progress(progress) print '' print _('Sync: %s') % state.title() | def _print_sync_finish(self, state, progress): self._print_sync_progress(progress) print '' print _('Sync: %s') % state.title() | 454,140 |
def test_loadConfig(self): # Setup origFile = '../../etc/pulp.ini' overrideFile = './data/test-override-pulp.ini' # Test & Verify config = loadConfig(origFile) self.assertEqual(config.get('paths', 'http_mount'), '/var/www/pulp') | def test_load_config(self): # Setup origFile = '../../etc/pulp.ini' overrideFile = './data/test-override-pulp.ini' # Test & Verify config = loadConfig(origFile) self.assertEqual(config.get('paths', 'http_mount'), '/var/www/pulp') | 454,141 |
def test_loadConfig(self): # Setup origFile = '../../etc/pulp.ini' overrideFile = './data/test-override-pulp.ini' # Test & Verify config = loadConfig(origFile) self.assertEqual(config.get('paths', 'http_mount'), '/var/www/pulp') | def test_loadConfig(self): # Setup orig_file = os.path.abspath(os.path.dirname(__file__)) + '/../../etc/pulp/pulp.ini' override_file = os.path.abspath(os.path.dirname(__file__)) + '/../common/test-override-pulp.ini' # Test & Verify config = loadConfig(origFile) self.assertEqual(config.get('paths', 'http_mount'), '/var... | 454,142 |
def test_loadConfig(self): # Setup origFile = '../../etc/pulp.ini' overrideFile = './data/test-override-pulp.ini' # Test & Verify config = loadConfig(origFile) self.assertEqual(config.get('paths', 'http_mount'), '/var/www/pulp') | def test_loadConfig(self): # Setup origFile = '../../etc/pulp.ini' overrideFile = './data/test-override-pulp.ini' # Test & Verify config = loadConfig(origFile) self.assertEqual(config.get('paths', 'http_mount'), '/var/www/pulp') | 454,143 |
def test_loadConfig(self): # Setup origFile = '../../etc/pulp.ini' overrideFile = './data/test-override-pulp.ini' # Test & Verify config = loadConfig(origFile) self.assertEqual(config.get('paths', 'http_mount'), '/var/www/pulp') | def test_loadConfig(self): # Setup origFile = '../../etc/pulp.ini' overrideFile = './data/test-override-pulp.ini' # Test & Verify config = loadConfig(origFile) self.assertEqual(config.get('paths', 'http_mount'), '/var/www/pulp') | 454,144 |
def run(self): if self.opts.groupid: repos = self.pconn.repositories_by_groupid(groups=self.opts.groupid) else: repos = self.pconn.repositories() if not len(repos): system_exit(os.EX_OK, _("No repositories available to list")) print_header(_('List of Available Repositories')) for repo in repos: feedUrl = feedType = Non... | def run(self): if self.opts.groupid: repos = self.pconn.repositories_by_groupid(groups=self.opts.groupid) else: repos = self.pconn.repositories() if not len(repos): system_exit(os.EX_OK, _("No repositories available to list")) print_header(_('List of Available Repositories')) for repo in repos: feedUrl = feedType = Non... | 454,145 |
def setup_parser(self): super(Create, 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... | def setup_parser(self): super(Create, 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... | 454,146 |
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... | 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... | 454,147 |
def _timeout_tasks(self): """ """ if self.timeout is None: return running_tasks = self.__storage.running_tasks() if not running_tasks: return now = datetime.now() for task in running_tasks: if now - task.start_time < self.timeout: continue thread = self.__threads[task] # this will cause a deadlock because we are holdin... | def _timeout_tasks(self): """ """ if self.timeout is None: return running_tasks = self.__storage.running_tasks() if not running_tasks: return now = datetime.now() for task in running_tasks: if now - task.start_time < self.timeout: continue thread = self.__threads[task] # this will cause a deadlock because we are holdin... | 454,148 |
def cancel(self, task): self.__lock.acquire() try: thread = self.__threads[task] thread.cancel() while not isinstance(task.exception, CancelException): time.sleep(0.0005) task.cancel() finally: self.__lock.release() | def cancel(self, task): self.__lock.acquire() try: thread = self.__threads[task] thread.cancel() while task.state not in task_complete_states: time.sleep(0.0005) task.cancel() finally: self.__lock.release() | 454,149 |
def test_repo_package_groups(self): repo = self.rapi.create('some-id','some name', \ 'i386', 'yum:http://example.com') pkggroup = self.rapi.create_packagegroup(repo["id"], 'test-group-id', 'test-group-name', 'test-group-description') package = self.create_package('test_repo_packages') self.rapi.add_package(repo["id"], ... | def test_repo_package_groups(self): repo = self.rapi.create('some-id','some name', \ 'i386', 'yum:http://example.com') pkggroup = self.rapi.create_packagegroup(repo["id"], 'test-group-id', 'test-group-name', 'test-group-description') package = self.create_package('test_repo_packages') self.rapi.add_package(repo["id"], ... | 454,150 |
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... | 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... | 454,151 |
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... | 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... | 454,152 |
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... | 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... | 454,153 |
def run(self): consumerid = self.opts.consumerid consumergroupid = self.opts.consumergroupid if not (consumerid or consumergroupid): system_exit(os.EX_USAGE, _("Consumer or consumer group id required. try --help")) pnames = self.opts.pnames if not pnames: system_exit(os.EX_DATAERR, _("Nothing to upload.")) if consumerg... | def run(self): consumerid = self.opts.consumerid consumergroupid = self.opts.consumergroupid if not (consumerid or consumergroupid): system_exit(os.EX_USAGE, _("Consumer or consumer group id required. try --help")) pnames = self.opts.pnames if not pnames: system_exit(os.EX_DATAERR, _("Nothing to upload.")) if consumerg... | 454,154 |
def consumer(self, id, fields=None): """ Return a single Consumer object """ return self.objectdb.find_one({'id': id}, fields=fields) | def consumer(self, id, fields=None): """ Return a single Consumer object """ consumers = list(self.objectdb.find(spec={'id': id}, fields=fields)) if not consumers: return None return consumers[0] | 454,155 |
def configure_pulp_grinder_logging(): """ Pull the log file configurations from the global config and/or default config and initialize the top-level logging for both pulp and grinder. """ level_name = config.config.get('logs', 'level').upper() level = getattr(logging, level_name, logging.INFO) max_size = config.config.... | def configure_pulp_grinder_logging(): """ Pull the log file configurations from the global config and/or default config and initialize the top-level logging for both pulp and grinder. """ level_name = config.config.get('logs', 'level').upper() level = getattr(logging, level_name, logging.INFO) max_size = config.config.... | 454,156 |
def configure_pulp_grinder_logging(): """ Pull the log file configurations from the global config and/or default config and initialize the top-level logging for both pulp and grinder. """ level_name = config.config.get('logs', 'level').upper() level = getattr(logging, level_name, logging.INFO) max_size = config.config.... | def configure_pulp_grinder_logging(): """ Pull the log file configurations from the global config and/or default config and initialize the top-level logging for both pulp and grinder. """ level_name = config.config.get('logs', 'level').upper() level = getattr(logging, level_name, logging.INFO) max_size = config.config.... | 454,157 |
def configure_audit_logging(): """ Pull the audit logging configuration from the global config and/or default config and initialize pulp's audit logging. """ file = config.config.get('auditing', 'events_file') check_log_file(file) units = 'D' backups = config.config.getint('auditing', 'backups') lifetime = config.confi... | def configure_audit_logging(): """ Pull the audit logging configuration from the global config and/or default config and initialize pulp's audit logging. """ file = config.config.get('auditing', 'events_file') check_log_file(file) units = 'D' backups = config.config.getint('auditing', 'backups') lifetime = config.confi... | 454,158 |
def start_logging(): """ Convenience function to start pulp's different logging mechanisms. """ assert config.config is not None global started if not started: configure_pulp_grinder_logging() configure_audit_logging() started = True | def start_logging(): """ Convenience function to start pulp's different logging mechanisms. """ assert config.config is not None global started if started: return configure_pulp_grinder_logging() configure_audit_logging() started = True | 454,159 |
def stop_logging(): """ Convenience function to stop pulp's different logging mechanisms. """ global started if started: logging.shutdown() started = False | def stop_logging(): """ Convenience function to stop pulp's different logging mechanisms. """ global started if not started: return logging.shutdown() logging.Logger.manager.loggerDict = {} started = False | 454,160 |
def run(self): id = self.get_required_option('id') repo = self.pconn.repository(id) syncs = self.pconn.sync_list(id) print _('repository: %s') % repo['id'] print _('number of packages: %d') % repo['package_count'] last_sync = 'never' if repo['last_sync'] is None else str(repo['last_sync']) print _('last sync: %s') % la... | def run(self): id = self.get_required_option('id') repo = self.pconn.repository(id) syncs = self.pconn.sync_list(id) print _(' repository: %s') % repo['id'] print _(' number of packages: %d') % repo['package_count'] last_sync = repo['last_sync'] if last_sync is None: last_sync = 'never' else: last_sync = str(parse_date... | 454,161 |
def immutable_groups(self): #TODO until we fix group import, this tests needs to be commented out | def immutable_groups(self): #TODO until we fix group import, this tests needs to be commented out | 454,162 |
def immutable_groups(self): #TODO until we fix group import, this tests needs to be commented out | def immutable_groups(self): #TODO until we fix group import, this tests needs to be commented out | 454,163 |
def immutable_groups(self): #TODO until we fix group import, this tests needs to be commented out | def immutable_groups(self): #TODO until we fix group import, this tests needs to be commented out | 454,164 |
def immutable_groups(self): #TODO until we fix group import, this tests needs to be commented out | def immutable_groups(self): #TODO until we fix group import, this tests needs to be commented out | 454,165 |
def immutable_groups(self): #TODO until we fix group import, this tests needs to be commented out | def immutable_groups(self): #TODO until we fix group import, this tests needs to be commented out | 454,166 |
def immutable_groups(self): #TODO until we fix group import, this tests needs to be commented out | def immutable_groups(self): #TODO until we fix group import, this tests needs to be commented out | 454,167 |
def check_user_pass_on_ldap(self, username, password=None): ''' verify the credentials for user on ldap server. @param username: Userid to be validated on ldap server @param password: password credentials for userid @return: user instance of the authenticated user if valid credentials were specified; None otherwise @rt... | def check_user_pass_on_ldap(self, username, password=None): ''' verify the credentials for user on ldap server. @param username: Userid to be validated on ldap server @param password: password credentials for userid @return: user instance of the authenticated user if valid credentials were specified; None otherwise @rt... | 454,168 |
def check_user_pass_on_ldap(self, username, password=None): ''' verify the credentials for user on ldap server. @param username: Userid to be validated on ldap server @param password: password credentials for userid @return: user instance of the authenticated user if valid credentials were specified; None otherwise @rt... | def check_user_pass_on_ldap(self, username, password=None): ''' verify the credentials for user on ldap server. @param username: Userid to be validated on ldap server @param password: password credentials for userid @return: user instance of the authenticated user if valid credentials were specified; None otherwise @rt... | 454,169 |
def POST(self, id): """ @return: True on successful update of repository meta data """ repo = self.input() API.update(repo) return self.output(True) | def POST(self, id): """ @return: True on successful update of repository meta data """ repo_data = self.input() repo_data['id'] = id API.update(repo_data) return self.output(True) | 454,170 |
def is_superuser(user): """ Return True if the user is a super user @type user: L{pulp.server.db.model.User} instance @param user: user to check @rtype: bool @return: True if the user is a super user, False otherwise """ return super_user_role in user.roles | def is_superuser(user): """ Return True if the user is a super user @type user: L{pulp.server.db.model.User} instance @param user: user to check @rtype: bool @return: True if the user is a super user, False otherwise """ return super_user_role in user['roles'] | 454,171 |
def PUT(self): """ Create a new repository. @return: repository meta data on successful creation of repository """ repo_data = self.params() | def PUT(self): """ Create a new repository. @return: repository meta data on successful creation of repository """ repo_data = self.params() | 454,172 |
def description(self): """ Return a string showing the command's description """ return - ('no description available') | def description(self): """ Return a string showing the command's description """ return - ('no description available') | 454,173 |
def description(self): """ Return a string for this action's description return _('no description available') """ | def description(self): Return a string for this action's description return _('no description available') """ | 454,174 |
def _status_path(self, id): """ Construct a URL path that can be used to poll a task's status A status path is constructed as follows: /<collection>/<object id>/<action>/<action id>/ A GET request sent to this path will get a JSON encoded status object """ parts = web.ctx.path.split('/') if parts[-2] == id: return web.... | def _status_path(self, id): """ Construct a URL path that can be used to poll a task's status A status path is constructed as follows: /<collection>/<object id>/<action>/<action id>/ A GET request sent to this path will get a JSON encoded status object """ parts = web.ctx.path.split('/') if parts[-2] == id: return web.... | 454,175 |
def test_consumerwithpackage(self): c = self.capi.create('test-consumer', 'some consumer desc') c.packageids.append(package["packageid"]) for i in range(10): repo = self.rapi.create('some-id','some name', 'i386', 'yum:http://example.com') package = self.rapi.create_package(repo.id, 'test_consumerwithpackage', 'test pac... | def test_consumerwithpackage(self): c = self.capi.create('test-consumer', 'some consumer desc') repo = self.rapi.create('some-id', 'some name', 'i386', 'yum:http://example.com') for i in range(10): repo = self.rapi.create('some-id','some name', 'i386', 'yum:http://example.com') package = self.rapi.create_package(repo.i... | 454,176 |
def test_consumerwithpackage(self): c = self.capi.create('test-consumer', 'some consumer desc') c.packageids.append(package["packageid"]) for i in range(10): repo = self.rapi.create('some-id','some name', 'i386', 'yum:http://example.com') package = self.rapi.create_package(repo.id, 'test_consumerwithpackage', 'test pac... | def test_consumerwithpackage(self): c = self.capi.create('test-consumer', 'some consumer desc') c.packageids.append(package["packageid"]) for i in range(10): package = self.rapi.create_package(repo["id"], 'test_consumerwithpackage', 'test package search') repo = self.rapi.repository(repo["id"]) c.packageids.append(pack... | 454,177 |
def test_consumerwithpackage(self): c = self.capi.create('test-consumer', 'some consumer desc') c.packageids.append(package["packageid"]) for i in range(10): repo = self.rapi.create('some-id','some name', 'i386', 'yum:http://example.com') package = self.rapi.create_package(repo.id, 'test_consumerwithpackage', 'test pac... | def test_consumerwithpackage(self): c = self.capi.create('test-consumer', 'some consumer desc') c.packageids.append(package["packageid"]) for i in range(10): repo = self.rapi.create('some-id','some name', 'i386', 'yum:http://example.com') package = self.rapi.create_package(repo.id, 'test_consumerwithpackage', 'test pac... | 454,178 |
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(login=self.options.newusername, password=self.options.newpassword, na... | 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... | 454,179 |
def installpackages(self, id): """ Install packages. Body contains a list of package names. """ data = self.input() names = data.get('packagenames', []) return self.ok(API.installpackages(id, names)) | def installpackages(self, id): """ Install packages. Body contains a list of package names. """ data = self.params() names = data.get('packagenames', []) return self.ok(API.installpackages(id, names)) | 454,180 |
def test_query_invalid_consumer_id(self): # Test self.assertRaises(PulpException, self.consumer_history_api.query, consumer_id='foo') | def disabled_query_invalid_consumer_id(self): # Test self.assertRaises(PulpException, self.consumer_history_api.query, consumer_id='foo') | 454,181 |
def _populate_for_queries(self): ''' Populates the history store with a number of entries to help test the query functionality. ''' | def _populate_for_queries(self): ''' Populates the history store with a number of entries to help test the query functionality. ''' | 454,182 |
def __init__(self, host, port, apihandler, apiprefix='/pulp/api', cert_file=None, key_file=None, username=None, password=None): self.host = host # ensure we have an integer, httpslib is picky about the type # passed in for the port self.port = int(port) self.apihandler = ''.join((apiprefix, apihandler)) self.username =... | def __init__(self, host, port, apihandler, cert_file=None, key_file=None, username=None, password=None): self.host = host # ensure we have an integer, httpslib is picky about the type # passed in for the port self.port = int(port) self.apihandler = ''.join((apiprefix, apihandler)) self.username = username self.password... | 454,183 |
def __init__(self, host, port, apihandler, apiprefix='/pulp/api', cert_file=None, key_file=None, username=None, password=None): self.host = host # ensure we have an integer, httpslib is picky about the type # passed in for the port self.port = int(port) self.apihandler = ''.join((apiprefix, apihandler)) self.username =... | def __init__(self, host, port, apihandler, apiprefix='/pulp/api', cert_file=None, key_file=None, username=None, password=None): self.host = host # ensure we have an integer, httpslib is picky about the type # passed in for the port self.port = int(port) self.apihandler = apihandler self.username = username self.passwor... | 454,184 |
def __init__(self, host='localhost', port=443, handler="", cert_file=None, key_file=None, username=None, password=None): self.host = host self.port = port self.handler = handler self.conn = None self.cert_file = cert_file self.key_file = key_file self.username = username self.password = password # initialize connection... | def __init__(self, host='localhost', port=443, handler="/pulp/api", cert_file=None, key_file=None, username=None, password=None): self.host = host self.port = port self.handler = handler self.conn = None self.cert_file = cert_file self.key_file = key_file self.username = username self.password = password # initialize c... | 454,185 |
def setUp(self): self.conn = Restlib(self.host, self.port, self.handler, cert_file=self.cert_file, key_file=self.key_file, username=self.username, password=self.password) log.info("Connection Established for cli: Host: %s, Port: %s, handler: %s" % (self.host, self.port, self.handler)) log.info("Using cert_file: %s and ... | def setUp(self): self.conn = Restlib(self.host, self.port, self.handler, self.cert_file, self.key_file, self.username, self.password) log.info("Connection Established for cli: Host: %s, Port: %s, handler: %s" % (self.host, self.port, self.handler)) log.info("Using cert_file: %s and key_file: %s" % (self.cert_file, self... | 454,186 |
def check_roles(*fargs, **kw): ''' Strip off the decorator arguments so we can use those to check the Roles of the current caller. | def check_roles(*fargs, **kw): ''' Strip off the decorator arguments so we can use those to check the Roles of the current caller. | 454,187 |
def test_sync(self): repo = self.rapi.create('some-id','some name', 'i386', 'yum:http://mmccune.fedorapeople.org/pulp/') failed = False try: self.rapi.sync('invalid-id-not-found') except Exception: failed = True assert(failed) self.rapi.sync(repo['id']) # Check that local storage has dir and rpms dirList = os.listdir... | def test_sync(self): repo = self.rapi.create('some-id','some name', 'i386', 'yum:http://mmccune.fedorapeople.org/pulp/') failed = False try: self.rapi.sync('invalid-id-not-found') except Exception: failed = True assert(failed) self.rapi.sync(repo['id']) # Check that local storage has dir and rpms dirList = os.listdir... | 454,188 |
def _get_cert_options(self): cacert = self.opts.cacert cert = self.opts.cert key = self.opts.key if not (cacert and cert and key): return None return {"ca": utils.readFile(cacert), "cert": utils.readFile(cert), "key": utils.readFile(key)} | def _get_cert_options(self): cacert = self.opts.cacert cert = self.opts.cert key = getattr(self.opts, 'key', None) if not (cacert and cert and key): return None return {"ca": utils.readFile(cacert), "cert": utils.readFile(cert), "key": utils.readFile(key)} | 454,189 |
def writeToFile(filename, message, overwrite=True): dir_name = os.path.dirname(filename) if not os.access(dir_name, os.W_OK): os.mkdir(dir_name) if os.access(filename, os.F_OK) and not overwrite: # already have file there; let's back it up try: os.rename(filename, filename + '.save') except: return False fd = os.open(... | def writeToFile(filename, message, overwrite=True): dir_name = os.path.dirname(filename) if not os.access(dir_name, os.W_OK): os.mkdir(dir_name) if os.access(filename, os.F_OK) and not overwrite: # already have file there; let's back it up try: os.rename(filename, filename + '.save') except: return False fd = os.open(... | 454,190 |
def __init__(self, is_admin=True, actions=None): usage = "usage: %prog consumer [OPTIONS]" shortdesc = "consumer specific actions to pulp server." desc = "" self.name = "consumer" self.actions = actions or {"delete" : "Delete the consumer", "update" : "Update consumer profile", "list" : "List of ... | def __init__(self, is_admin=True, actions=None): usage = "consumer [OPTIONS]" shortdesc = "consumer specific actions to pulp server." desc = "" self.name = "consumer" self.actions = actions or {"delete" : "Delete the consumer", "update" : "Update consumer profile", "list" : "List of accessible co... | 454,191 |
def giveNamedItem( userid, item_name ): # Get the player instance pPlayer = spe.getPlayer(int(userid)) # Is the player instance valid? if not pPlayer: # Return False since the player instance was not valid return False # Give the player the item spe.call('GiveNamedItem', pPlayer, str(item_name)) return True | def giveNamedItem( userid, item_name ): # Get the player instance pPlayer = spe.getPlayer(int(userid)) # Is the player instance valid? if not pPlayer: # Return False since the player instance was not valid return False # Give the player the item return spe.call('GiveNamedItem', pPlayer, str(item_name), 0) | 454,192 |
def giveNamedItem( userid, item_name ): # Get the player instance pPlayer = spe.getPlayer(int(userid)) # Is the player instance valid? if not pPlayer: # Return False since the player instance was not valid return False # Give the player the item return spe.call('GiveNamedItem', pPlayer, str(item_name), 0) | def giveNamedItem( userid, item_name ): # Get the player instance pPlayer = spe.getPlayer(int(userid)) # Is the player instance valid? if not pPlayer: # Return False since the player instance was not valid return None # Give the player the item return spe.call('GiveNamedItem', pPlayer, str(item_name), 0) | 454,193 |
def removeEntityByIndex( entity_index ): # Get entity instance pEntity = entityByIndex( int(entity_index) ) # Make sure it's valid if not pEntity: # Return false if the entity was None. return False # Remove it! spe.call("Remove", pEntity) return True | def removeEntityByIndex( entity_index ): # Get entity instance pEntity = spe.getEntityOfIndex( int(entity_index) ) # Make sure it's valid if not pEntity: # Return false if the entity was None. return False # Remove it! spe.call("Remove", pEntity) return True | 454,194 |
def setStringKeyvalue( entity_index, keyvalue_name, new_value ): # Get entity instance pEntity = entityByIndex( int(entity_index) ) # Make sure the entity is valid if not pEntity: # Return False if the entity was None. return False # Set the keyvalue spe.call("setkv_string", pEntity, keyvalue_name, new_value) return... | def setStringKeyvalue( entity_index, keyvalue_name, new_value ): # Get entity instance pEntity = spe.getEntityOfIndex( int(entity_index) ) # Make sure the entity is valid if not pEntity: # Return False if the entity was None. return False # Set the keyvalue spe.call("setkv_string", pEntity, keyvalue_name, new_value) ... | 454,195 |
def sigrokdecode_i2c(inbuf): """I2C protocol decoder""" # FIXME: This should be passed in as metadata, not hardcoded here. signals = (2, 5) channels = 8 o = wr = ack = d = '' bitcount = data = 0 state = 'IDLE' # Get the bit number (and thus probe index) of the SCL/SDA signals. scl_bit, sda_bit = signals # Get SCL/S... | def sigrokdecode_i2c(inbuf): """I2C protocol decoder""" # FIXME: This should be passed in as metadata, not hardcoded here. signals = (2, 5) channels = 8 o = wr = ack = d = '' bitcount = data = 0 IDLE, START, ADDRESS, DATA = range(4) state = IDLE # Get the bit number (and thus probe index) of the SCL/SDA signals. scl... | 454,196 |
def sigrokdecode_i2c(inbuf): """I2C protocol decoder""" # FIXME: This should be passed in as metadata, not hardcoded here. signals = (2, 5) channels = 8 o = wr = ack = d = '' bitcount = data = 0 state = 'IDLE' # Get the bit number (and thus probe index) of the SCL/SDA signals. scl_bit, sda_bit = signals # Get SCL/S... | def sigrokdecode_i2c(inbuf): """I2C protocol decoder""" # FIXME: This should be passed in as metadata, not hardcoded here. signals = (2, 5) channels = 8 o = wr = ack = d = '' bitcount = data = 0 state = 'IDLE' # Get the bit number (and thus probe index) of the SCL/SDA signals. scl_bit, sda_bit = signals # Get SCL/S... | 454,197 |
def sigrokdecode_i2c(inbuf): """I2C protocol decoder""" # FIXME: This should be passed in as metadata, not hardcoded here. signals = (2, 5) channels = 8 o = wr = ack = d = '' bitcount = data = 0 state = 'IDLE' # Get the bit number (and thus probe index) of the SCL/SDA signals. scl_bit, sda_bit = signals # Get SCL/S... | def sigrokdecode_i2c(inbuf): """I2C protocol decoder""" # FIXME: This should be passed in as metadata, not hardcoded here. signals = (2, 5) channels = 8 o = wr = ack = d = '' bitcount = data = 0 state = 'IDLE' # Get the bit number (and thus probe index) of the SCL/SDA signals. scl_bit, sda_bit = signals # Get SCL/S... | 454,198 |
def sigrokdecode_i2c(inbuf): """I2C protocol decoder""" # FIXME: This should be passed in as metadata, not hardcoded here. signals = (2, 5) channels = 8 o = wr = ack = d = '' bitcount = data = 0 state = 'IDLE' # Get the bit number (and thus probe index) of the SCL/SDA signals. scl_bit, sda_bit = signals # Get SCL/S... | def sigrokdecode_i2c(inbuf): """I2C protocol decoder""" # FIXME: This should be passed in as metadata, not hardcoded here. signals = (2, 5) channels = 8 o = wr = ack = d = '' bitcount = data = 0 state = 'IDLE' # Get the bit number (and thus probe index) of the SCL/SDA signals. scl_bit, sda_bit = signals # Get SCL/S... | 454,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.