#394 modify the code to avoid ssh Permission denied errors when no private key provided
Merged 5 years ago by kparal. Opened 5 years ago by lnie.
taskotron/ lnie/libtaskotron no-ssh-privkey  into  feature/ansiblize

file modified
+2 -1
@@ -115,7 +115,8 @@ 

          ]

  

          if self.run_remotely:

-             cmd.extend(['--private-key=%s' % self.arg_data['ssh_privkey']])

+             if self.arg_data['ssh_privkey']: 

+                 cmd.extend(['--private-key=%s' % self.arg_data['ssh_privkey']])

          else:

              cmd.extend(['--ask-become-pass', '--connection=local', '-e', 'local=true'])

  

when do runtask without ssh-privkey specified, you will see
'fatal: [*]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: no such identity: /home/lnie/libtaskotron/None: No such file or directory\r\nPermission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n", "unreachable": true}
testplan:
git clone https://pagure.io/task-rpmlint-ansible
runtask -d -i gzip-1.8-1.fc25 -t koji_build --ssh user@IP -a x86_64 task-rpmlint-ansible/run_tests.yml

How is any of this (changes on lines 5-21 in this diff) related to the PR's subject or description?

Looks un-needed, please clean this up.

It's better to use

if self.arg_data['ssh_privkey']: 

This is not needed if you write the if statement as advised above.

@kparal WRT

It's better to use if self.arg_data['ssh_privkey']:

Yeah, I agree. But note @lnie, that both @kparal's comments on line 26 in executor.py and line 16 of main.py are cohesive and go together. Just changing the line 26 will not do it.

@kparal WRT
It's better to use if self.arg_data['ssh_privkey']:

Thanks for your good advice

Yeah, I agree. But note @lnie, that both @kparal's comments on line 26 in executor.py and >line >16 of main.py are cohesive and go together. Just changing the line 26 will not do it.

yeah,they do.

rebased

5 years ago

I have modified the code according to the commits, and it works well if using the code without last Friday's modification .It seems that last friday's modification
dose not works itself, the runtask failed with ‘’error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178)...“. And runtask works well again if you git reset to the old code.

Looks reasonable to me, ack. Anyone has other thoughts?

@lnie, please keep the commit titles succinct next time and drop unnecessary words like "modify the code to". If you edit the git commit message in vim, it will show you once your title is too long (>72 chars). I'll adjust it before I commit it, no worries.

Pull-Request has been closed by kparal

5 years ago

Commit 89abc3d fixes this pull-request

Pull-Request has been merged by kparal

5 years ago
Metadata