Skip to content
Merged
Show file tree
Hide file tree
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
30 changes: 20 additions & 10 deletions contentctl/contentctl.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from contentctl.actions.initialize import Initialize
import traceback
import sys
import warnings
import pathlib
import tyro

from contentctl.actions.initialize import Initialize
from contentctl.objects.config import init, validate, build, new, deploy_acs, deploy_rest, test, test_servers, inspect, report, test_common, release_notes
from contentctl.actions.validate import Validate
from contentctl.actions.new_content import NewContent
Expand All @@ -9,14 +14,10 @@
DirectorOutputDto,
Build,
)

from contentctl.actions.test import Test
from contentctl.actions.test import TestInputDto
from contentctl.actions.reporting import ReportingInputDto, Reporting
from contentctl.actions.inspect import Inspect
import sys
import warnings
import pathlib
from contentctl.input.yml_reader import YmlReader
from contentctl.actions.release_notes import ReleaseNotes

Expand Down Expand Up @@ -183,7 +184,7 @@ def main():




config = None
try:
# Since some model(s) were constructed and not model_validated, we have to catch
# warnings again when creating the cli
Expand Down Expand Up @@ -220,9 +221,18 @@ def main():
else:
raise Exception(f"Unknown command line type '{type(config).__name__}'")
except Exception as e:
import traceback
traceback.print_exc()
traceback.print_stack()
#print(e)
if config is None:
print("There was a serious issue where the config file could not be created.\n"
"The entire stack trace is provided below (please include it if filing a bug report).\n")
traceback.print_exc()
elif config.verbose:
print("Verbose error logging is ENABLED.\n"
"The entire stack trace has been provided below (please include it if filing a bug report):\n")
traceback.print_exc()
else:
print("Verbose error logging is DISABLED.\n"
"Please use the --verbose command line argument if you need more context for your error or file a bug report.")
print(e)

sys.exit(1)

4 changes: 4 additions & 0 deletions contentctl/objects/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ class Config_Base(BaseModel):

path: DirectoryPath = Field(default=DirectoryPath("."), description="The root of your app.")
app:CustomApp = Field(default_factory=CustomApp)
verbose:bool = Field(default=False, description="Enable verbose error logging, including a stacktrace. "
"This option makes debugging contentctl errors much easier, but produces way more "
"output than is useful under most uses cases. "
"Please use this flag if you are submitting a bug report or issue on GitHub.")

@field_serializer('path',when_used='always')
def serialize_path(path: DirectoryPath)->str:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "contentctl"
version = "4.0.5"
version = "4.0.6"
description = "Splunk Content Control Tool"
authors = ["STRT <research@splunk.com>"]
license = "Apache 2.0"
Expand Down