edd-tool 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: edd-tool
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: EDD deployment and plugin management tool
5
5
  Author-email: Ewan Barr <ebarr@mpifr-bonn.mpg.de>
6
6
  License: Copyright 2025 Ewan Barr
@@ -55,8 +55,8 @@ edd-tool --help
55
55
  $ edd-tool deploy --h
56
56
  usage: edd-tool deploy [-h] [--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [--site-repo SITE_REPO] [--version VERSION]
57
57
  [--deploy-dir DEPLOY_DIR] [--inventory INVENTORY] [--vault-pass-file VAULT_PASS_FILE]
58
- [--site-config SITE_CONFIG] [--plugin-install-method {galaxy,git-submodule}] [--no-pullremote]
59
- [--force] [--dry-run]
58
+ [--site-config SITE_CONFIG] [--plugin-install-method {galaxy,git-submodule}] [--no-pullremote] [--force]
59
+ [--dry-run] [--ansible-args ANSIBLE_ARGS]
60
60
  [config_profile]
61
61
 
62
62
  positional arguments:
@@ -81,6 +81,8 @@ options:
81
81
  --no-pullremote Skip pullremote tag
82
82
  --force Force overwrite of deployment directory
83
83
  --dry-run Dry run the deployment
84
+ --ansible-args ANSIBLE_ARGS
85
+ Quoted string of extra ansible-playbook args
84
86
  ```
85
87
 
86
88
  ## Deployment profiles
@@ -32,8 +32,8 @@ edd-tool --help
32
32
  $ edd-tool deploy --h
33
33
  usage: edd-tool deploy [-h] [--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [--site-repo SITE_REPO] [--version VERSION]
34
34
  [--deploy-dir DEPLOY_DIR] [--inventory INVENTORY] [--vault-pass-file VAULT_PASS_FILE]
35
- [--site-config SITE_CONFIG] [--plugin-install-method {galaxy,git-submodule}] [--no-pullremote]
36
- [--force] [--dry-run]
35
+ [--site-config SITE_CONFIG] [--plugin-install-method {galaxy,git-submodule}] [--no-pullremote] [--force]
36
+ [--dry-run] [--ansible-args ANSIBLE_ARGS]
37
37
  [config_profile]
38
38
 
39
39
  positional arguments:
@@ -58,6 +58,8 @@ options:
58
58
  --no-pullremote Skip pullremote tag
59
59
  --force Force overwrite of deployment directory
60
60
  --dry-run Dry run the deployment
61
+ --ansible-args ANSIBLE_ARGS
62
+ Quoted string of extra ansible-playbook args
61
63
  ```
62
64
 
63
65
  ## Deployment profiles
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "edd-tool"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "EDD deployment and plugin management tool"
9
9
  dynamic = ["readme"]
10
10
  license = { file = "LICENSE" }
@@ -36,4 +36,4 @@ where = ["src"]
36
36
  Homepage = "https://gitlab.mpcdf.mpg.de/mpifr-bdg/edd_installer"
37
37
  Documentation = "https://gitlab.mpcdf.mpg.de/mpifr-bdg/edd_installer"
38
38
  Repository = "https://gitlab.mpcdf.mpg.de/mpifr-bdg/edd_installer.git"
39
- "Bug Tracker" = "https://gitlab.mpcdf.mpg.de/mpifr-bdg/edd_installer/issues"
39
+ "Bug Tracker" = "https://gitlab.mpcdf.mpg.de/mpifr-bdg/edd_installer/issues"
@@ -7,6 +7,7 @@ import json
7
7
  import logging
8
8
  import os
9
9
  import pprint
10
+ import shlex
10
11
  import warnings
11
12
  import io
12
13
  from contextlib import contextmanager, redirect_stdout, redirect_stderr
@@ -312,7 +313,7 @@ def display_vars(vars_dict):
312
313
  Args:
313
314
  vars_dict (dict): Dictionary of variables
314
315
  """
315
- logger.info(pprint.pformat(vars_dict, indent=2))
316
+ logger.debug(pprint.pformat(vars_dict, indent=2))
316
317
 
317
318
 
318
319
  def install_plugins(plugins, method="galaxy"):
@@ -341,9 +342,9 @@ def install_plugins(plugins, method="galaxy"):
341
342
  raise NotImplementedError(f"Plugin install method '{method}' is unsupported")
342
343
 
343
344
 
344
- def run_playbook(inventory, vault_args, site_config, tags=None, dry_run=False):
345
+ def run_playbook(inventory, vault_args, site_config, tags=None, dry_run=False, extra_args_str=None):
345
346
  """
346
- Run an Ansible playbook.
347
+ Run an Ansible playbook with optional extra args as a quoted string.
347
348
 
348
349
  Args:
349
350
  inventory (str): Inventory path
@@ -351,19 +352,28 @@ def run_playbook(inventory, vault_args, site_config, tags=None, dry_run=False):
351
352
  site_config (str): Playbook YAML file
352
353
  tags (str, optional): Tags to limit execution
353
354
  dry_run (bool): If True, log the command instead of running
355
+ extra_args_str (str): String of extra args to pass to ansible-playbook (quoted)
354
356
  """
355
357
  collections = (Path().cwd() / "ansible_collections").absolute()
356
358
  env = os.environ.copy()
357
359
  env['ANSIBLE_COLLECTIONS_PATH'] = str(collections)
358
-
359
- cmd = ["ansible-playbook", "-i", inventory] + vault_args + [site_config]
360
+
361
+ # Safely tokenize the extra args string
362
+ extra_args = shlex.split(extra_args_str) if extra_args_str else []
363
+
364
+ cmd = ["ansible-playbook", "-i", inventory] + vault_args
365
+ if extra_args_str:
366
+ cmd.extend(shlex.split(extra_args_str))
360
367
  if tags:
361
368
  cmd.extend(["--tags", tags])
369
+ cmd.append(site_config)
362
370
 
363
371
  if dry_run:
364
372
  logger.info("Would run: %s", " ".join(cmd))
365
373
  else:
366
- run_cmd(cmd, env=env)
374
+ from subprocess import run
375
+ run(cmd, env=env, check=True)
376
+
367
377
 
368
378
  def cmd_install(args):
369
379
  """
@@ -411,19 +421,21 @@ def cmd_install(args):
411
421
 
412
422
  if not args.no_pullremote:
413
423
  logger.info("Pulling docker images")
414
- registry = f"https://{vars_dict["docker_registry"]}:{vars_dict["docker_registry_port"]}"
424
+ registry = f"https://{vars_dict['docker_registry']}:{vars_dict['docker_registry_port']}"
415
425
  logger.debug("Taking registry snapshot before pullremote...")
416
426
  before_state = snapshot_registry(registry)
417
427
  logger.debug(before_state)
418
428
  run_playbook(args.inventory, vault_args, args.site_config,
419
- tags="pullremote", dry_run=args.dry_run)
429
+ tags="pullremote", dry_run=args.dry_run,
430
+ extra_args_str=args.ansible_args)
420
431
  after_state = snapshot_registry(registry)
421
432
  logger.debug("Taking registry snapshow after pullremote")
422
433
  logger.debug(after_state)
423
434
  report = compare_snapshots(before_state, after_state)
424
435
  print_report(report)
425
436
  logger.info("Running deployment")
426
- run_playbook(args.inventory, vault_args, args.site_config, dry_run=args.dry_run)
437
+ run_playbook(args.inventory, vault_args, args.site_config,
438
+ dry_run=args.dry_run, extra_args_str=args.ansible_args)
427
439
  logger.info("Deployment finished")
428
440
 
429
441
 
@@ -508,6 +520,10 @@ def main():
508
520
  sp_install.add_argument("--no-pullremote", action="store_true", help="Skip pullremote tag")
509
521
  sp_install.add_argument("--force", action="store_true", help="Force overwrite of deployment directory")
510
522
  sp_install.add_argument("--dry-run", action="store_true", help="Dry run the deployment")
523
+ sp_install.add_argument(
524
+ "--ansible-args",
525
+ help="Quoted string of extra ansible-playbook args"
526
+ )
511
527
  sp_install.set_defaults(func=cmd_install)
512
528
 
513
529
  args = parser.parse_args()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: edd-tool
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: EDD deployment and plugin management tool
5
5
  Author-email: Ewan Barr <ebarr@mpifr-bonn.mpg.de>
6
6
  License: Copyright 2025 Ewan Barr
@@ -55,8 +55,8 @@ edd-tool --help
55
55
  $ edd-tool deploy --h
56
56
  usage: edd-tool deploy [-h] [--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [--site-repo SITE_REPO] [--version VERSION]
57
57
  [--deploy-dir DEPLOY_DIR] [--inventory INVENTORY] [--vault-pass-file VAULT_PASS_FILE]
58
- [--site-config SITE_CONFIG] [--plugin-install-method {galaxy,git-submodule}] [--no-pullremote]
59
- [--force] [--dry-run]
58
+ [--site-config SITE_CONFIG] [--plugin-install-method {galaxy,git-submodule}] [--no-pullremote] [--force]
59
+ [--dry-run] [--ansible-args ANSIBLE_ARGS]
60
60
  [config_profile]
61
61
 
62
62
  positional arguments:
@@ -81,6 +81,8 @@ options:
81
81
  --no-pullremote Skip pullremote tag
82
82
  --force Force overwrite of deployment directory
83
83
  --dry-run Dry run the deployment
84
+ --ansible-args ANSIBLE_ARGS
85
+ Quoted string of extra ansible-playbook args
84
86
  ```
85
87
 
86
88
  ## Deployment profiles
File without changes
File without changes