diff --git a/manifester/manifester.py b/manifester/manifester.py index 3234f61..9433176 100644 --- a/manifester/manifester.py +++ b/manifester/manifester.py @@ -48,6 +48,7 @@ def access_token(self): def create_subscription_allocation(self): allocation_data = { "headers": {"Authorization": f"Bearer {self.access_token}"}, + "proxies": self.manifest_data.proxies, "params": { "name": f"{self.allocation_name}", "version": f"{self.sat_version}", @@ -72,6 +73,7 @@ def subscription_pools(self): _offset = 0 data = { "headers": {"Authorization": f"Bearer {self.access_token}"}, + "proxies": self.manifest_data.proxies, "params": {"offset": _offset}, } self._subscription_pools = simple_retry( @@ -93,6 +95,7 @@ def subscription_pools(self): ) data = { "headers": {"Authorization": f"Bearer {self.access_token}"}, + "proxies": self.manifest_data.proxies, "params": {"offset": _offset}, } offset_pools = simple_retry( @@ -113,6 +116,7 @@ def subscription_pools(self): def add_entitlements_to_allocation(self, pool_id, entitlement_quantity): data = { "headers": {"Authorization": f"Bearer {self.access_token}"}, + "proxies": self.manifest_data.proxies, "params": {"pool": f"{pool_id}", "quantity": f"{entitlement_quantity}"}, } add_entitlements = simple_retry( @@ -130,6 +134,7 @@ def verify_allocation_entitlements(self, entitlement_quantity, subscription_name ) data = { "headers": {"Authorization": f"Bearer {self.access_token}"}, + "proxies": self.manifest_data.proxies, "params": {"include": "entitlements"}, } self.entitlement_data = simple_retry( @@ -234,7 +239,10 @@ def process_subscription_pools(self, subscription_pools, subscription_data): ) def trigger_manifest_export(self): - headers = {"headers": {"Authorization": f"Bearer {self.access_token}"}} + data = { + "headers": {"Authorization": f"Bearer {self.access_token}"}, + "proxies": self.manifest_data.proxies, + } # Should this use the XDG Base Directory Specification? local_file = Path(f"manifests/{self.allocation_name}_manifest.zip") local_file.parent.mkdir(parents=True, exist_ok=True) @@ -246,7 +254,7 @@ def trigger_manifest_export(self): cmd_args=[ f"{self.manifest_data.url.allocations}/{self.allocation_uuid}/export" ], - cmd_kwargs=headers, + cmd_kwargs=data, ).json() export_job_id = trigger_export_job["body"]["exportJobID"] export_job = simple_retry( @@ -254,7 +262,7 @@ def trigger_manifest_export(self): cmd_args=[ f"{self.manifest_data.url.allocations}/{self.allocation_uuid}/exportJob/{export_job_id}" ], - cmd_kwargs=headers, + cmd_kwargs=data, ) request_count = 1 limit_exceeded = False @@ -264,7 +272,7 @@ def trigger_manifest_export(self): cmd_args=[ f"{self.manifest_data.url.allocations}/{self.allocation_uuid}/exportJob/{export_job_id}" ], - cmd_kwargs=headers, + cmd_kwargs=data, ) logger.debug( f"Attempting to export manifest. Attempt number: {request_count}" @@ -284,7 +292,7 @@ def trigger_manifest_export(self): manifest = simple_retry( requests.get, cmd_args=[f"{export_href}"], - cmd_kwargs=headers, + cmd_kwargs=data, ) logger.info( f"Writing manifest for subscription allocation {self.allocation_name} to location " diff --git a/manifester_settings.yaml.example b/manifester_settings.yaml.example index 519b373..f949757 100644 --- a/manifester_settings.yaml.example +++ b/manifester_settings.yaml.example @@ -18,6 +18,7 @@ manifest_category: url: token_request: "https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token" allocations: "https://api.access.redhat.com/management/v1/allocations" + proxies: {"https": ""} robottelo_automation: offline_token: "" sat_version: "sat-6.10" @@ -30,3 +31,4 @@ manifest_category: url: token_request: "https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token" allocations: "https://api.access.redhat.com/management/v1/allocations" + proxies: {"https": ""}