Skip to content

Fix plugin deploy to respect return code from invoked bash scripts#373

Merged
PhillypHenning merged 10 commits intomainfrom
return_code_fix
Dec 12, 2022
Merged

Fix plugin deploy to respect return code from invoked bash scripts#373
PhillypHenning merged 10 commits intomainfrom
return_code_fix

Conversation

@PhillypHenning
Copy link
Copy Markdown
Contributor

Description

Updates the run_cmd function in utilities.py to respect the invoked bash script return code

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

This was tested locally by building a local bitops and mounting my local terraform plugin with the update to the plugin deploy.sh that makes it exit 1

Logs

+ exit 1
2022-12-07 17:27:54,304 root         ERROR <subprocess.Popen object at 0x7f59e1395be0>

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

@PhillypHenning
Copy link
Copy Markdown
Contributor Author

fixes #358

Copy link
Copy Markdown
Contributor

@arm4b arm4b left a comment

Choose a reason for hiding this comment

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

Considering we can only report error like this in the function itself, it's not helpful:

2022-12-07 17:27:54,304 root ERROR <subprocess.Popen object at 0x7f59e1395be0>

The error handling and reporting should be done on another layer, - code that's using this function. The function run_cmd returns a subprocess.CompletedProcess instance to be handled in next steps.

Here is the spot that might be missing an exit:

result = run_cmd(
[
plugin_deploy_language,
plugin_deploy_script_path,
stack_action,
]
)
if result.returncode == 0:
logger.info(f"\n~#~#~#~DEPLOYING OPS REPO [{deployment}] SUCCESSFULLY COMPLETED~#~#~#~")
else:
logger.warning(f"\n~#~#~#~DEPLOYING OPS REPO [{deployment}] FAILED~#~#~#~")

@arm4b arm4b added the bug 🪲 Something isn't working label Dec 7, 2022
@arm4b arm4b added this to the v2.3.0 milestone Dec 7, 2022
@PhillypHenning PhillypHenning requested a review from arm4b December 9, 2022 14:15
@PhillypHenning PhillypHenning requested a review from arm4b December 9, 2022 20:07
Copy link
Copy Markdown
Contributor

@arm4b arm4b left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the bug fixes 👍

@arm4b arm4b changed the title Updating run_cmd function to respect return code from invoked bash sc… Fix plugin deploy to respect return code from invoked bash scripts Dec 10, 2022
@PhillypHenning PhillypHenning enabled auto-merge (squash) December 12, 2022 21:54
@PhillypHenning PhillypHenning merged commit c2d96f1 into main Dec 12, 2022
@PhillypHenning PhillypHenning deleted the return_code_fix branch December 12, 2022 21:56
@PhillypHenning
Copy link
Copy Markdown
Contributor Author

Reason for auto-merge cancel
The effort of reworking install_plugins is way beyond this tickets scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🪲 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants