Skip to content

Commit 8b074a0

Browse files
committed
manifest etc
1 parent 59dc4d4 commit 8b074a0

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

Taskfile.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ tasks:
8181
--noprofile \
8282
--norc \
8383
- <<'EOF'
84+
echo PATH $PATH
8485
source {{.PROJECT_REPO_PATH}}/build.env
8586
{{.CONSTRUCTOR_REPO_PATH}}/scripts/local/openstack_image_fetch.bash
86-
EOF
87+
EOF
8788
8889
post-install:
8990
desc: post-install

scripts/local/openstack_image_fetch.bash

100644100755
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@ function Openstack::Token::Get.id {
6262
}
6363

6464
function Openstack::Image::Get.uuid {
65+
local -r manifest_file_path="${1}"
6566
local -r jq_filter='.["builds"][0]["artifact_id"]'
6667

6768
cat "${manifest_file_path}" \
6869
| pkgx jq --raw-output "${jq_filter}"
6970
}
7071

7172
function Openstack::Image::Get.name {
73+
local -r manifest_file_path="${1}"
7274
local -r jq_filter='.["builds"][0]["custom_data"]["BUILD_IMAGE_NAME"]'
7375

7476
cat "${manifest_file_path}" \
@@ -99,6 +101,7 @@ function Openstack::Image.fetch {
99101

100102
function main {
101103
local -r manifest_file_path="${PKR_VAR_TARGET_IMAGE_MANIFEST}"
104+
102105
local -r openstack_cache_dir_path="${PROJECT_REPO_PATH}/.openstack-cache"
103106

104107
mkdir -p "${openstack_cache_dir_path}"
@@ -108,15 +111,19 @@ function main {
108111
local -r http_unauthorized='401'
109112
local curl_response_code=UNSET
110113
local -r glance_api="$(Openstack::Image::API "${openstack_cache_dir_path}")"
111-
local -r image_uuid="$(Openstack::Image::Get.uuid)"
112-
local -r image_name="$(Openstack::Image::Get.name)"
114+
local -r image_uuid="$(Openstack::Image::Get.uuid "${PROJECT_REPO_PATH}/manifest.json")"
115+
local -r image_name="$(Openstack::Image::Get.name "${PROJECT_REPO_PATH}/manifest.json")"
113116

114117
#
115118
# if we already have a cached token, try to use it
116119
# otherwise re-issue a token
117120
#
121+
122+
[ -z "$(cat $openstack_token_file_path | xargs )" ] && \
123+
rm $openstack_token_file_path || echo "token file found"
118124
test -f "${openstack_token_file_path}" \
119-
|| Openstack::Token.issue "${openstack_token_file_path}"
125+
|| Openstack::Token.issue "${openstack_token_file_path}"
126+
120127
#
121128
#
122129
#

scripts/local/ssh_add.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ function main {
2222
ssh-add "${ssh_private_key_file_path}"
2323
}
2424

25-
main
25+
main

0 commit comments

Comments
 (0)