-
Notifications
You must be signed in to change notification settings - Fork 22
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
patch suggested by @AnvithLobo #38
patch suggested by @AnvithLobo #38
Conversation
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.
Looks good to me. Just beware that self._play_context
may have it's own issues we are not aware of since Ansible recommends using self.get_option()
.
don't you already use _play_context elsewhere to get the remote user ? |
I only wrote the PR to make the patch merge-able. You decide which function/method to use here. |
@dmp1ce @stefangweichinger @boucman I'm sorting through all the new PRs right now, and this one is the first one. Does this solve your original problem with the variables? |
It probably does solve @stefangweichinger issue but it might have unintended consequences because |
I can't tell right now, the original bug in debops is debops/debops#1731 and @boucman reported it. |
The tests included in PR #40 ought to verify if this fix is working or not. |
both the fixes work but like @dmp1ce said it might have unintended consequences. |
Ok, I need to be honest with myself: I will not find the time to test anything in the near futur. I am reasonably confident this will fix my bug since that is almost how I did my workaround. |
thanks @boucman |
Could/should we ask someone from the ansible-project to have a look and decide if |
If @AnvithLobo says that both ways works, and no one is sure which one is the correct way to solve this, plus there might be side effects, I'm very much in favor of the suggestion from @stefangweichinger to include external experience. I'm going to merge whatever bugfix solves this problem, if someone can confirm that it's solved the "proper" way. |
Yeah i would vote for @dmp1ce's PRs as we don't modify any other code how we are getting args other than just removing LXC version checking. Since anything above ubuntu 16.04 will have lxc version 2 or above installed by default i dont think this check is necessary any longer. |
I still don't get why you say that both ways work, only one is potentially correct, but yet this should be merged as it is without any confirmation. For the version checks: I agree that the code for v1 should be removed, it's no longer supported. I tend to disagree to remove all the checks, just to potentially add this later. But I don't have strong feelings about this. However the tests should have a version check, and this can be added in the PR before merging it. This does not need another PR just to fix the PR which is missing that. |
@dmp1ce could you point us to some docs or so pointing out why I also agree on adding/fixing the tests within this PR, as @andreasscherbaum said. |
I had a conversation in the #ansible room on IRC. @tadeboro told me a few things, I quote some lines here (and he told me to point out that he is "NOT part of the core Ansible team, I am just a developer who wrote too much ansible-related code ;)" ):
As a pointer to some modern way he mentioned: https://steampunk.si/blog/let-us-give-ansible-a-rest/
I will have a look at that in the afternoon. I hope this helps to decide .... thanks @tadeboro EDIT: sorry for the cutNpaste, not all URLs clickable ... but the tl;dr is clear, I assume |
I found ansible/ansible#70438 upstream and in I noticed that EDIT: I had removed that "u" myself in 1bbdf79 .. sorry |
ah by both solution works I meant it solves the problem currently at hand. One is dirty fix to fix the current problem at hand without much thought into what other issues might cause in the future and the other Doesn't modify much of the code and also solves the problem. By the looks of it people in I don't have much experience with Ansible. So i couldn't predict what troubles About the test yes. But i think it could be improved and 17 seperate checks might be a overkill IMO. #37 (comment) |
So is this PR ready to be merged in? It evolved quite a bit, and in the end it's not very long now. |
I have to look through all this once again, I don't have the full overview anymore right now. IMO it fixes the issue, keeps in the version check (which is nice to have just to be safe), and uses I don't fully understand the tests and if there are false positives etc ... If there are, I think there should be a new and separate PR for that. |
I'm as confused as you because of the many PRs and changes. |
@andreasscherbaum jitsi in the next days? |
@stefangweichinger Yes, please! |
@andreasscherbaum write to me at office @ oops co at ... maybe tmrw |
@dmp1ce @AnvithLobo We plan to have a Jitsi call early next week, and discuss which PRs to merge, in which order. If you plan to join, please drop me an email at @ la. |
I can probably be available any day between 9am - 4pm EST. I couldn't find your email @andreasscherbaum I am just going to suggest #40 should be merged first, because it implements valid tests. The current tests are showing false positives! Next I will recommend #41 because it is the most simple change to get tests passing. |
@dmp1ce My email address is: And I see what GitHub did with the < and > in the previous text... |
Scheduled a meeting for Monday, 13:00 UTC (15:00 CEST). |
The meeting link is: https://meet.jit.si/lxc-ssh-merging |
Ah, doesn't work as expected, as re-running the tests will use the same GITHUB_SHA and GITHUB_REF. @stefangweichinger Can you please pull the changes from #40 into this branch, rebase, and then push this again? This should trigger the tests with the new code from #40. Thanks! |
Co-authored-by: David Parrish <daveparrish@tutanota.com> Co-authored-by: AnvithLobo <64419387+AnvithLobo@users.noreply.github.com>
@andreasscherbaum I cherry-picked 94d2d0c from #40 ... / should work, right? |
@stefangweichinger If you rebase to HEAD, it should work. The previous commits are the badges you added. |
@andreasscherbaum "git rebase HEAD"; git push origin master" (in my branch "remote_user") doesn't change anything anymore. So I think above state is it .. unless I misunderstand you. |
@stefangweichinger Looks good, I think. @dmp1ce Can you please look into the GH Actions tests and see if that is what you expect from your tests? Thanks! |
Compare the test for this PR with the tests from the latest commit. The tests in the latest commit fail at the "Run test" step with ":
In this PR run test passes! |
Isn't that ... good? |
Yes! All good. This is the result I expected too. 🙂 |
great. Sounds as if our plan works. |
@dmp1ce Which means I can go ahead and merge this PR here? |
Yes, it is fine. I had to double check locally because Github shows a much bigger diff than there actually is. This is the actual diff from this PR. diff --git a/lxc_ssh.py b/lxc_ssh.py
index 37a062f..04684e7 100644
--- a/lxc_ssh.py
+++ b/lxc_ssh.py
@@ -517,8 +517,8 @@ class Connection(ConnectionBase):
self.user = self._play_context.remote_user
self.control_path = None
self.control_path_dir = None
- self.lxc_version = None
+ def _set_version(self):
# LXC v1 uses 'lxc-info', 'lxc-attach' and so on
# LXC v2 uses just 'lxc'
(returncode2, stdout2, stderr2) = self._exec_command("which lxc", None, False)
@@ -535,6 +535,10 @@ class Connection(ConnectionBase):
raise AnsibleConnectionFailure("Cannot identify LXC version")
sys.exit(1)
+ def set_options(self, *args, **kwargs):
+ super(Connection, self).set_options(*args, **kwargs)
+ self._set_version()
+
# The connection is created by running ssh/scp/sftp from the exec_command,
# put_file, and fetch_file methods, so we don't need to do any connection
# management here.
@@ -690,7 +694,7 @@ class Connection(ConnectionBase):
to_bytes(a, errors="surrogate_or_strict")
for a in self._split_ssh_args(ssh_args)
]
- self._add_args(b_command, b_args, "ansible.cfg set ssh_args")
+ self._add_args(b_command, b_args, u"ansible.cfg set ssh_args")
# Now we add various arguments that have their own specific settings
# defined in docs above.
@@ -750,6 +754,7 @@ class Connection(ConnectionBase):
)
self.user = self.get_option("remote_user")
+
if self.user:
self._add_args(
b_command,
|
🎉 |
Add lxc_container option and documentation Merge as discussed [here](#38 (comment)).
suggested by @AnvithLobo in #37