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

githubrepo hook fails to use ssh-agent #2731

Closed
packettoobig opened this issue Mar 17, 2023 · 1 comment
Closed

githubrepo hook fails to use ssh-agent #2731

packettoobig opened this issue Mar 17, 2023 · 1 comment
Labels

Comments

@packettoobig
Copy link
Contributor

packettoobig commented Mar 17, 2023

Related file : https://github.com/ytti/oxidized/blob/master/lib/oxidized/hook/githubrepo.rb#L70

Logs

I, [2023-03-16T09:42:46.514324 #29]  INFO -- : GithubRepo: Pushing local repository(/root/.config/oxidized/alldevices.git/)...
I, [2023-03-16T09:42:46.514483 #29]  INFO -- : GithubRepo: to remote: ssh://git@git.example.com:oxidized/alldevices.git
E, [2023-03-16T09:42:46.659204 #29] ERROR -- : Hook push_to_remote (#<GithubRepo:0x0000560b1b80e040>) failed (#<NoMethodError: undefined method `has_key?' for "ssh://git@git.example.com:oxidized/alldevices.git":String>) for event :post_store

Relevant config section :

hooks:
  push_to_remote:
    type: githubrepo
    events: [post_store]
    remote_repo: ssh://git@git.example.com:oxidized/alldevices.git

Commenting-out the following lines makes the hook function as expected :

      elsif cfg.has_key?('remote_repo') && cfg.remote_repo.has_key?(node.group) && cfg.remote_repo[node.group].has_key?('privatekey')
        pubkey = cfg.remote_repo[node.group].has_key?('publickey') ? cfg.remote_repo[node.group].publickey : nil
        log "Authenticating using ssh keys as '#{git_user}' for '#{node.group}/#{node.name}'", :debug
        rugged_sshkey(git_user: git_user, privkey: cfg.remote_repo[node.group].privatekey, pubkey: pubkey)

Looks like the section was added in #2480
ssh-agent (the "else" which works) was added in #343

In my local prod environment, I'm running with the 4 lines commented-out.
I did not manage to edit the elsif condition due to my nonexistent ruby skills.

@packettoobig packettoobig changed the title githubrepo hooks fails to use ssh-agent githubrepo hook fails to use ssh-agent Mar 20, 2023
@github-actions github-actions bot added the Stale label May 20, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 27, 2023
@packettoobig
Copy link
Contributor Author

Still an issue, even thought it was auto closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant