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

Fix templated ansible_ssh_common_args issues #956

Closed
wants to merge 1 commit into from

Conversation

momiji
Copy link

@momiji momiji commented Aug 22, 2022

Fixes #905

@Zocker1999NET
Copy link
Contributor

Zocker1999NET commented Aug 23, 2022

@momiji you may want to add fixes #905 to the description so GitHub successfully links the PR to the issue as its patch/fix.

@momiji
Copy link
Author

momiji commented Aug 23, 2022

@Zocker1999NET Sure, but where? In the title, or in the text below?
Sorry, I've never done this before...

@Zocker1999NET
Copy link
Contributor

@Zocker1999NET Sure, but where? In the title, or in the text below? Sorry, I've never done this before...

@momiji just add it to description, I don't think GitHub parses the title for that. And try to not put in a header like you already did, as GH didn't recognize that either. Probably good2know, you can use different keywords as well, see here

@moreati moreati changed the title patch #509 : ansible_ssh_common_args issues Fix templated ansible_ssh_common_args issues Jul 26, 2023
@setpill
Copy link

setpill commented Jul 11, 2024

@moreati Are there any plans to merge this? It looks like it would fix some long-standing issues (e.g. #599).

@setpill
Copy link

setpill commented Jul 12, 2024

Nevermind, applying this diff to 0.3.7 does not fix the issue for me.

Correction: this does fix the ssh_common_args, but I am running also into the issue that a templated ssh_user is not correctly handled.

@hungpr0
Copy link

hungpr0 commented Aug 20, 2024

I think this should be merged. I did the test on my side with mitogen 0.3.9. Without this patch, ssh_common_args doesn't work.

C.config.get_config_value("ssh_extra_args", plugin_type="connection", plugin_name="ssh", variables=self._task_vars.get("vars", {}))
C.config.get_config_value("ssh_args", plugin_type="connection", plugin_name="ssh", variables=local_vars),
C.config.get_config_value("ssh_common_args", plugin_type="connection", plugin_name="ssh", variables=local_vars),
C.config.get_config_value("ssh_extra_args", plugin_type="connection", plugin_name="ssh", variables=local_vars)
Copy link
Member

Choose a reason for hiding this comment

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

Note to self:

before: variables=self._task_vars.get("vars", {})
after:  variables=self._task_vars.get("hostvars", {}).get(self._inventory_name, {})

C.config.get_config_value("ssh_extra_args", plugin_type="connection", plugin_name="ssh", variables=self._task_vars.get("vars", {}))
C.config.get_config_value("ssh_args", plugin_type="connection", plugin_name="ssh", variables=local_vars),
C.config.get_config_value("ssh_common_args", plugin_type="connection", plugin_name="ssh", variables=local_vars),
C.config.get_config_value("ssh_extra_args", plugin_type="connection", plugin_name="ssh", variables=local_vars)
Copy link
Member

Choose a reason for hiding this comment

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

Note to self:

before: variables=self._task_vars.get("vars", {})
after:  variables=self._task_vars.get("hostvars", {}).get(self._inventory_name, {})

C.config.get_config_value("ssh_extra_args", plugin_type="connection", plugin_name="ssh", variables=self._task_vars.get("vars", {}))
C.config.get_config_value("ssh_args", plugin_type="connection", plugin_name="ssh", variables=local_vars),
C.config.get_config_value("ssh_common_args", plugin_type="connection", plugin_name="ssh", variables=local_vars),
C.config.get_config_value("ssh_extra_args", plugin_type="connection", plugin_name="ssh", variables=local_vars)
)
for term in ansible.utils.shlex.shlex_split(s or '')
Copy link
Member

@moreati moreati Sep 5, 2024

Choose a reason for hiding this comment

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

Note to self:

... for term in ansible.utils.shlex.shlex_split(s or '')]

probably behaves identically to

... for term in ansible.utils.shlex.shlex_split(s) if s]

An experiment/test would confirm this. If true, then I think MitogenViaSpec.ssh_args() and PlayContextSpec.ssh_args() are functionally identical. I think this PR would preserve this property.

@moreati
Copy link
Member

moreati commented Sep 5, 2024

@momiji sorry for the exremely long wait on this PR. I'm looking at now as part of #1114. Currently this PR needs

  • rebase on master
  • Regression test(s) (probably in tests/ansible/regression/)
  • An entry in docs/changelog.rst

Are you able to look at these? Otherwise I'm happy to look. May I push rebases and updates to your fork/branch momiji:master?

@moreati
Copy link
Member

moreati commented Sep 5, 2024

Are you able to look at these? [...] May I push rebases and updates to your fork/branch momiji:master?

Likely no to both. Momiji's fork has since been archived (Apr 18 2024).

@moreati
Copy link
Member

moreati commented Sep 6, 2024

Superceded by #1115

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.

Templating broken when constructing value for ansible_ssh_common_args
5 participants