Skip to content

Commit

Permalink
repect validate_certs
Browse files Browse the repository at this point in the history
  • Loading branch information
BeArchiTek committed Sep 6, 2024
1 parent bb16e8e commit b7495de
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
5 changes: 1 addition & 4 deletions plugins/action/artifact_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ def run(self, tmp=None, task_vars=None):
try:
Display().v("Initializing Infrahub Client")
client = InfrahubclientWrapper(
api_endpoint=api_endpoint,
token=token,
branch=branch,
timeout=timeout,
api_endpoint=api_endpoint, token=token, branch=branch, timeout=timeout, validate_certs=validate_certs
)
Display().v("Fetch Artifacts")
result = client.fetch_single_artifact(filters=filters)
Expand Down
5 changes: 1 addition & 4 deletions plugins/action/query_graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ def run(self, tmp=None, task_vars=None):
try:
Display().v("Initializing Infrahub Client")
client = InfrahubclientWrapper(
api_endpoint=api_endpoint,
token=token,
branch=branch,
timeout=timeout,
api_endpoint=api_endpoint, token=token, branch=branch, timeout=timeout, validate_certs=validate_certs
)
processor = InfrahubQueryProcessor(client=client)
Display().v("Processing Query")
Expand Down
1 change: 1 addition & 0 deletions plugins/inventory/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ def main(self):
branch=self.branch,
token=self.token,
timeout=self.timeout,
validate_certs=self.validate_certs,
)
processor = InfrahubNodesProcessor(client=client)
self.display.v("Processing Nodes request")
Expand Down
1 change: 1 addition & 0 deletions plugins/lookup/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def run(self, terms, variables=None, query=None, graph_variables=None, **kwargs)
token=token,
branch=branch,
timeout=timeout,
validate_certs=validate_certs,
)
processor = InfrahubQueryProcessor(client=client)
Display().v("Processing Query")
Expand Down
11 changes: 9 additions & 2 deletions plugins/module_utils/infrahub_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@
TYPE_MAPPING = {"str": str, "int": int, "float": float, "bool": bool}

class InfrahubclientWrapper:
def __init__(self, api_endpoint: str, branch: str, token: str, timeout: Optional[int] = 10):
def __init__(
self,
api_endpoint: str,
branch: str,
token: str,
timeout: Optional[int] = 10,
validate_certs: Optional[str] = True,
):
"""
Initializes InfrahubclientWrapper.
Expand All @@ -44,7 +51,7 @@ def __init__(self, api_endpoint: str, branch: str, token: str, timeout: Optional
"""
self.client = InfrahubClientSync(
address=api_endpoint,
config=Config(api_token=token, timeout=timeout, default_branch=branch),
config=Config(api_token=token, timeout=timeout, default_branch=branch, tls_insecure=not validate_certs),
)
self.branch_manager = InfrahubBranchManagerSync(self.client)

Expand Down

0 comments on commit b7495de

Please sign in to comment.