Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added handle_error for mdx_server, and logging configurations #4048

Merged
merged 25 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
aa7f619
Added handle_error for mdx_server, and logging configurations
anas-yousef Feb 15, 2024
f751006
Added changelog
anas-yousef Feb 15, 2024
f340aaf
black formatting
anas-yousef Feb 15, 2024
1ef5ba8
Merge branch 'master' into ay-add-handle-error-to-mdx-server
anas-yousef Feb 15, 2024
54e0db9
Merge branch 'ay-add-handle-error-to-mdx-server' of github.com:demist…
anas-yousef Feb 15, 2024
68e5ea3
Added error code
anas-yousef Feb 15, 2024
62c095d
Ran black
anas-yousef Feb 15, 2024
c25883a
Raise exception
anas-yousef Feb 18, 2024
651912b
Merge branch 'master' of github.com:demisto/demisto-sdk into ay-add-h…
anas-yousef Feb 18, 2024
b68e74d
Ran pre-commit
anas-yousef Feb 18, 2024
0aab01a
Reverted to handle_error
anas-yousef Feb 19, 2024
ebc5cfe
Merge branch 'master' of github.com:demisto/demisto-sdk into ay-add-h…
anas-yousef Feb 19, 2024
e01a715
Using handle error
anas-yousef Feb 19, 2024
709a84e
Ran pre-commit
anas-yousef Feb 19, 2024
8137dfa
Merge branch 'master' of github.com:demisto/demisto-sdk into ay-add-h…
anas-yousef Feb 19, 2024
28d6d8e
Added logger info
anas-yousef Feb 19, 2024
5c30545
Updated README
anas-yousef Feb 19, 2024
13f0f67
Updated message
anas-yousef Feb 19, 2024
4f8e4ae
Merge branch 'master' of github.com:demisto/demisto-sdk into ay-add-h…
anas-yousef Feb 19, 2024
a73a3b7
Ran pre-commit
anas-yousef Feb 19, 2024
abb54c3
Fixed error message
anas-yousef Feb 21, 2024
bfe75a7
Ran pre-commit
anas-yousef Feb 21, 2024
cf20daa
Merge branch 'master' into ay-add-handle-error-to-mdx-server
anas-yousef Feb 21, 2024
01fec1a
Deleted useless line
anas-yousef Feb 21, 2024
52225fd
Merge branch 'ay-add-handle-error-to-mdx-server' of github.com:demist…
anas-yousef Feb 21, 2024
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
4 changes: 4 additions & 0 deletions .changelog/4048.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changes:
- description: Fixed an issue where **validate** would fail from trying to connect to MDX server without stating the reason.
anas-yousef marked this conversation as resolved.
Show resolved Hide resolved
type: fix
pr_number: 4048
4 changes: 4 additions & 0 deletions demisto_sdk/commands/common/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,10 @@
"code": "RM114",
"related_field": "",
},
"cannot_connect_to_mdx_server": {
"code": "RM115",
"related_field": "",
},
# RN - Release Notes
"missing_release_notes": {
"code": "RN100",
Expand Down
13 changes: 11 additions & 2 deletions demisto_sdk/commands/common/hook_validations/readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,14 @@ def is_valid_file(self) -> bool:
def mdx_verify_server(self) -> bool:
server_started = mdx_server_is_up()
if not server_started:
return False
if self.handle_error(
"Could not start MDX server",
error_code="RM115",
file_path=self.file_path,
):
return False
# In case this error_code should be skipped or ignored
return True
for _ in range(RETRIES_VERIFY_MDX):
try:
readme_content = self.fix_mdx()
Expand Down Expand Up @@ -406,7 +413,9 @@ def is_docker_available():
bool: True if the daemon is accessible
"""
try:
docker_client: docker.DockerClient = init_global_docker_client(log_prompt="DockerPing") # type: ignore
docker_client: docker.DockerClient = init_global_docker_client(
log_prompt="DockerPing"
) # type: ignore
dorschw marked this conversation as resolved.
Show resolved Hide resolved
docker_client.ping()
return True
except Exception:
Expand Down
8 changes: 7 additions & 1 deletion demisto_sdk/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
YAMLContentUnifiedObject,
)
from demisto_sdk.commands.common.content.objects.pack_objects.pack import Pack
from demisto_sdk.commands.common.logger import logger

ContentEntity = Union[YAMLContentUnifiedObject, YAMLContentObject, JSONContentObject]

Expand All @@ -38,7 +39,12 @@ def check_configuration_file(command, args):
try:
config = ConfigParser(allow_no_value=True)
config.read(config_file_path)

config_sections = {
section: dict(config[section]) for section in config.sections()
}
logger.info(
f"[yellow].demisto-sdk-conf sections={config_sections}[/yellow]"
)
if command in config.sections():
for key in config[command]:
if key in args:
Expand Down
Loading