mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-09-20 01:06:03 +02:00
Solved testing mode bug
This commit is contained in:
@@ -17,6 +17,7 @@ def run_ansible_playbook(
|
|||||||
password_file=None,
|
password_file=None,
|
||||||
verbose=0,
|
verbose=0,
|
||||||
skip_build=False,
|
skip_build=False,
|
||||||
|
skip_tests=False,
|
||||||
logs=False
|
logs=False
|
||||||
):
|
):
|
||||||
start_time = datetime.datetime.now()
|
start_time = datetime.datetime.now()
|
||||||
@@ -56,9 +57,8 @@ def run_ansible_playbook(
|
|||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
print("\n❌ Inventory validation failed. Deployment aborted.\n", file=sys.stderr)
|
print("\n❌ Inventory validation failed. Deployment aborted.\n", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Tests are controlled via MODE_TEST
|
if not skip_tests:
|
||||||
if modes.get("MODE_TEST", False):
|
|
||||||
print("\n🧪 Running tests (make messy-test)...\n")
|
print("\n🧪 Running tests (make messy-test)...\n")
|
||||||
subprocess.run(["make", "messy-test"], check=True)
|
subprocess.run(["make", "messy-test"], check=True)
|
||||||
|
|
||||||
@@ -255,6 +255,12 @@ def main():
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
help="Skip running 'make build' before deployment.",
|
help="Skip running 'make build' before deployment.",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-t",
|
||||||
|
"--skip-tests",
|
||||||
|
action="store_true",
|
||||||
|
help="Skip running 'make messy-tests' before deployment.",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-i",
|
"-i",
|
||||||
"--id",
|
"--id",
|
||||||
@@ -301,6 +307,7 @@ def main():
|
|||||||
password_file=args.password_file,
|
password_file=args.password_file,
|
||||||
verbose=args.verbose,
|
verbose=args.verbose,
|
||||||
skip_build=args.skip_build,
|
skip_build=args.skip_build,
|
||||||
|
skip_tests=args.skip_tests,
|
||||||
logs=args.logs,
|
logs=args.logs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
# Mode
|
# Mode
|
||||||
|
|
||||||
# The following modes can be combined with each other
|
# The following modes can be combined with each other
|
||||||
MODE_TEST: false # Executes test routines instead of productive routines
|
MODE_DUMMY: false # Executes dummy/test routines instead of productive routines
|
||||||
MODE_UPDATE: true # Executes updates
|
MODE_UPDATE: true # Executes updates
|
||||||
MODE_DEBUG: false # This enables debugging in ansible and in the apps, You SHOULD NOT enable this on production servers
|
MODE_DEBUG: false # This enables debugging in ansible and in the apps, You SHOULD NOT enable this on production servers
|
||||||
MODE_RESET: false # Cleans up all Infinito.Nexus files. It's necessary to run to whole playbook and not particial roles when using this function.
|
MODE_RESET: false # Cleans up all Infinito.Nexus files. It's necessary to run to whole playbook and not particial roles when using this function.
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
--letsencrypt-webroot-path "{{ LETSENCRYPT_WEBROOT_PATH }}"
|
--letsencrypt-webroot-path "{{ LETSENCRYPT_WEBROOT_PATH }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ '--mode-test' if MODE_TEST | bool else '' }}
|
{{ '--mode-test' if MODE_DUMMY | bool else '' }}
|
||||||
register: certbundle_result
|
register: certbundle_result
|
||||||
changed_when: >
|
changed_when: >
|
||||||
('certificate not yet due for renewal' not in (certbundle_result.stdout | lower | default('')))
|
('certificate not yet due for renewal' not in (certbundle_result.stdout | lower | default('')))
|
||||||
|
Reference in New Issue
Block a user