From de3da04ddd0263a25f00a6b649c6d0afc67769b6 Mon Sep 17 00:00:00 2001 From: deegan Date: Fri, 25 Oct 2024 11:20:31 +0200 Subject: [PATCH 1/2] manifest etc --- Taskfile.yaml | 2 +- scripts/local/openstack_image_fetch.bash | 13 ++++++++++--- scripts/local/ssh_add.bash | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) mode change 100644 => 100755 scripts/local/openstack_image_fetch.bash diff --git a/Taskfile.yaml b/Taskfile.yaml index 8642e35..8e9fb61 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -83,7 +83,7 @@ tasks: - <<'EOF' source {{.PROJECT_REPO_PATH}}/build.env {{.CONSTRUCTOR_REPO_PATH}}/scripts/local/openstack_image_fetch.bash - EOF + EOF post-install: desc: post-install \ No newline at end of file diff --git a/scripts/local/openstack_image_fetch.bash b/scripts/local/openstack_image_fetch.bash old mode 100644 new mode 100755 index fdca78c..ef45ddd --- a/scripts/local/openstack_image_fetch.bash +++ b/scripts/local/openstack_image_fetch.bash @@ -62,6 +62,7 @@ function Openstack::Token::Get.id { } function Openstack::Image::Get.uuid { + local -r manifest_file_path="${1}" local -r jq_filter='.["builds"][0]["artifact_id"]' cat "${manifest_file_path}" \ @@ -69,6 +70,7 @@ function Openstack::Image::Get.uuid { } function Openstack::Image::Get.name { + local -r manifest_file_path="${1}" local -r jq_filter='.["builds"][0]["custom_data"]["BUILD_IMAGE_NAME"]' cat "${manifest_file_path}" \ @@ -99,6 +101,7 @@ function Openstack::Image.fetch { function main { local -r manifest_file_path="${PKR_VAR_TARGET_IMAGE_MANIFEST}" + local -r openstack_cache_dir_path="${PROJECT_REPO_PATH}/.openstack-cache" mkdir -p "${openstack_cache_dir_path}" @@ -108,15 +111,19 @@ function main { local -r http_unauthorized='401' local curl_response_code=UNSET local -r glance_api="$(Openstack::Image::API "${openstack_cache_dir_path}")" - local -r image_uuid="$(Openstack::Image::Get.uuid)" - local -r image_name="$(Openstack::Image::Get.name)" + local -r image_uuid="$(Openstack::Image::Get.uuid "${PROJECT_REPO_PATH}/manifest.json")" + local -r image_name="$(Openstack::Image::Get.name "${PROJECT_REPO_PATH}/manifest.json")" # # if we already have a cached token, try to use it # otherwise re-issue a token # + + [ -z "$(cat $openstack_token_file_path | xargs )" ] && \ + rm $openstack_token_file_path || echo "token file found" test -f "${openstack_token_file_path}" \ - || Openstack::Token.issue "${openstack_token_file_path}" + || Openstack::Token.issue "${openstack_token_file_path}" + # # # diff --git a/scripts/local/ssh_add.bash b/scripts/local/ssh_add.bash index b9618f3..11fcd46 100755 --- a/scripts/local/ssh_add.bash +++ b/scripts/local/ssh_add.bash @@ -22,4 +22,4 @@ function main { ssh-add "${ssh_private_key_file_path}" } -main \ No newline at end of file +main From 6331140b5b1e60913edb37d435a696aebc19268c Mon Sep 17 00:00:00 2001 From: deegan Date: Mon, 31 Mar 2025 15:21:39 +0200 Subject: [PATCH 2/2] ++ --- Taskfile.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Taskfile.yaml b/Taskfile.yaml index 8e9fb61..4f41f36 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -86,4 +86,4 @@ tasks: EOF post-install: - desc: post-install \ No newline at end of file + desc: post-install