-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ensure data_volume isn't surrounded by quotes #21473
base: main
Are you sure you want to change the base?
fix: ensure data_volume isn't surrounded by quotes #21473
Conversation
Signed-off-by: Alexandre Vallarino <alexandre.vallarino@gandi.net>
9e75874
to
22bb9a5
Compare
@@ -30,7 +30,7 @@ else | |||
fi | |||
fi | |||
|
|||
data_path=$(grep '^[^#]*data_volume:' $input_dir/harbor.yml | awk '{print $NF}') | |||
data_path=$(grep '^[^#]*data_volume:' $input_dir/harbor.yml | awk '{print $NF}' | sed 's/"//g') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention is to remove the quote when there is a quote, sometimes the path may contain space, to remove quote will cause problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention is to remove the quote when there is a quote, sometimes the path may contain space, to remove quote will cause problem?
In my opinion, its already impossible to use a path with spaces due to: | awk '{print $NF}'
.
Here is a test:
# grep data_volume harbor.yml
data_volume: "/srv/harbor/data directory with space"
# grep '^[^#]*data_volume:' harbor.yml | awk '{print $NF}'
space"
There is no change to expect about this.
@Aletor93 what shell are you using ? |
For the test made here, I've used For a better test case, I've commented my modification on data_path=$(grep '^[^#]*data_volume:' $input_dir/harbor.yml | awk '{print $NF}') # | sed 's/"//g')
echo ${data_path}- Then tested to set # ./install.sh
...
[Step 3]: preparing harbor configs ...
prepare base dir is set to /srv/harbor/install
space"-
docker: Error response from daemon: create space": "space\"" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
See 'docker run --help'. I observe that |
Comprehensive Summary of your change
I'm generating
harbor.yaml
file with erb functionto_yaml
, where strings containing/
are quoted. It can't be configured.When I run
./install.sh
script, it fails on docker volume command due to quotes which aren't removed:After editing the
prepare
script to remove quotes on data_volume if present, it works like a charm. Thesed
is already used in other scripts, it shouldn't be a problem to use it.Issue being fixed
n/a (no issue opened)
Please indicate you've done the following: