You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The splunk_api_username and splunk_api_password keys in contentctl.yml should be allowed to be provided as environment variables, to avoid putting credentials in YAML files.
Here is a git patch file that adds this change:
From f74ae37c6ec9e3b5da84029cb3afade71cca48f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89milio=20Gonzalez?= <[email protected]>
Date: Mon, 4 Nov 2024 20:34:30 +0000
Subject: Merged PR 114299: Allow test.splunk_api_username and
test.splunk_api_password to be specified w...
Allow test.splunk_api_username and test.splunk_api_password to be specified with environment variables SPLUNKBASE_USERNAME and SPLUNKBASE_PASSWORD to avoid putting credentials in YAML files.
---
contentctl/objects/config.py | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/contentctl/objects/config.py b/contentctl/objects/config.py
index cbf6929..4228ba9 100644
--- a/contentctl/objects/config.py
+++ b/contentctl/objects/config.py
@@ -1,5 +1,6 @@
from __future__ import annotations
+import os
from os import environ
from datetime import datetime, UTC
from typing import Optional, Any, List, Union, Self
@@ -830,10 +831,17 @@ class test(test_common):
model_config = ConfigDict(use_enum_values=True,validate_default=True, arbitrary_types_allowed=True)
container_settings:ContainerSettings = ContainerSettings()
test_instances: List[Container] = Field([], exclude = True, validate_default=True)
- splunk_api_username: Optional[str] = Field(default=None, exclude = True,description="Splunk API username used for running appinspect or installating apps from Splunkbase")
- splunk_api_password: Optional[str] = Field(default=None, exclude = True, description="Splunk API password used for running appinspect or installaing apps from Splunkbase")
-
-
+ splunk_api_username: Optional[str] = Field(default=None, exclude = True,description="Splunk API username used for running appinspect or installating apps from Splunkbase. Can be replaced by the 'SPLUNKBASE_USERNAME' environment variable.")
+ splunk_api_password: Optional[str] = Field(default=None, exclude = True, description="Splunk API password used for running appinspect or installaing apps from Splunkbase. Can be replaced by the 'SPLUNKBASE_PASSWORD' environment variable.")
+
+ def __init__(self, **kwargs):
+ if "SPLUNKBASE_USERNAME" in os.environ:
+ breakpoint()
+ kwargs['splunk_api_username'] = os.environ["SPLUNKBASE_USERNAME"]
+ if "SPLUNKBASE_PASSWORD" in os.environ:
+ kwargs['splunk_api_password'] = os.environ["SPLUNKBASE_PASSWORD"]
+ super().__init__(**kwargs)
+
def getContainerInfrastructureObjects(self)->Self:
try:
self.test_instances = self.container_settings.getContainers()
--
2.34.1
To fix bugs and add features in a timely manner, I maintain a private fork of contentctl and the content has drifted, so I cannot easily open a PR at the moment for this feature, but would like it to be included upstream.
The text was updated successfully, but these errors were encountered:
Sorry for the delay in getting to this, as we have been helping out with some internal Splunk releases.
Thank you @Res260 , you have been hard at work with some AWESOME fixes and improvements. I admit that downloading apps from Splunkbase is a feature that used to work, but we have not used (or tested it) in quite some time. Thanks for exposing all these issue. I am going to merge all the following fixes/PRs down to a single new branch for evaluation.
The
splunk_api_username
andsplunk_api_password
keys incontentctl.yml
should be allowed to be provided as environment variables, to avoid putting credentials in YAML files.Here is a git patch file that adds this change:
To fix bugs and add features in a timely manner, I maintain a private fork of contentctl and the content has drifted, so I cannot easily open a PR at the moment for this feature, but would like it to be included upstream.
The text was updated successfully, but these errors were encountered: