def new_pulp_client(self, **kwargs): """Creates and returns a new Pulp client with appropriate config.""" auth = None args = self._service_args if not args.pulp_fake and not args.pulp_url: LOG.error("At least one of --pulp-url or --pulp-fake must be provided") sys.exit(41) if args.pulp_fake: LOG.warning("Using a fake Pulp client, no changes will be made to Pulp!") return self.pulp_fake_controller.new_client() # checks if pulp password is available as environment variable if args.pulp_user: pulp_password = args.pulp_password or os.environ.get("PULP_PASSWORD") if not pulp_password: LOG.warning("No pulp password provided for %s", args.pulp_user) auth = (args.pulp_user, pulp_password) kwargs = kwargs.copy() kwargs["auth"] = auth if args.pulp_insecure: kwargs["verify"] = False # Thank you, but we don't need to hear about this for every single request warnings.filterwarnings("once", r"Unverified HTTPS request is being made") if args.pulp_throttle or os.environ.get("PULP_THROTTLE"): kwargs["task_throttle"] = args.pulp_throttle or pulp_throttle( os.environ.get("PULP_THROTTLE") ) return pulplib.Client(args.pulp_url, **kwargs)
def __get_instance(self): auth = None args = self._service_args # checks if pulp password is available as environment variable if args.pulp_user: pulp_password = args.pulp_password or os.environ.get( "PULP_PASSWORD") if not pulp_password: LOG.warning("No pulp password provided for %s", args.pulp_user) auth = (args.pulp_user, pulp_password) kwargs = {"auth": auth} if args.pulp_insecure: kwargs["verify"] = False # Thank you, but we don't need to hear about this for every single request warnings.filterwarnings("once", r"Unverified HTTPS request is being made") if args.pulp_throttle: kwargs["task_throttle"] = args.pulp_throttle return pulplib.Client(args.pulp_url, **kwargs)
def setup_pulp_client(parsed_args): pulp_kwargs = {"auth": (parsed_args.pulp_user, parsed_args.pulp_password)} if parsed_args.pulp_insecure: pulp_kwargs["verify"] = False pulp_c = pulplib.Client(parsed_args.pulp_url, **pulp_kwargs) return pulp_c