Last active
August 29, 2015 14:14
-
-
Save abutcher/ba3f11b0b38e6f909934 to your computer and use it in GitHub Desktop.
*explosions*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import logging | |
| from pulp.bindings.server import PulpConnection | |
| from pulp.bindings.base import PulpAPI | |
| from pulp.bindings.repository import RepositoryAPI | |
| from pulp.bindings.auth import UserAPI | |
| class Juicer(object): | |
| def __init__(self): | |
| self.config = { | |
| 'hostname': 'A_PULP_HOST', | |
| 'port': 443, | |
| 'username': 'USER', | |
| 'password': 'PASSWORD', | |
| 'verify_ssl': False, | |
| 'cert_filename': None, | |
| 'ca_path': 'A_REAL_CERTIFICATE_FOR_SOME_REASON', | |
| 'call_log': None, | |
| 'logger': None | |
| } | |
| logger = logging.getLogger(__name__) | |
| logger.setLevel(logging.INFO) | |
| self.conn = PulpConnection( | |
| self.config['hostname'], | |
| self.config['port'], | |
| username = self.config['username'], | |
| password = self.config['password'], | |
| cert_filename = self.config['cert_filename'], | |
| logger = logger, | |
| api_responses_logger = self.config['call_log'], | |
| verify_ssl = self.config['verify_ssl'], | |
| ca_path = self.config['ca_path']) | |
| def list_repos(self): | |
| repo = RepositoryAPI(self.conn) | |
| print repo.repositories(()) | |
| def list_users(self): | |
| user = UserAPI(self.conn) | |
| print user.users() | |
| if __name__ == '__main__': | |
| Juicer().list_repos() | |
| Juicer().list_users() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment