Skip to content

Commit

Permalink
fix #239 , use python-style templating instead of Jinja in all driver…
Browse files Browse the repository at this point in the history
…s login_cmd_template

This file assumes Jinja templating for the port parameter and passes a Jinja-style "{{ port }}".

https://github.com/ansible/molecule/blob/main/src/molecule/command/login.py#L105

When it reaches molecule, it is subsituted in  this file and is done by python calling `.format()` on the string.
That causes it to not render correctly and gives users issues running
molecule login.

ref: #239

Fixed all affected plugins.
  • Loading branch information
danielpodwysocki committed Feb 18, 2024
1 parent b48ead5 commit 9279b58
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/molecule_plugins/azure/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ def login_cmd_template(self):
connection_options = " ".join(self.ssh_connection_options)

return (
"ssh {{address}} "
"-l {{user}} "
"-p {{port}} "
"-i {{identity_file}} "
"ssh {address} "
"-l {user} "
"-p {port} "
"-i {identity_file} "
f"{connection_options}"
)

Expand Down
8 changes: 4 additions & 4 deletions src/molecule_plugins/ec2/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ def login_cmd_template(self):
connection_options = " ".join(self.ssh_connection_options)

return (
"ssh {{address}} "
"-l {{user}} "
"-p {{port}} "
"-i {{identity_file}} "
"ssh {address} "
"-l {user} "
"-p {port} "
"-i {identity_file} "
f"{connection_options}"
)

Expand Down
8 changes: 4 additions & 4 deletions src/molecule_plugins/gce/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ def login_cmd_template(self):
connection_options = " ".join(self.ssh_connection_options)

return (
"ssh {{address}} "
"-l {{user}} "
"-p {{port}} "
"-i {{identity_file}} "
"ssh {address} "
"-l {user} "
"-p {port}} "
"-i {identity_file} "
f"{connection_options}"
)

Expand Down
8 changes: 4 additions & 4 deletions src/molecule_plugins/vagrant/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ def login_cmd_template(self):
connection_options = " ".join(self.ssh_connection_options)

return (
"ssh {{address}} "
"-l {{user}} "
"-p {{port}} "
"-i {{identity_file}} "
"ssh {address} "
"-l {user} "
"-p {port} "
"-i {identity_file} "
f"{connection_options}"
)

Expand Down

0 comments on commit 9279b58

Please sign in to comment.