-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial attempts to automatically clean up dangling hosts
Now, when workflows fail, Broker will attempt to find a handgling host and check it in if found.
- Loading branch information
1 parent
f5b68dc
commit 8c7ce23
Showing
4 changed files
with
107 additions
and
6 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""Config migrations for versions older than 0.6.1 to 0.6.1. | ||
Copy this file to a new file in the same directory and modify it to create a new migration. | ||
The new file must be named `vX_Y_Z.py` where X_Y_Z is the version you are migrating to. | ||
e.g. cp example_migration.py v0_6_1.py | ||
""" | ||
|
||
from logzero import logger | ||
|
||
TO_VERSION = "0.6.1" | ||
|
||
|
||
def example_migration(config_dict): | ||
"""Migrations should modify the config_dict in place and return it.""" | ||
config_dict["example_key"] = "example_value" | ||
return config_dict | ||
|
||
|
||
def run_migrations(config_dict): | ||
"""Run all migrations.""" | ||
logger.info(f"Running config migrations for {TO_VERSION}.") | ||
config_dict = example_migration(config_dict) | ||
config_dict["_version"] = TO_VERSION | ||
return config_dict |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"""Config migrations for versions older than 0.6.3 to 0.6.3.""" | ||
|
||
from logzero import logger | ||
|
||
TO_VERSION = "0.6.3" | ||
|
||
|
||
def add_dangling_behavior(config_dict): | ||
"""Add the dangling_behavior config to AnsibleTower.""" | ||
if "AnsibleTower" in config_dict: | ||
if "dangling_behavior" not in config_dict["AnsibleTower"]: | ||
logger.debug("Adding dangling_behavior to AnsibleTower.") | ||
config_dict["AnsibleTower"]["dangling_behavior"] = "checkin" | ||
return config_dict | ||
|
||
|
||
def run_migrations(config_dict): | ||
"""Run all migrations.""" | ||
logger.info(f"Running config migrations for {TO_VERSION}.") | ||
config_dict = add_dangling_behavior(config_dict) | ||
config_dict["_version"] = TO_VERSION | ||
return config_dict |
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