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

kameleon write_in does not like EOF #32

Open
npf opened this issue Apr 11, 2017 · 10 comments
Open

kameleon write_in does not like EOF #32

npf opened this issue Apr 11, 2017 · 10 comments

Comments

@npf
Copy link
Contributor

npf commented Apr 11, 2017

creating a bash script that makes use of

cat <<EOF
...
EOF

Fails.

This is mostly due to kameleon using the syntax itself internally unfortunately.

@npf
Copy link
Contributor Author

npf commented Apr 11, 2017

moved to oar-team/kameleon#102

@npf npf closed this as completed Apr 11, 2017
@npf npf reopened this Apr 11, 2017
@npf
Copy link
Contributor Author

npf commented Apr 11, 2017

alias is:

  - exec_in: |
      mkdir -p $(dirname @1);
      cat >@1 <<EOF
      @2
      EOF

changing EOF to e.g. EOF_KAMELEON_INTERNAL solves the issue.

@mickours
Copy link
Contributor

Great! did you made a patch?

@npf
Copy link
Contributor Author

npf commented Apr 12, 2017

I'm on it. Let me sleep a bit ;-)

@npf
Copy link
Contributor Author

npf commented Apr 12, 2017

About cat <<EOF vs cat <<'EOF', is there a reason the prefer the former ? For what I see, having $VAR in the text (e.g. bash script) is error prone if not useless anyway ?

@mickours
Copy link
Contributor

mickours commented Apr 12, 2017 via email

@npf
Copy link
Contributor Author

npf commented Apr 12, 2017

The current behavior breaks so defined bash scripts and I don't see how expansion could be used within the yaml and aliases definitions...
I will change it unless proven it breaks something.

@npf
Copy link
Contributor Author

npf commented Apr 12, 2017

question: is exec_in executed in a sub shell ?

@npf
Copy link
Contributor Author

npf commented Apr 12, 2017

This breaks the step bootstrap/ssh_config/prepare_ssh_config:

 - prepare_ssh_config:
  - on_bootstrap_init:
    - write_local:
      - $${ssh_config_file}
      - |
        Host $${kameleon_recipe_name}
        HostName 127.0.0.1
        Port ${SSH_FWD_PORT}
        User root
        UserKnownHostsFile /dev/null
        StrictHostKeyChecking no
        PasswordAuthentication no
        IdentitiesOnly yes
        LogLevel FATAL
        ForwardAgent yes
        Compression yes
        Protocol 2

${SSH_FWD_PORT} is not expanded. Look like the answer to my last question is no: microsteps are executed in a same shell.

@npf
Copy link
Contributor Author

npf commented Apr 12, 2017

we could consider providing a different alias for cat <<'EOF'... also providing aliases that set the owner et perms for the file could be nice... For now I will just not use any alias in my recipe.

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

No branches or pull requests

2 participants