Skip to content

Commit

Permalink
Temporarily generate dynamic username
Browse files Browse the repository at this point in the history
and password for local deployment testing.
  • Loading branch information
pyth0n1c committed Jul 12, 2023
1 parent f8ede0e commit 08650e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions contentctl/actions/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import pathlib
from dataclasses import dataclass
from contentctl.objects.config import Config, TestConfig
from contentctl.objects.config import Config, TestConfig, PASSWORD
from contentctl.output.yml_writer import YmlWriter

@dataclass(frozen=True)
Expand All @@ -16,7 +16,9 @@ class Initialize:
def execute(self, input_dto: InitializeInputDto) -> None:

c = Config()
t = TestConfig.construct() #Disable validation for default object

t = TestConfig.construct(splunk_app_username="admin",
splunk_app_password= PASSWORD) #Disable validation for default object

config_as_dict = c.dict()
config_as_dict.pop("test")
Expand Down
8 changes: 6 additions & 2 deletions contentctl/objects/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
from typing import Union
from contentctl.objects.test_config import TestConfig

import string
import random
PASSWORD = ''.join([random.choice(string.ascii_letters + string.digits + string.punctuation) for i in range(16)])

class ConfigGlobal(BaseModel):
log_path: str
log_level: str
Expand Down Expand Up @@ -71,8 +75,8 @@ class ConfigDeployACS(ConfigDeploy):

class ConfigDeployRestAPI(ConfigDeploy):
port: int = 8089
username: str = CREDENTIAL_MISSING
password: str = CREDENTIAL_MISSING
username: str = "admin"
password: str = PASSWORD


class Deployments(BaseModel):
Expand Down

0 comments on commit 08650e9

Please sign in to comment.