From cb32e7e66d379d1d63ef48b0dffcb08aa57cdc7a Mon Sep 17 00:00:00 2001 From: emdee Date: Sat, 30 Dec 2023 11:19:54 +0000 Subject: [PATCH] update src/ansible_gentooimgr --- .../usr/local/src/ansible_gentooimgr/README.md | 6 ++++++ .../gentooimgr/configs/base.json | 1 - .../library/ansible_gentooimgr.py | 16 +++++++++------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/overlay/Linux/usr/local/src/ansible_gentooimgr/README.md b/overlay/Linux/usr/local/src/ansible_gentooimgr/README.md index 5853d93..c95e93d 100644 --- a/overlay/Linux/usr/local/src/ansible_gentooimgr/README.md +++ b/overlay/Linux/usr/local/src/ansible_gentooimgr/README.md @@ -1,6 +1,12 @@ GentooImgr: Gentoo Image Builder for Cloud and Turnkey ISO installers ===================================================================== +** This is a modified version of https://github.com/NucleaPeon/gentooimgr/ +where we've modified the code a little to do use Python logging. We can +still use it for the build stage, but we think the install stahe is better +done using ansible, hence the libvirt_cloud playbook.** + + GentooImgr is a python script system to build cloud images based on Gentoo Linux. Huge thanks to https://github.com/travisghansen/gentoo-cloud-image-builder for providing a foundation to work from. diff --git a/overlay/Linux/usr/local/src/ansible_gentooimgr/gentooimgr/configs/base.json b/overlay/Linux/usr/local/src/ansible_gentooimgr/gentooimgr/configs/base.json index f3b3cc3..b9b9274 100644 --- a/overlay/Linux/usr/local/src/ansible_gentooimgr/gentooimgr/configs/base.json +++ b/overlay/Linux/usr/local/src/ansible_gentooimgr/gentooimgr/configs/base.json @@ -32,7 +32,6 @@ "postfix", "parted", "portage-utils", - "bash-completion", "gentoo-bashcomp", "tmux", "app-misc/screen", diff --git a/overlay/Linux/usr/local/src/ansible_gentooimgr/library/ansible_gentooimgr.py b/overlay/Linux/usr/local/src/ansible_gentooimgr/library/ansible_gentooimgr.py index af66548..d1774ff 100755 --- a/overlay/Linux/usr/local/src/ansible_gentooimgr/library/ansible_gentooimgr.py +++ b/overlay/Linux/usr/local/src/ansible_gentooimgr/library/ansible_gentooimgr.py @@ -12,16 +12,18 @@ import traceback sys.path.append('/mnt/o/var/local/src/play_tox/src/ansible_gentooimgr') # in the library -mod_path = os.path.dirname(os.path.realpath('__file__')) -mod_path = os.path.join(mod_path, 'src', 'ansible_gentooimgr') -assert os.path.isdir(mod_path), f"parent {mod_path}" -assert os.path.isfile(os.path.join(mod_path, '__init__.py')),f"index {mod_path}" -assert os.path.isdir(os.path.join(mod_path, 'gentooimgr')), f"sub {mod_path}" -sys.path.append(mod_path) +if os.environ.get('TESTF_ANSIBLE_SRC',''): + # running from source + mod_path = os.environ.get('TESTF_ANSIBLE_SRC','') + mod_path = os.path.join(mod_path, 'src', 'ansible_gentooimgr') + assert os.path.isdir(mod_path), f"parent {mod_path}" + assert os.path.isfile(os.path.join(mod_path, '__init__.py')),f"index {mod_path}" + assert os.path.isdir(os.path.join(mod_path, 'gentooimgr')), f"sub {mod_path}" + sys.path.append(mod_path) try: import gentooimgr except Exception as e: - sys.stderr.write(f"{mod_path} {sys.path} {traceback.print_exc()}") + sys.stderr.write(f"{e} {sys.path} {traceback.print_exc()}") raise import ansible