Bug #4820

Some commands do not check ONE_AUTH file

Added by EOLE Team about 4 years ago. Updated about 4 years ago.

Status:ClosedStart date:09/23/2016
Priority:NormalDue date:
Assignee:Jaime Melis% Done:

0%

Category:CLI
Target version:Release 5.2
Resolution:fixed Pull request:
Affected Versions:Development, OpenNebula 5.0

Description

Hello,

We are running CLI commands from a systemd service but the HOME is not set, we found issues with the following:

  • oneuser
    eole@one-frontend:/$ unset HOME; oneuser list
    /usr/lib/one/ruby/cli/one_helper/oneuser_helper.rb:29:in `<class:OneUserHelper>': undefined method `+' for nil:NilClass (NoMethodError)
        from /usr/lib/one/ruby/cli/one_helper/oneuser_helper.rb:27:in `<top (required)>'
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/bin/oneuser:31:in `<main>'
    
  • oneflow-template
    eole@one-frontend:/$ unset HOME; oneflow-template list
    /usr/lib/one/ruby/cloud/CloudClient.rb:58:in `<module:CloudClient>': undefined method `+' for nil:NilClass (NoMethodError)
        from /usr/lib/one/ruby/cloud/CloudClient.rb:50:in `<top (required)>'
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/one/ruby/opennebula/oneflow_client.rb:18:in `<top (required)>'
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/bin/oneflow-template:31:in `<main>'
    

Other commands have a more explicit message:

eole@one-frontend:/$ onehost list
/usr/lib/one/ruby/opennebula/client.rb:130:in `initialize': ONE_AUTH file not present (RuntimeError)
    from /usr/lib/one/ruby/cli/one_helper.rb:412:in `new'
    from /usr/lib/one/ruby/cli/one_helper.rb:412:in `get_client'
    from /usr/lib/one/ruby/cli/one_helper.rb:470:in `set_client'
    from /usr/bin/onehost:43:in `block (2 levels) in <main>'
    from /usr/lib/one/ruby/cli/command_parser.rb:445:in `run'
    from /usr/lib/one/ruby/cli/command_parser.rb:76:in `initialize'
    from /usr/bin/onehost:36:in `new'
    from /usr/bin/onehost:36:in `<main>'

I found that all commands except oneuser and oneflow-template fallback to use /var/lib/one/.one/one_auth, which works when running as oneadmin.

Regards.

NB: I'm not sure between a bug or request.


Related issues

Related to Bug #4819: oneuser fails if $HOME is not set Closed 09/23/2016

Associated revisions

Revision 342bc17e
Added by Jaime Melis about 4 years ago

B #4820: Some commands do not check ONE_AUTH file

Revision 2b31d82a
Added by Jaime Melis about 4 years ago

B #4820: It should not raise an exception directly

History

#1 Updated by Ruben S. Montero about 4 years ago

  • Related to Bug #4819: oneuser fails if $HOME is not set added

#2 Updated by Ruben S. Montero about 4 years ago

  • Status changed from Pending to New
  • Assignee set to Jaime Melis
  • Target version set to Release 5.2
  • Affected Versions Development added

#3 Updated by Jaime Melis about 4 years ago

  • Status changed from New to Closed
  • Resolution set to fixed

#4 Updated by Jaime Melis about 4 years ago

Thanks EOLE team for your accurate reports, makes development easier ;)

Also available in: Atom PDF