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

Add mkdir command when using --junit #282

Merged
merged 2 commits into from
Oct 9, 2024
Merged

Conversation

mpagot
Copy link
Collaborator

@mpagot mpagot commented Oct 9, 2024

Add mkdir command to create the report folder later used by ansible-playbook to store junit reports.

Ticket: https://jira.suse.com/browse/TEAM-9713

Verification

INFO     Run:       'mkdir /tmp/results/'

Add mkdir command to create the report folder later used by
ansible-playbook to store junit reports.
@mpagot mpagot marked this pull request as ready for review October 9, 2024 09:24
@@ -281,6 +281,16 @@ def ansible_command_sequence(configure_data_ansible, base_project, sequence, ver
# 4. Start composing and accumulating the list of all needed commands
ansible_cmd = []
ansible_cmd_seq = []

if junit and not os.path.isdir(junit):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would write like this to be more readable:
`junit_specified = bool(junit)
junit_is_not_dir = not path.isdir(junit)

if junit_specified and junit_is_not_dir:`

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the more concise syntax here, but it is a matter of teste I think. So I'll wait other reviewers before to decide.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me it looks good but as you said it's a preference

Copy link
Contributor

@hadeskun hadeskun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One humble opinion

Copy link
Collaborator

@lpalovsky lpalovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

# the folder is not created.
# Create an empty folder in advance, if it is not already there
# so that the glue script called can always suppose that at least the folder is present.
ansible_cmd_seq.append({'cmd': ['mkdir', junit]})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add -p to the mkdir command:
-p, --parents no error if existing, make parent directories as needed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, and tested

Copy link
Collaborator

@alvarocarvajald alvarocarvajald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just commented on a typo in a comment.

if junit and not os.path.isdir(junit):
# This is the folder also used in the Ansible configuration JUNIT_OUTPUT_DIR.
# ansible-playbook is able to create it from its own but
# is a failure occur in the first sequence command, that is ansible and not ansible-playbook,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/is a failure occur/if a failure occurs/

@mpagot mpagot merged commit 7a4a639 into SUSE:main Oct 9, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants