8000 githubrepo hook fails to use ssh-agent · Issue #2731 · ytti/oxidized · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
githubrepo hook fails to use ssh-agent #2731
Closed as not planned
Closed as not planned
@packettoobig

Description

@packettoobig

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0