Skip to content

Commit

Permalink
Issue 102 - Release 0.4.7
Browse files Browse the repository at this point in the history
Merge branch 'development'
  • Loading branch information
The Marionette Collective committed Jun 29, 2010
2 parents 091bc7f + 439797c commit b6a083f
Show file tree
Hide file tree
Showing 17 changed files with 415 additions and 93 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -6,7 +6,7 @@ require 'rake/clean'
require 'find'

PROJ_DOC_TITLE = "The Marionette Collective"
PROJ_VERSION = "0.4.6"
PROJ_VERSION = "0.4.7"
PROJ_RELEASE = "1"
PROJ_NAME = "mcollective"
PROJ_RPM_NAMES = [PROJ_NAME]
Expand Down
18 changes: 18 additions & 0 deletions ext/vim/_.snippets
@@ -0,0 +1,18 @@
snippet mcagent
module MCollective
module Agent
class ${1:Agentname}<RPC::Agent
metadata :name => "${2:`Filename('', 'name')`}",
:description => "${3:description}",
:author => "${4:`g:snips_author`}",
:license => "${5:license}",
:version => "${6:version}",
:url => "${7:homepage}",
:timeout => ${8:run timeout}

action "${9:action name}" do
${10}
end
end
end
end
64 changes: 64 additions & 0 deletions ext/vim/mcollective_ddl.snippets
@@ -0,0 +1,64 @@
# Snippets for use with VIM and http://www.vim.org/scripts/script.php?script_id=2540
#
# These snippets help you write Agent DDLs. Install the VIM Snippets system
# and copy this to your snippets directory.
#
# Create a file .vim/ftdetect/mcollective_ddl.vim with the following:
#
# au BufRead,BufNewFile *.ddl setfiletype mcollective_ddl
#
# Your file type should now be correctly set automatically and editing
# DDLs should be easier.
#
# Please contact R.I.Pienaar <rip@devco.net> for additions and feedback,
snippet meta
metadata :name => "${1:`Filename('', 'name')`}",
:description => "${2:description}",
:author => "${3:`g:snips_author`}",
:license => "${4:license}",
:version => "${5:version}",
:url => "${6:homepage}",
:timeout => ${7:run timeout}

${8}
snippet action
action "${1:action name}", :description => "${2:action description}" do
${3}
end
snippet input String
input :${1:input name},
:prompt => "${2:prompt when asking for information}",
:description => "${3:description of the input}",
:type => :string,
:validation => '${4:^.+$}',
:optional => ${5:false},
:maxlength => ${6:20}

${7}
snippet input List
input :${1:input name},
:prompt => "${2:prompt when asking for information}",
:description => "${3:description of the input}",
:type => :list,
:optional => ${4:false},
:list => [${5:list members}]

${6}
snippet output
output ${1:output name},
:description => "${2:description of this output data}",
:display_as => "${3:what do display}"

${4}
snippet display Always
display :always


snippet display Only OK results
display :ok


snippet display Only failed results
display :failed


15 changes: 8 additions & 7 deletions lib/mcollective.rb
Expand Up @@ -7,10 +7,11 @@
require 'singleton'
require 'socket'
require 'erb'
require 'mcollective/monkey_patches'

# == The Marionette Collective
#
# Framework to build and run Systems Administration agents running on a
# Framework to build and run Systems Administration agents running on a
# publish/subscribe middleware system. The system allows you to treat your
# network as the only true source of the state of your platform via discovery agents
# and allow you to run agents matching discovery criteria.
Expand All @@ -28,12 +29,12 @@ class UnknownRPCError<RPCError;end
class NotTargettedAtUs<RuntimeError;end
class DDLValidationError<RuntimeError;end

autoload :Config, "mcollective/config"
autoload :Log, "mcollective/log"
autoload :Runner, "mcollective/runner"
autoload :Agents, "mcollective/agents"
autoload :Client, "mcollective/client"
autoload :Util, "mcollective/util"
autoload :Config, "mcollective/config"
autoload :Log, "mcollective/log"
autoload :Runner, "mcollective/runner"
autoload :Agents, "mcollective/agents"
autoload :Client, "mcollective/client"
autoload :Util, "mcollective/util"
autoload :Optionparser, "mcollective/optionparser"
autoload :Connector, "mcollective/connector"
autoload :Security, "mcollective/security"
Expand Down
18 changes: 12 additions & 6 deletions lib/mcollective/agents.rb
Expand Up @@ -40,14 +40,20 @@ def loadagent(agentname)

return false unless File.exist?(agentfile)

PluginManager.delete("#{agentname}_agent")
PluginManager.loadclass(classname)
PluginManager << {:type => "#{agentname}_agent", :class => classname}
PluginManager.delete("#{agentname}_agent")

PluginManager["connector_plugin"].subscribe(Util.make_target(agentname, :command)) unless @@agents.include?(agentname)
begin
PluginManager.loadclass(classname)
PluginManager << {:type => "#{agentname}_agent", :class => classname}

@@agents[agentname] = {:file => agentfile}
true
PluginManager["connector_plugin"].subscribe(Util.make_target(agentname, :command)) unless @@agents.include?(agentname)

@@agents[agentname] = {:file => agentfile}
return true
rescue Exception => e
@log.error("Loading agent #{agentname} failed: #{e}")
PluginManager.delete("#{agentname}_agent")
end
end

# Determines if we have an agent with a certain name
Expand Down
13 changes: 10 additions & 3 deletions lib/mcollective/config.rb
Expand Up @@ -3,11 +3,11 @@ module MCollective
class Config
include Singleton

attr_reader :topicprefix, :daemonize, :pluginconf, :libdir, :configured, :logfile,
attr_reader :topicprefix, :daemonize, :pluginconf, :libdir, :configured, :logfile,
:keeplogs, :max_log_size, :loglevel, :identity, :daemonize, :connector,
:securityprovider, :factsource, :registration, :registerinterval, :topicsep,
:classesfile, :rpcauditprovider, :rpcaudit, :configdir, :rpcauthprovider,
:rpcauthorization
:rpcauthorization, :color

def initialize
@configured = false
Expand All @@ -19,7 +19,7 @@ def loadconfig(configfile)
@pluginconf = Hash.new
@connector = "Stomp"
@securityprovider = "Psk"
@factsource = "Facter"
@factsource = "Yaml"
@identity = Socket.gethostname
@registration = "Agentlist"
@registerinterval = 0
Expand All @@ -30,9 +30,14 @@ def loadconfig(configfile)
@rpcauthorization = false
@rpcauthprovider = ""
@configdir = File.dirname(configfile)
@color = true

if File.exists?(configfile)
File.open(configfile, "r").each do |line|

# strip blank spaces, tabs etc off the end of all lines
line.gsub!(/\s*$/, "")

unless line =~ /^#|^$/
if (line =~ /(.+?)\s*=\s*(.+)/)
key = $1
Expand Down Expand Up @@ -62,6 +67,8 @@ def loadconfig(configfile)
end
when "identity"
@identity = val
when "color"
val =~ /^1|y/i ? @color = true : @color = false
when "daemonize"
val =~ /^1|y/i ? @daemonize = true : @daemonize = false
when "securityprovider"
Expand Down
9 changes: 9 additions & 0 deletions lib/mcollective/monkey_patches.rb
@@ -0,0 +1,9 @@
# Make arrays of Symbols sortable
class Symbol
include Comparable

def <=>(other)
self.to_s <=> other.to_s
end
end

0 comments on commit b6a083f

Please sign in to comment.