NetDocuments-Archive / rd-winrm-plugin

Allows rundeck to execute commands with powershell
Apache License 2.0
31 stars 19 forks source link

/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- winrm (LoadError) #33

Closed iaingblack closed 7 years ago

iaingblack commented 7 years ago

Hi there,

Really sorry, i'm sure its me more than anything else. But, I cannot get rundeck to run this as a plugin on a RHEL7 machine. I get this error every time.

/usr/share/rubygems/rubygems/dependency.rb:296:in `to_specs': Could not find 'winrm' (= 1.8.1) among 5 total gem(s) (Gem::LoadError)
    from /usr/share/rubygems/rubygems/dependency.rb:307:in `to_spec'
    from /usr/share/rubygems/rubygems/core_ext/kernel_gem.rb:47:in `gem'
    from /var/lib/rundeck/libext/cache/rd-winrm-plugin-1.5.1/winrmexe.rb:2:in `<main>'
Failed: NonZeroResultCode: [WinRMexe] Result code: 1

It cannot find the winrm gem. But, if I run this as a job on the localhost it works fine;

'/var/lib/rundeck/libext/cache/rd-winrm-plugin-1.5.1/winrmexe.rb'

I hardcoded some variables in the script like this, and ran it, worked perfectly, in rundeck as a command on the localhost as the rundeck user.

auth = 'negotiate'
...
port = '5985'

Here is my gem env and gem list. It should work. Rundeck can run the command from the terminal successfully if I set ENV variables as it expects, also as a rundeck command if I hardcode the script with variables but just not as a job via the plugin used in a project. I've been trying to fix for a good few hours and getting nowhere sadly. Any ideas? I must be doing something really daft? Below is as the rundeck user.

GEM ENV

RubyGems Environment:
  - RUBYGEMS VERSION: 2.0.14
  - RUBY VERSION: 2.0.0 (2014-11-13 patchlevel 598) [x86_64-linux]
  - INSTALLATION DIRECTORY: /var/lib/rundeck/.gem/ruby
  - RUBY EXECUTABLE: /usr/bin/ruby
  - EXECUTABLE DIRECTORY: /var/lib/rundeck/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /var/lib/rundeck/.gem/ruby
     - /usr/share/gems
     - /usr/local/share/gems
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/

GEM LIST

bigdecimal (1.2.0)
builder (3.2.2)
bundler (1.13.6)
erubis (2.7.0)
ffi (1.9.14)
gem-path (0.6.1)
gssapi (1.2.0)
gyoku (1.3.1)
httpclient (2.8.2.4)
io-console (0.4.2)
json (1.7.7)
little-plugger (1.1.4)
logging (2.1.0)
multi_json (1.12.1)
nori (2.6.0)
psych (2.0.0)
rdoc (4.0.0)
rubyntlm (0.6.1)
rubyzip (1.2.0)
winrm (1.8.1)
winrm-fs (0.4.3)

GEMS FOLDER

ls -lah /var/lib/rundeck/.gem/ruby/gems/
total 44K
drwxr-x--- 18 rundeck rundeck 4.0K Nov  1 10:35 .
drwxr-x---  7 rundeck rundeck   77 Nov  1 09:55 ..
drwxr-x---  6 rundeck rundeck  114 Nov  1 10:04 builder-3.2.2
...
drwxr-x---  5 rundeck rundeck 4.0K Nov  1 10:04 winrm-1.8.1
drwxr-x---  5 rundeck rundeck 4.0K Nov  1 10:05 winrm-fs-0.4.3
iaingblack commented 7 years ago

Hi all. My mistake. For some unknown reason, the /usr/local/share/gems folder was unreadable by anyone other than root so rundeck was failing to get the gems it needed. I have no idea how it happened. I'll delete this issue.