Skip to content

Commit 99410d6

Browse files
authored
fix: codespell typo fixes, replace unsafe array assignments, quote variable expansions to prevent globbing (#980)
1 parent af123c0 commit 99410d6

File tree

12 files changed

+41
-39
lines changed

12 files changed

+41
-39
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ You can also add extra commands by installing "packages".
232232
- Cloud Posse also provides a large set of packages for installing common DevOps commands
233233
and utilities via [cloudposse/packages](https://github.com/cloudposse/packages).
234234
- Google Cloud provides a set of packages for working with GCP
235-
- OpenTofu provides a packge for installing it, too.
235+
- OpenTofu provides a package for installing it, too.
236236

237237
Those package repositories are pre-installed in Geodesic, so
238238
all you need to do is add the packages you want via

README.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ usage: |-
230230
- Cloud Posse also provides a large set of packages for installing common DevOps commands
231231
and utilities via [cloudposse/packages](https://github.com/cloudposse/packages).
232232
- Google Cloud provides a set of packages for working with GCP
233-
- OpenTofu provides a packge for installing it, too.
233+
- OpenTofu provides a package for installing it, too.
234234
235235
Those package repositories are pre-installed in Geodesic, so
236236
all you need to do is add the packages you want via

os/debian/Dockerfile.debian

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ RUN if [[ -x /usr/local/bin/aws ]]; then mv /usr/local/bin/aws /usr/local/bin/aw
283283
# Install AWS CLI 2
284284
# Get AWS CLI V2 version from https://github.com/aws/aws-cli/blob/v2/CHANGELOG.rst if you want
285285
# but it is updated several times a week, so we choose to just get the latest.
286-
# It is available in a Debain package `awscli`, but that can be very out of date.
286+
# It is available in a Debian package `awscli`, but that can be very out of date.
287287
# ARG AWS_CLI_VERSION=2.15.48
288288
RUN AWSTMPDIR=$(mktemp -d -t aws-inst-XXXXXXXXXX) && \
289289
if [ "$TARGETARCH" = "amd64" ]; then \

rootfs/etc/codefresh/require_vars

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function require_cfvar() {
2626
echo "$separator"
2727
red Build variable \"$var\" has not been set >&2
2828

29-
# Look for docmentation of VARNAME on the rest of the args
29+
# Look for documentation of VARNAME on the rest of the args
3030
# First, look for trailing characters on $1 and collect them
3131
local rem1=$(expr match "$1" '[^}]*}}[[:blank:]]*\(.*\)')
3232

@@ -50,7 +50,7 @@ function require_cfvar() {
5050
# EOF
5151
# Checks each variable with require_cfvar.
5252
# Variables must be at the start of the line, one per line, but do not need to be quoted.
53-
# The final EOF must be at the begining of the line.
53+
# The final EOF must be at the beginning of the line.
5454
function require_cfvars() {
5555
local var
5656
local status=0

rootfs/etc/init.d/atlantis.sh

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
# Start the atlantis server
44
if [ "${ATLANTIS_ENABLED}" == "true" ]; then
5-
which atlantis >/dev/null
6-
if [ $? -ne 0 ]; then
5+
if ! which atlantis >/dev/null; then
76
echo "Atlantis is not installed"
87
exit 1
98
fi
@@ -42,7 +41,7 @@ if [ "${ATLANTIS_ENABLED}" == "true" ]; then
4241
export ATLANTIS_CHAMBER_SERVICE=${ATLANTIS_CHAMBER_SERVICE:-atlantis}
4342

4443
# Export environment from chamber to shell
45-
source <(chamber exec ${ATLANTIS_CHAMBER_SERVICE} -- sh -c "export -p")
44+
source <(chamber exec "${ATLANTIS_CHAMBER_SERVICE}" -- sh -c "export -p")
4645

4746
if [ -n "${ATLANTIS_IAM_ROLE_ARN}" ]; then
4847
# Map the Atlantis IAM Role ARN to the env we use everywhere in our root modules
@@ -55,11 +54,11 @@ if [ "${ATLANTIS_ENABLED}" == "true" ]; then
5554
export ATLANTIS_HOME=${ATLANTIS_HOME:-/home/atlantis}
5655

5756
# create atlantis user & group
58-
(getent group ${ATLANTIS_GROUP} || addgroup ${ATLANTIS_GROUP}) >/dev/null
59-
(getent passwd ${ATLANTIS_USER} || adduser -h ${ATLANTIS_HOME} -S -G ${ATLANTIS_GROUP} ${ATLANTIS_USER}) >/dev/null
57+
(getent group "${ATLANTIS_GROUP}" || addgroup "${ATLANTIS_GROUP}") >/dev/null
58+
(getent passwd "${ATLANTIS_USER}" || adduser -h "${ATLANTIS_HOME}" -S -G "${ATLANTIS_GROUP}" "${ATLANTIS_USER}") >/dev/null
6059

6160
# Provision terraform cache directory
62-
install --directory ${TF_PLUGIN_CACHE_DIR} --owner ${ATLANTIS_USER} --group ${ATLANTIS_GROUP}
61+
install --directory "${TF_PLUGIN_CACHE_DIR}" --owner "${ATLANTIS_USER}" --group "${ATLANTIS_GROUP}"
6362

6463
# Allow atlantis to use /dev/shm
6564
if [ -d /dev/shm ]; then
@@ -69,14 +68,14 @@ if [ "${ATLANTIS_ENABLED}" == "true" ]; then
6968

7069
# Add SSH key to agent, if one is configured so we can pull from private git repos
7170
if [ -n "${ATLANTIS_SSH_PRIVATE_KEY}" ]; then
72-
source <(gosu ${ATLANTIS_USER} ssh-agent -s)
73-
ssh-add - <<<${ATLANTIS_SSH_PRIVATE_KEY}
71+
source <(gosu "${ATLANTIS_USER}" ssh-agent -s)
72+
ssh-add - <<<"${ATLANTIS_SSH_PRIVATE_KEY}"
7473
# Sanitize environment
7574
unset ATLANTIS_SSH_PRIVATE_KEY
7675
fi
7776

7877
if [ -n "${ATLANTIS_ALLOW_PRIVILEGED_PORTS}" ]; then
79-
setcap "cap_net_bind_service=+ep" $(which atlantis)
78+
setcap "cap_net_bind_service=+ep" "$(which atlantis)"
8079
fi
8180

8281
# Do not export these as Terraform environment variables
@@ -92,18 +91,18 @@ if [ "${ATLANTIS_ENABLED}" == "true" ]; then
9291
# https://gist.github.com/Kovrinic/ea5e7123ab5c97d451804ea222ecd78a
9392

9493
# The URL "[email protected]:" is used by `git` (e.g. `git clone`)
95-
gosu ${ATLANTIS_USER} git config --global url."https://github.com/".insteadOf "[email protected]:"
94+
gosu "${ATLANTIS_USER}" git config --global url."https://github.com/".insteadOf "[email protected]:"
9695
# The URL "ssh://[email protected]/" is used by Terraform (e.g. `terraform init --from-module=...`)
9796
# NOTE: we use `--add` to append the second URL to the config file
98-
gosu ${ATLANTIS_USER} git config --global url."https://github.com/".insteadOf "ssh://[email protected]/" --add
97+
gosu "${ATLANTIS_USER}" git config --global url."https://github.com/".insteadOf "ssh://[email protected]/" --add
9998

10099
# https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage
101100
# see rootfs/usr/local/bin/git-credential-github
102-
gosu ${ATLANTIS_USER} git config --global credential.helper 'github'
101+
gosu "${ATLANTIS_USER}" git config --global credential.helper 'github'
103102

104103
# Use a primitive init handler to catch signals and handle them properly
105104
# Use gosu to drop privileges
106105
# Use env to setup the shell environment for atlantis
107106
# Then lastly, start the atlantis server
108-
exec dumb-init gosu ${ATLANTIS_USER} env BASH_ENV=/etc/direnv/bash atlantis server
107+
exec dumb-init gosu "${ATLANTIS_USER}" env BASH_ENV=/etc/direnv/bash atlantis server
109108
fi

rootfs/etc/profile.d/_40-preferences.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fi
1717
#
1818
# Determine the base directory for all customizations.
1919
# We do some extra processing because GEODESIC_CONFIG_HOME needs to be set as a path in the Geodesic file system,
20-
# but the user may have set it as a path on the host computer system. We try to accomodate that by
20+
# but the user may have set it as a path on the host computer system. We try to accommodate that by
2121
# searching a few other places for the directory if $GEODESIC_CONFIG_HOME does point to a valid directory
2222
export GEODESIC_CONFIG_HOME
2323
_GEODESIC_CONFIG_HOME_DEFAULT="/root/.config/geodesic"

rootfs/etc/profile.d/aws.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# In this script, we do not care about return values, as problems are detected by the resulting empty value.
55

66
export AWS_REGION_ABBREVIATION_TYPE=${AWS_REGION_ABBREVIATION_TYPE:-fixed}
7-
export AWS_DEFAULT_SHORT_REGION=${AWS_DEFAULT_SHORT_REGION:-$(aws-region --${AWS_REGION_ABBREVIATION_TYPE} ${AWS_DEFAULT_REGION:-us-west-2})}
7+
export AWS_DEFAULT_SHORT_REGION=${AWS_DEFAULT_SHORT_REGION:-$(aws-region --"${AWS_REGION_ABBREVIATION_TYPE}" "${AWS_DEFAULT_REGION:-us-west-2}")}
88
export GEODESIC_AWS_HOME
99

1010
function _aws_config_home() {
@@ -102,7 +102,7 @@ function aws_sdk_assume_role() {
102102
history -c
103103
history -r
104104
else
105-
AWS_PROFILE="$role" $*
105+
AWS_PROFILE="$role" "$@"
106106
fi
107107
ASSUME_ROLE="$assume_role"
108108
}
@@ -154,7 +154,8 @@ function export_current_aws_role() {
154154
local sso_role_name=$(echo "$role_part" | cut -d'_' -f2) # This selects the second field delimited by '_'
155155

156156
# Find all profiles that have matching role names
157-
local profile_names=($(crudini --get --format=lines "$config_file" | grep "$sso_role_name" | cut -d' ' -f 3))
157+
local profile_names
158+
mapfile -t profile_names < <(crudini --get --format=lines "$config_file" | grep "$sso_role_name" | cut -d' ' -f 3)
158159
local profile_name
159160
for profile_name in "${profile_names[@]}"; do
160161
# Skip the generic profiles
@@ -173,7 +174,7 @@ function export_current_aws_role() {
173174
# Normal IAM role
174175
# Assumed roles in AWS config file use the role ARN, not the assumed role ARN, so adjust accordingly.
175176
local role_arn=$(printf "%s" "$current_role" | sed 's/:sts:/:iam:/g' | sed 's,:assumed-role/,:role/,')
176-
role_names=($(crudini --get --format=lines "$config_file" | grep "$role_arn" | cut -d' ' -f 3))
177+
mapfile -t role_names < <(crudini --get --format=lines "$config_file" | grep "$role_arn" | cut -d' ' -f 3)
177178
for rn in "${role_names[@]}"; do
178179
if [[ $rn == "default" ]] || [[ $rn =~ -identity$ ]]; then
179180
continue
@@ -257,7 +258,7 @@ function refresh_current_aws_role_if_needed() {
257258
[[ $aws_profile =~ $is_exported ]] || aws_profile=""
258259
local credentials_mtime=$(stat -c "%Y" "${AWS_SHARED_CREDENTIALS_FILE:-${GEODESIC_AWS_HOME}/credentials}" 2>/dev/null)
259260
local role_fingerprint="${aws_profile}/${credentials_mtime}/${AWS_ACCESS_KEY_ID}"
260-
if [[ $role_fingerprint != $GEODESIC_AWS_ROLE_CACHE ]]; then
261+
if [[ $role_fingerprint != "$GEODESIC_AWS_ROLE_CACHE" ]]; then
261262
export_current_aws_role
262263
export GEODESIC_AWS_ROLE_CACHE="${role_fingerprint}"
263264
fi

rootfs/etc/profile.d/fzf.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function _set_fzf_default_opts() {
3434
local cyan="37"
3535
local green="2"
3636
local olive="3"
37-
local keep="-1" # Keep the exsiting terminal setting for this field
37+
local keep="-1" # Keep the existing terminal setting for this field
3838

3939
local fzf_default_opts
4040
case "$1" in

rootfs/etc/profile.d/prompt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function geodesic_prompt() {
119119
case $SHLVL in
120120
1) level_prompt='.' ;;
121121
2) level_prompt=':' ;;
122-
3) level_prompt='' ;; # vertical elipsis \u22ee from Mathematical Symbols
122+
3) level_prompt='' ;; # vertical ellipsis \u22ee from Mathematical Symbols
123123
*) level_prompt="$SHLVL" ;;
124124
esac
125125
level_prompt=$(bold "${level_prompt}")

rootfs/etc/profile.d/Ω_overrides.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# other files that this function needs to be able to see.
44
# This file should be the last file in profile.d to execute.
55
# This loads user's overrides, which take actions based on any setup that has already occurred.
6-
# This must come after all setup has happened so that the final configuration is availble for inspection,
6+
# This must come after all setup has happened so that the final configuration is available for inspection,
77
# and there must not be any configuration after this to ensure that anything set here remains set as the user intended.
88

99
## Load user's custom overrides

0 commit comments

Comments
 (0)