Skip to content

Commit

Permalink
Fix: Address various shellcheck linting errors in scripts
Browse files Browse the repository at this point in the history
Issue: RELENG-5183
Change-Id: I068c27b215fd487985d6204af05fe6619c9d8f15
Signed-off-by: Matthew Watkins <[email protected]>
  • Loading branch information
ModeSevenIndustrialSolutions committed Feb 29, 2024
1 parent bafd57c commit 8901fe0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
fixes:
- |
Address several linting errors in scripts, mostly unquoted variables
4 changes: 2 additions & 2 deletions shell/openstack-cleanup-orphaned-objects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ trap _rmtemp EXIT
# Output the initial list of object UUIDs to a temporary file
if [[ -n ${filters} ]]; then
# If a filter/match condition is requested/set
openstack --os-cloud "$os_cloud" "${object}" list -f value -c ID $attributes \
openstack --os-cloud "$os_cloud" "${object}" list -f value -c ID "$attributes" \
| { $filters || true; } | { awk '{print $1}' || true; } > "$tmpfile"
else
# Otherwise don't pipe through an additional command
openstack --os-cloud "$os_cloud" "${object}" list -f value -c ID $attributes \
openstack --os-cloud "$os_cloud" "${object}" list -f value -c ID "$attributes" \
| { awk '{print $1}' || true; } > "$tmpfile"
fi

Expand Down
14 changes: 7 additions & 7 deletions shell/release-job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ set_variables_common(){

TAG_RELEASE="${TAG_RELEASE:-None}"
if [[ $TAG_RELEASE == "None" ]]; then
if grep -q "tag_release" $release_file ; then
if grep -q "tag_release" "$release_file"; then
TAG_RELEASE=$(yq -r .tag_release "$release_file")
else
TAG_RELEASE=true
Expand Down Expand Up @@ -183,7 +183,7 @@ set_variables_packagecloud(){
VERSION=$(yq -r ".version" "$release_file")
fi
if [[ -z ${GIT_TAG:-} ]]; then
if grep -q "git_tag" $release_file ; then
if grep -q "git_tag" "$release_file"; then
GIT_TAG=$(yq -r ".git_tag" "$release_file")
else
GIT_TAG="$VERSION"
Expand Down Expand Up @@ -385,8 +385,8 @@ artifact_release_file(){
mkdir artifacts
ORG=$(echo "$NEXUS_URL" | awk -F'.' '{print $2}')

for namequoted in $(yq '.artifacts[].name' $release_file); do
pathquoted=$(yq ".artifacts[] |select(.name==$namequoted) |.path" $release_file)
for namequoted in $(yq '.artifacts[].name' "$release_file"); do
pathquoted=$(yq ".artifacts[] |select(.name==$namequoted) |.path" "$release_file")

#Remove extra yaml quotes
name="${namequoted#\"}"
Expand Down Expand Up @@ -420,8 +420,8 @@ container_release_file(){
local lfn_umbrella
lfn_umbrella="$(echo "$GERRIT_URL" | awk -F"." '{print $2}')"

for namequoted in $(yq '.containers[].name' $release_file); do
versionquoted=$(yq ".containers[] |select(.name==$namequoted) |.version" $release_file)
for namequoted in $(yq '.containers[].name' "$release_file"); do
versionquoted=$(yq ".containers[] |select(.name==$namequoted) |.version" "$release_file")

#Remove extra yaml quotes
name="${namequoted#\"}"
Expand Down Expand Up @@ -657,7 +657,7 @@ case $DISTRIBUTION_TYPE in
fi
set_variables_packagecloud
verify_packagecloud_match_release
for name in $(yq -r '.packages[].name' $release_file); do
for name in $(yq -r '.packages[].name' "$release_file"); do
package=$name
packagecloud_verify "$package" "$packagecloud_account"
if [[ "$JOB_NAME" =~ "merge" ]] && ! $DRY_RUN; then
Expand Down

0 comments on commit 8901fe0

Please sign in to comment.