Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions contentctl/objects/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class App_Base(BaseModel,ABC):


def getSplunkbasePath(self)->HttpUrl:
return HttpUrl(SPLUNKBASE_URL.format(uid=self.uid, release=self.version))
return HttpUrl(SPLUNKBASE_URL.format(uid=self.uid, version=self.version))

@abstractmethod
def getApp(self, config:test, stage_file:bool=False)->str:
Expand All @@ -65,7 +65,7 @@ class TestApp(App_Base):
hardcoded_path: Optional[Union[FilePath,HttpUrl]] = Field(default=None, description="This may be a relative or absolute link to a file OR an HTTP URL linking to your app.")


@field_serializer('hardcoded_path',when_used='always')
@field_serializer('hardcoded_path',when_used='unless-none')
def serialize_path(path: Union[AnyUrl, pathlib.Path])->str:
return str(path)

Expand Down Expand Up @@ -830,10 +830,18 @@ 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: None | 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: None | 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: Any):
if "SPLUNKBASE_USERNAME" in environ:
kwargs['splunk_api_username'] = environ["SPLUNKBASE_USERNAME"]
if "SPLUNKBASE_PASSWORD" in environ:
kwargs['splunk_api_password'] = environ["SPLUNKBASE_PASSWORD"]
super().__init__(**kwargs)

def getContainerInfrastructureObjects(self)->Self:
try:
self.test_instances = self.container_settings.getContainers()
Expand Down
Loading