Created
March 9, 2020 20:11
-
-
Save grahamc/a64bab1c569c9b331e6664c19c8418b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mark_deploy_complete(self) -> bool: | |
""" | |
Starts the target "deploy-complete.target". | |
+ """ | |
- If the return code is 0: deploy-complete.target is started | |
- If the return code is 5: deploy-complete.target doesn't exist (success) | |
- otherwise: don't deploy | |
+ return self._start_optional_target("deploy-complete") | |
+ | |
+ def _start_optional_target(self, name: str) -> bool: | |
+ """ | |
+ Starts a passed target. The passed name will have ".target" appended to it. | |
+ | |
+ If the return code is 0: {name}.target: true | |
+ If the return code is 5: {name}.target doesn't exist: true | |
+ otherwise: false | |
""" | |
code: int = self.run_command( | |
- "systemctl start deploy-complete.target", check=False | |
+ f"systemctl start {name}.target", check=False | |
) | |
if code == 0: | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment