Code Monkey home page Code Monkey logo

better-chef-rundeck's Issues

Docker dependency issue with ruby

Building the docker container will fail due to unresolved ruby versions.

error:

% docker build -t better-chef-rundeck .
[+] Building 16.1s (8/10)
 => [internal] load build definition from Dockerfile                                                                        0.0s
 => => transferring dockerfile: 636B                                                                                        0.0s
 => [internal] load .dockerignore                                                                                           0.0s
 => => transferring context: 2B                                                                                             0.0s
 => [internal] load metadata for docker.io/phusion/passenger-ruby21:latest                                                  1.8s
 => [1/7] FROM docker.io/phusion/passenger-ruby21@sha256:e09f5860b2bba8bc5813dd8fa0b894a8320ef411bf1e15a621f7782252569203   0.0s
 => CACHED [2/7] WORKDIR /home/app                                                                                          0.0s
 => CACHED [3/7] RUN git clone https://github.com/atheiman/better-chef-rundeck                                              0.0s
 => CACHED [4/7] WORKDIR /home/app/better-chef-rundeck                                                                      0.0s
 => ERROR [5/7] RUN bash -c 'sed -i"" -e "/passenger/s/~> 5.0/= $(passenger --version | grep -o '5.*')/" Gemfile' &&       14.2s
------
 > [5/7] RUN bash -c 'sed -i"" -e "/passenger/s/~> 5.0/= $(passenger --version | grep -o '5.*')/" Gemfile' &&     cat Gemfile && bundle update passenger &&     bundle install:
#8 0.580 source 'https://rubygems.org'
#8 0.580
#8 0.580 gem 'chef'
#8 0.580 gem 'passenger', require: 'phusion_passenger/rack_handler'
#8 0.580 gem 'sinatra'
#8 0.580
#8 0.580 group :development do
#8 0.580   gem 'chef-zero'
#8 0.580   gem 'rack-test'
#8 0.580   gem 'rubocop'
#8 0.580   gem 'sinatra-contrib'
#8 0.580 end
#8 5.320 Fetching gem metadata from https://rubygems.org/........
#8 13.87 Fetching gem metadata from https://rubygems.org/.
#8 13.92 Resolving dependencies...
#8 14.08 Bundler could not find compatible versions for gem "ruby":
#8 14.08   In Gemfile:
#8 14.08     ruby
#8 14.08
#8 14.08     chef was resolved to 13.6.4, which depends on
#8 14.08       bundler (>= 1.10) was resolved to 1.16.3, which depends on
#8 14.08         ruby (>= 1.8.7)
#8 14.08
#8 14.08     sinatra was resolved to 2.0.0, which depends on
#8 14.08       rack (~> 2.0) was resolved to 2.1.4, which depends on
#8 14.08         ruby (>= 2.2.2)
------
executor failed running [/bin/sh -c bash -c 'sed -i"" -e "/passenger/s/~> 5.0/= $(passenger --version | grep -o '5.*')/" Gemfile' &&     cat Gemfile && bundle update passenger &&     bundle install]: exit code: 6

However, running bundle update across all gems, rather than only passenger, lets it complete (and run) fine:

diff:

 % git diff
diff --git a/Dockerfile b/Dockerfile
index 9b30353..4e3a5aa 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -5,7 +5,7 @@ WORKDIR /home/app
 RUN git clone https://github.com/atheiman/better-chef-rundeck
 WORKDIR /home/app/better-chef-rundeck
 RUN bash -c 'sed -i"" -e "/passenger/s/~> 5.0/= $(passenger --version | grep -o '5.*')/" Gemfile' && \
-    cat Gemfile && bundle update passenger && \
+    cat Gemfile && bundle update && \
     bundle install

 USER root

result:

 % docker build -t better-chef-rundeck .
[+] Building 0.9s (11/11) FINISHED
 => [internal] load build definition from Dockerfile                                                                        0.0s
 => => transferring dockerfile: 626B                                                                                        0.0s
 => [internal] load .dockerignore                                                                                           0.0s
 => => transferring context: 2B                                                                                             0.0s
 => [internal] load metadata for docker.io/phusion/passenger-ruby21:latest                                                  0.8s
 => [1/7] FROM docker.io/phusion/passenger-ruby21@sha256:e09f5860b2bba8bc5813dd8fa0b894a8320ef411bf1e15a621f7782252569203   0.0s
 => CACHED [2/7] WORKDIR /home/app                                                                                          0.0s
 => CACHED [3/7] RUN git clone https://github.com/atheiman/better-chef-rundeck                                              0.0s
 => CACHED [4/7] WORKDIR /home/app/better-chef-rundeck                                                                      0.0s
 => CACHED [5/7] RUN bash -c 'sed -i"" -e "/passenger/s/~> 5.0/= $(passenger --version | grep -o '5.*')/" Gemfile' &&       0.0s
 => CACHED [6/7] RUN echo 'server {\n  listen 80;\n  root /home/app/better-chef-rundeck/public;\n  passenger_enabled on;\n  0.0s
 => CACHED [7/7] RUN rm /etc/nginx/sites-enabled/default && rm /etc/service/nginx/down                                      0.0s
 => exporting to image                                                                                                      0.0s
 => => exporting layers                                                                                                     0.0s
 => => writing image sha256:c4820b7354ac7c2a8691060cb0f1ed29bcffd4de874a078a7fed5c58fb82c9cc                                0.0s
 => => naming to docker.io/library/better-chef-rundeck                                                                      0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them

That's probably not the best solution moving forward, but it'll unblock anyone that wants to try it out.

assign multiple attributes to tags?

Hi, just getting started with better-chef-rundeck, and wondering if something like this is possible:
To add multiple different attributes from chef as rundeck tags.
For example:
If I wanted to use platform and platform_version as tags, I would try something like this:
?tags=platform&tags=platform_version
or
?tags=platform&tags+=platform_version

I know neither of these is possible, just throwing the idea out there to see if anyone else thinks it would be useful. I know I can just assign said attributes to their own individual rundeck attributes, and that can be made to work, but the tags seem a little more flexible, and wondering how to add multiple tags.

Support more than 1000 nodes

Currently, better-chef-rundeck only returns the first 1000 nodes that match the search criteria. We need the ability to return 5000+ nodes that match.

BCR with Multiple Orgs

In our current implementation of Chef, we have different organizations. Is there a way to use better-chef-rundeck with multiple chef organizations? If so, How could I implement this?

Thanks.

Unable to fetch node details in rundeck

We are running better-chef-rundeck inside docker container but we are running two containers for 2 regions. same configuration has been done in both the containers but from one container we are unable to fetch node data.

URL for dallas region nodes =http://172.17.0.3:8080/os:linux?name=hostname&override_username=msdomain1\rundeckadmin1&hostname=ipaddress&ip=ipaddress&tags=chef_environment&osArch=kernel,machine&os&platform&platform_version&roles&fqdn&recipes&chef_name=name&mstar_metadata=mstar_metadata&region=mstar_classification,region Timeout: 30

Error : node(s) missing name attribute. You've overriden the name attribute to the attribute path hostname in your GET parameters name=hostname&override_username=inetcontrol&hostname=ipaddress&ip=ipaddress&tags=chef_environment&osArch=kernel,machine&os&platform&platform_version&roles&fqdn&recipes&chef_name=name

But 2nd URL is working properly which is for chicago server nodes.

http://172.17.0.2:8080/os:linux?name=hostname&override_username=msdomain1\rundeckadmin1&hostname=ipaddress&ip=ipaddress&tags=chef_environment&osArch=kernel,machine&os&platform&platform_version&roles&fqdn&recipes&chef_name=name&mstar_metadata=mstar_metadata&region=mstar_classification,region Timeout: 30

Both the containers are working properly we did not see any error in docker logs. also chef server is up and running properly. on chef servers in knife node list all node are showing correctly but those details are not able to fetch in rundeck.

We got error in rundeck service.log

image
rundeck_error

This is old setup previously it was working fine but suddenly we started to face this issue.

curl "http://172.17.0.2:8080"
curl "http://172.17.0.3:8080" for both of this commands we are getting output.
better-chef-rundeck is up and running!

parsing error with new version of Rundeck 2.9.3

Rundeck 2.9.3 requires Java version 1.8 which appears to be the cause of the following error:

aused by: com.dtolabs.rundeck.core.common.NodeFileParserException: mapping values are not allowed here
in "", line 2, column 12:
chef_config: /var/lib/rundeck/.chef/knife.rb
^

at com.dtolabs.rundeck.core.common.NodesYamlParser.parse(NodesYamlParser.java:130)
at com.dtolabs.rundeck.core.resources.format.ResourceYamlFormatParser.parseDocument(ResourceYamlFormatParser.java:65)
... 84 more

Caused by: mapping values are not allowed here

I've attempted to set the chef_config variable via the ENV var as well as in a Passengerfile.json and in the config.ru itself to no avail.

Missing attribute for rundeck SSH plugin

Rundeck SSH Plugin requires hostname attribute with the node in order to create a connection as stated here in the docs:
http://rundeck.org/2.7.3/plugins-user-guide/ssh-plugins.html

Adding a hostname field fixed this for me. Could possibly just replace the fqdn field with hostname.

`index 2e708bf..8488b35 100644
--- a/lib/better_chef_rundeck.rb
+++ b/lib/better_chef_rundeck.rb
@@ -58,6 +58,7 @@ class BetterChefRundeck < Sinatra::Base
default_filter_result = {
environment: ['chef_environment'],
fqdn: ['fqdn'],

  •  hostname:    ['fqdn'],
     ip:          ['ipaddress'],
     run_list:    ['run_list'],
     roles:       ['roles'],`
    

Chef Search Doesn't Include Hostname Attribute for Rundeck

I've got this working in Rundeck, but jobs won't run because the node attributes created from Chef don't include a "hostname".

Here's a node:

db02:
  environment: testing
  fqdn: db02.here.com
  ip: 10.50.2.82
  run_list:
  - recipe[base]
  - recipe[db]
  roles: []
  platform: centos
  tags: []

When I try to run jobs or commands I get:
java.lang.IllegalArgumentException: Null hostname value

I've tried overriding the hostname in the node request from Chef, indicated in your README, like "http://127.0.0.1:9292/*:*?default_hostname=${node.fqdn}", but the jobs don't seem to want to use an option like that when they run.

I'm probably doing something wrong here. If you can help point me in the right direction I would appreciate it.

tags cannot be nil in rundeck

in the case where Tags are nil in Chef, they will need to default to [] so that Rundeck doesn't throw this error.
Caused by: java.lang.NullPointerException
at com.dtolabs.rundeck.core.common.NodeEntryImpl.setTags(NodeEntryImpl.java:127)

Could either add:
if node['tags'].nil?
node['tags'] = []
end

or figure out how to make ?default_tags=[] work?

Can't compile with Chef 13

Hi!

I'm try to compile better-chef-rundeck with Chef 13... and don't work.
With Chef 13 the same cookbook recipe, install better-chef-rundeck without any problem.

The output:

       ---- Begin output of /opt/chef/embedded/bin/bundle install --deployment --without development test ----
       STDOUT: `/root` is not writable.
       Bundler will use `/tmp/bundler/home/vagrant' as your home directory temporarily.
       Fetching gem metadata from https://rubygems.org/..........
       Fetching version metadata from https://rubygems.org/...
       Fetching dependency metadata from https://rubygems.org/..
       Installing rake 11.2.2
       Installing builder 3.2.2
       Using bundler 1.14.6
       Installing fuzzyurl 0.8.0
       Installing mixlib-config 2.2.1
       Installing mixlib-shellout 2.2.6
       Installing libyajl2 1.2.0 with native extensions
       Installing hashie 3.4.4
       Installing mixlib-log 1.6.0
       Installing rack 1.6.4
       Installing uuidtools 2.1.5
       Installing diff-lcs 1.2.5
       Installing erubis 2.7.0
       Installing highline 1.7.8
       Installing iniparse 1.4.2
       Installing mixlib-cli 1.6.0
       Installing net-ssh 3.1.1
       Installing ffi 1.9.10 with native extensions
       Installing ipaddress 0.8.3
       Installing plist 3.2.0
       Installing systemu 2.6.5
       Installing wmi-lite 1.0.0
       Installing proxifier 1.0.3
       Installing rspec-support 3.4.1
       Installing multi_json 1.12.1
       Installing net-telnet 0.1.1
       Installing sfl 2.2
       Installing syslog-logger 1.6.8
       Installing tilt 2.0.5
       Installing chef-config 12.11.18
       Installing ffi-yajl 2.2.3 with native extensions
       Installing mixlib-authentication 1.4.1
       Installing passenger 5.0.28 with native extensions
       Installing rack-protection 1.5.3
       Installing net-sftp 2.1.2
       Installing net-ssh-gateway 1.2.0
       Installing net-scp 1.2.1
       Installing rspec-core 3.4.4
       Installing rspec-expectations 3.4.0
       Installing rspec-mocks 3.4.1
       Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
       
       current directory:
       /opt/plugins/better-chef-rundeck/vendor/bundle/ruby/2.4.0/gems/ffi-yajl-2.2.3/ext/ffi_yajl/ext/encoder
       /opt/chef/embedded/bin/ruby -r ./siteconf20170612-5176-1vgdplc.rb extconf.rb
       -I/opt/plugins/better-chef-rundeck/vendor/bundle/ruby/2.4.0/gems/libyajl2-1.2.0/lib/libyajl2/vendored-libyajl2/include
       -I/opt/chef/embedded/include -O2 -O3 -g -pipe -fPIC
       -L/opt/plugins/better-chef-rundeck/vendor/bundle/ruby/2.4.0/gems/libyajl2-1.2.0/lib/libyajl2/vendored-libyajl2/lib
       -L. -Wl,-rpath,/opt/chef/embedded/lib -fstack-protector -L/opt/chef/embedded/lib
       -rdynamic -Wl,-export-dynamic -L/opt/chef/embedded/lib 
       -Wl,-R/opt/chef/embedded/lib
       checking for yajl/yajl_tree.h... yes
       creating Makefile
       
       current directory:
       /opt/plugins/better-chef-rundeck/vendor/bundle/ruby/2.4.0/gems/ffi-yajl-2.2.3/ext/ffi_yajl/ext/encoder
       make "DESTDIR=" clean
       
       current directory:
       /opt/plugins/better-chef-rundeck/vendor/bundle/ruby/2.4.0/gems/ffi-yajl-2.2.3/ext/ffi_yajl/ext/encoder
       make "DESTDIR="
       compiling encoder.c
       encoder.c: In function ‘Init_encoder’:
       encoder.c:380:20: error: ‘rb_cFixnum’ undeclared (first use in this function)
          rb_define_method(rb_cFixnum, "ffi_yajl", rb_cFixnum_ffi_yajl, 2);
                    ^
       encoder.c:380:20: note: each undeclared identifier is reported only once for
       each function it appears in
       encoder.c:381:20: error: ‘rb_cBignum’ undeclared (first use in this function)
          rb_define_method(rb_cBignum, "ffi_yajl", rb_cBignum_ffi_yajl, 2);
                    ^
       make: *** [encoder.o] Error 1
       
       make failed, exit code 2
       
       Gem files will remain installed in
       /opt/plugins/better-chef-rundeck/vendor/bundle/ruby/2.4.0/gems/ffi-yajl-2.2.3
       for inspection.
       Results logged to
       /opt/plugins/better-chef-rundeck/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0/ffi-yajl-2.2.3/gem_make.out
       
       An error occurred while installing ffi-yajl (2.2.3), and Bundler cannot
       continue.
       Make sure that `gem install ffi-yajl -v '2.2.3'` succeeds before bundling.
       STDERR: 
       ---- End output of /opt/chef/embedded/bin/bundle install --deployment --without development test ----
       Ran /opt/chef/embedded/bin/bundle install --deployment --without development test returned 5
       [2017-06-12T13:36:12+00:00] ERROR: execute[bundle_install] (fif_rundeck::chef_rundeck line 35) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '5'

support multiple chef orgs

authentication to the chef server just needs one key and then permission to the orgs it requests searches from. simple implementation allowing support for multiple orgs:
requests to the app follow /<org>/<query>

examples:

  • GET /org-a/tags:some-tag
  • GET /org-b/tags:some-tag

each of those requests would hit their respective chef servers

to allow backwards compatibility, the chef org could be a get parameter.

Possibly in the future this could even support multiple chef servers.

Could not find rake-13.0.1 in any of the sources (Bundler::GemNotFound)

Recent Docker builds of better-chef-rundeck are resulting in a runtime failure with the following error:

App 75 output: Error: The application encountered the following error: Could not find rake-13.0.1 in any of the sources (Bundler::GemNotFound)
App 75 output: /usr/local/rvm/rubies/ruby-2.5.7/lib/ruby/site_ruby/2.5.0/bundler/spec_set.rb:91:in block in materialize' App 75 output: /usr/local/rvm/rubies/ruby-2.5.7/lib/ruby/site_ruby/2.5.0/bundler/spec_set.rb:85:in map!'
App 75 output: /usr/local/rvm/rubies/ruby-2.5.7/lib/ruby/site_ruby/2.5.0/bundler/spec_set.rb:85:in materialize' App 75 output: /usr/local/rvm/rubies/ruby-2.5.7/lib/ruby/site_ruby/2.5.0/bundler/definition.rb:170:in specs'
App 75 output: /usr/local/rvm/rubies/ruby-2.5.7/lib/ruby/site_ruby/2.5.0/bundler/definition.rb:237:in specs_for' App 75 output: /usr/local/rvm/rubies/ruby-2.5.7/lib/ruby/site_ruby/2.5.0/bundler/definition.rb:226:in requested_specs'
App 75 output: /usr/local/rvm/rubies/ruby-2.5.7/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:108:in block in definition_method' App 75 output: /usr/local/rvm/rubies/ruby-2.5.7/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:20:in setup'
App 75 output: /usr/local/rvm/rubies/ruby-2.5.7/lib/ruby/site_ruby/2.5.0/bundler.rb:107:in setup' App 75 output: /usr/local/rvm/rubies/ruby-2.5.7/lib/ruby/site_ruby/2.5.0/bundler/setup.rb:20:in <top (required)>'
App 75 output: /usr/local/rvm/rubies/ruby-2.5.7/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in require' App 75 output: /usr/local/rvm/rubies/ruby-2.5.7/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in require'
App 75 output: /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:363:in activate_gem' App 75 output: /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:221:in block in run_load_path_setup_code'
App 75 output: /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:527:in running_bundler' App 75 output: /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:220:in run_load_path_setup_code'
App 75 output: /usr/share/passenger/helper-scripts/rack-preloader.rb:91:in preload_app' App 75 output: /usr/share/passenger/helper-scripts/rack-preloader.rb:189:in block in module:App'
App 75 output: /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:380:in run_block_and_record_step_progress' App 75 output: /usr/share/passenger/helper-scripts/rack-preloader.rb:188:in module:App'
App 75 output: /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in <module:PhusionPassenger>' App 75 output: /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in

'

I expect it a bundler/rake-related issue.

URI escape default_ and override_ GET params

Only apply URI.escape to special characters in default_ and override_ GET params.

Only chars I've found that explicitly need URI encoding are curly braces:

  • ?default_username=$option.username works fine
  • ?default_username=${option.username} returns a 400 Bad Request:
bad URI `/chef_environment:ets_alpha_build_65?default_username=${option.username}'.

Note that calling URI.escape multiple times has likely undesired effects because it escapes %:

irb(main):001:0> require 'uri'
=> true
irb(main):002:0> URI.escape '${option.username}'
=> "$%7Boption.username%7D"
irb(main):003:0> URI.escape '$%7Boption.username%7D'
=> "$%257Boption.username%257D"

paginate through all results from chef query

chef_nodes = Chef::Search::Query.new.search(:node, query, filter_result: filter_result)[0]

should be

chef_nodes = []
Chef::Search::Query.new.search(:node, query, filter_result: filter_result) do |n|
  chef_nodes << n
end

version

there should be a version attribute

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.