@@ -121,6 +121,7 @@ ENDC=$'\e[0m'
121
121
# return codes.. Use this method for messages to the console.
122
122
# ------------------------------------------------------------------------------
123
123
message (){
124
+ printf ' %s\n' " " >&2
124
125
printf ' %s\n' " ${GRN}${DIV}${ENDC} " >&2
125
126
printf ' %s\n' " ${GRN} INFO:${ENDC} ${1} " >&2
126
127
printf ' %s\n' " ${GRN}${DIV}${ENDC} " >&2
@@ -132,6 +133,7 @@ message(){
132
133
# Use this method for error messages to the console.
133
134
# ------------------------------------------------------------------------------
134
135
message_error (){
136
+ printf ' %s\n' " " >&2
135
137
printf ' %s\n' " ${RED}${DIV}${RED} " >&2
136
138
printf ' %s\n' " ${RED} ERROR:${ENDC} ${1} " >&2
137
139
printf ' %s\n' " ${RED}${DIV}${ENDC} " >&2
@@ -144,6 +146,7 @@ message_error(){
144
146
# Use this method for error messages to the console.
145
147
# ------------------------------------------------------------------------------
146
148
message_warn (){
149
+ printf ' %s\n' " " >&2
147
150
printf ' %s\n' " ${YEL}${DIV}${YEL} " >&2
148
151
printf ' %s\n' " ${YEL} WARN:${ENDC} ${1} " >&2
149
152
printf ' %s\n' " ${YEL}${DIV}${YEL} " >&2
@@ -369,11 +372,27 @@ ac_build(){
369
372
# # Example:
370
373
# # $ ac --ac-galaxy-importer
371
374
ac_galaxy_importer (){
375
+ # Extract the pytest ignore errors from `$VENV/galaxy-importer.cfg` and trim all white space
376
+ FLAKE8_IGNORE=` cat $VENV /galaxy-importer.cfg| grep -i " ignore = " | cut -d " =" -f 2 | tr -d ' ' `
377
+
378
+ # Path to the installed constants.py
379
+ eval " ORIGINAL_CONSTANTS_DIR=(${VENV} /lib/*/site-packages/galaxy_importer/)"
380
+
381
+ # Backup up the constants.py file before editing it.
382
+ cp $ORIGINAL_CONSTANTS_DIR /constants.py /tmp/
383
+
384
+ # Update constants.py with our choice of FLAKE8_IGNORE entry
385
+ sed " s/E402/$FLAKE8_IGNORE /" ${ORIGINAL_CONSTANTS_DIR} /constants.py > ${ORIGINAL_CONSTANTS_DIR} /constants.py.tmp
386
+
387
+ mv ${ORIGINAL_CONSTANTS_DIR} /constants.py.tmp ${ORIGINAL_CONSTANTS_DIR} /constants.py
388
+
372
389
message " Creating 'ibm_zos_core' collection with branch: '$GH_BRANCH '."
373
390
. $VENV_BIN /activate && collection_name=$( $VENV_BIN /ansible-galaxy collection build --force | awk -F/ ' {print $NF}' ) && ls -la $collection_name
374
391
375
392
message " Running Galaxy Importer for collection $collection_name "
376
- . $VENV_BIN /activate && python3 -m galaxy_importer.main $collection_name
393
+ . $VENV_BIN /activate && export GALAXY_IMPORTER_CONFIG=$VENV /galaxy-importer.cfg; python3 -m galaxy_importer.main $collection_name
394
+
395
+ mv /tmp/constants.py ${ORIGINAL_CONSTANTS_DIR} /constants.py
377
396
}
378
397
379
398
# ------------------------------------------------------------------------------
@@ -1711,8 +1730,14 @@ venv_start(){
1711
1730
fi
1712
1731
1713
1732
message " Starting managed python virtual environment: $VENV_BASENAME "
1733
+ # Original , see comments below.
1714
1734
# . $VENV_BIN/activate; exec /bin/sh -i
1715
- /bin/bash -c " . $VENV_BIN /activate; exec /bin/sh -i;"
1735
+
1736
+ # TODO: Document wny /bin/bash -c was introduced , the shebang already forces this, could have been because of original CE design which should not depend on bash.
1737
+ # /bin/bash -c ". $VENV_BIN/activate; exec /bin/sh -i;"
1738
+
1739
+ # Invoke venv with epxorts that can find the ansible collection within the venv.
1740
+ /bin/bash -c " . $VENV_BIN /activate && export ANSIBLE_LIBRARY=$VENV /ansible_collections/ibm/ibm_zos_core/plugins/modules;export ANSIBLE_CONFIG=$VENV /ansible.cfg; exec /bin/sh -i;"
1716
1741
}
1717
1742
1718
1743
# ------------------------------------------------------------------------------
0 commit comments