Skip to content

Instantly share code, notes, and snippets.

@jedi4ever
Created May 15, 2011 18:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jedi4ever/973412 to your computer and use it in GitHub Desktop.
Save jedi4ever/973412 to your computer and use it in GitHub Desktop.
Patch to take mcollective gitcode and turn it into a gem for mcollective-client
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "mcollective-client"
s.version = "1.0.2"
s.platform = Gem::Platform::RUBY
s.authors = ["RI Pienaar"]
s.email = ["ripienaar@puppetlabs.com"]
s.homepage = "https://github.com/puppetlabs/marionette-collective"
s.summary = %q{Mcollective client}
s.description = %q{Interact with mcollective}
s.required_rubygems_version = ">= 1.3.6"
s.rubyforge_project = "mcollective-client"
s.bindir = '.'
s.add_dependency "stomp"
s.files = `git ls-files`.split("\n")
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^mc-(.*)/ ? "mc-"+$1 : nil}.compact
s.require_path = 'lib'
end
diff --git a/Rakefile b/Rakefile
index 805f1cd..ecf5c52 100644
--- a/Rakefile
+++ b/Rakefile
@@ -17,6 +17,10 @@ ENV["RPM_VERSION"] ? CURRENT_VERSION = ENV["RPM_VERSION"] : CURRENT_VERSION = PR
ENV["BUILD_NUMBER"] ? CURRENT_RELEASE = ENV["BUILD_NUMBER"] : CURRENT_RELEASE = PROJ_RELEASE
ENV["DEB_DISTRIBUTION"] ? PKG_DEB_DISTRIBUTION = ENV["DEB_DISTRIBUTION"] : PKG_DEB_DISTRIBUTION = "unstable"
+require 'bundler'
+require 'bundler/setup'
+Bundler::GemHelper.install_tasks
+
CLEAN.include(["build", "doc"])
def announce(msg='')
diff --git a/lib/mcollective/config.rb b/lib/mcollective/config.rb
index 8574472..ec40fc2 100644
--- a/lib/mcollective/config.rb
+++ b/lib/mcollective/config.rb
@@ -50,6 +50,10 @@ module MCollective
when "loglevel"
@loglevel = val
when "libdir"
+ # Add libdir plugins from gem
+ gem_libdir=File.expand_path(File.join(__FILE__,'..','..','..','lib'))
+ gem_plugindir=File.expand_path(File.join(__FILE__,'..','..','..','plugins'))
+ val=val+":"+gem_libdir+":"+gem_plugindir
paths = val.split(/:/)
paths.each do |path|
@libdir << path
@@ -57,6 +61,7 @@ module MCollective
$LOAD_PATH << path
end
end
+
when "identity"
@identity = val
when "color"
@jedi4ever
Copy link
Author

Install

  • git clone the mcollective github
  • apply this patch

now the rake command has extra tasks (see rake -T)

  • run 'rake build' and a gem is created in pkg/...
  • now you can gem install pkg/mcollective-version.gem

Issues:

  • @Version@ in lib/mcollective is hard to get, it's currently manual
  • if somewhere in the path to the mc- files (such as a gemset name with mc-test f.i.), loading of executables failes

Gotcha/Tip:(thx @ripienaar)

  • create an .mcollective file (similar to client.cfg)
  • create a directory .mcollective.d and set config accordingly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment