Skip to content
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

template: Fix default value with spaces #838

Merged
merged 2 commits into from
Feb 13, 2025

Conversation

tschettervictor
Copy link
Collaborator

@tschettervictor tschettervictor commented Feb 10, 2025

#692
@michael-o

This essentially just makes sure there are not multiple quotes following each other inside the ARG value.

root@dev1:~ # bastille template test sample/top --arg SEARCH_DOMAINS="soo boo doo"
[test]:
Applying template: sample/top...
[test]:
soo boo doo
[test]: 0

[test]:
Applying template: sample/bottom...
[test]:
soo boo doo
[test]: 0

Template applied: sample/bottom

Template applied: sample/top

root@dev1:~ # bastille template test sample/top
[test]:
Applying template: sample/top...
[test]:
foo bar
[test]: 0

[test]:
Applying template: sample/bottom...
[test]:
foo bar
[test]: 0

Template applied: sample/bottom

Template applied: sample/top

#692 
@michael-o 

This essentially just makes sure there are not multiple quotes following each other inside the ARG value.
@michael-o
Copy link
Contributor

Will test today...

@michael-o
Copy link
Contributor

Does not work. Here is my real world usecase:

bastille template deblndw013x10j dw/base-complete \
  --arg PPMD_DOMAIN="bar" \
  --arg AD_DOMAIN="foo" \
...

with

# cat /usr/local/bastille/templates/dw/base-complete/Bastillefile
ARG LOCALE="C.UTF-8"
ARG AD_DOMAIN="innomotics.net"
ARG PPMD_DOMAIN="bln.siemens.de"
ARG SEARCH_DOMAINS="${AD_DOMAIN} ${PPMD_DOMAIN}"
...
CMD echo "Starting base jail configuration"
INCLUDE dw/base-config --arg LOCALE="${LOCALE}" --arg AD_DOMAIN="${AD_DOMAIN}" --arg PPMD_DOMAIN="${PPMD_DOMAIN}" --arg SEARCH_DOMAINS="${SEARCH_DOMAINS}"
...
# cat /usr/local/bastille/templates/dw/base-config/Bastillefile
ARG LOCALE="C.UTF-8"
ARG AD_DOMAIN="innomotics.net"
ARG PPMD_DOMAIN="bln.siemens.de"
ARG SEARCH_DOMAINS="${AD_DOMAIN} ${PPMD_DOMAIN}"
...
CMD echo "Configuring /etc/resolv.conf"
CMD sed -i "" -e "s/%%SEARCH_DOMAINS%%/${SEARCH_DOMAINS}/" /etc/resolv.conf
...
# cat /usr/local/bastille/templates/dw/base-config/etc/resolv.conf
search %%SEARCH_DOMAINS%%
...

It seems to be I have to check all possible combos :-(

@tschettervictor
Copy link
Collaborator Author

tschettervictor commented Feb 13, 2025

What is the output?
Your "cat" shows the templates '/etc/resolv.conf' file.

What about the jails '/etc/resolv.conf'. Isn't that the one you should be "cat"ing ?

@michael-o
Copy link
Contributor

What is the output? Your "cat" shows the templates '/etc/resolv.conf' file.

Wanted to show you how the actual looks like:

What about the jails '/etc/resolv.conf'. Isn't that the one you should be "cat"ing ?

root@deblndw013x:~
# bastille cmd deblndw013x10j cat /etc/resolv.conf
[deblndw013x10j]:
search foo
nameserver 10.64.105.147
nameserver 10.64.105.146
nameserver 139.25.226.6
options timeout:1 attempts:2

It is mangled/truncated.

@tschettervictor
Copy link
Collaborator Author

@michael-o
Updated, try again.

Copy link
Contributor

@michael-o michael-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic, this works for me.

@bmac2 bmac2 merged commit 6676544 into master Feb 13, 2025
1 check passed
@tschettervictor tschettervictor deleted the tschettervictor-fix-template-quote branch March 1, 2025 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants