-
-
Save grahamc/4d0411a63006b72340e621d02dd2f952 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 | |
""" | |
- code: int = self.run_command( | |
- "systemctl start deploy-complete.target", check=False | |
- ) | |
- if code == 0: | |
- return True | |
- elif code == 5: | |
- return True | |
- else: | |
- return False | |
+ 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( | |
+ f"systemctl start {name}.target", check=False | |
+ ) | |
+ if code == 0: | |
+ return True | |
+ elif code == 5: | |
+ return True | |
+ else: | |
+ return False | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment