### Home Classes Methods

### In Files

- lib/mcollective/pluginpackager/agent_definition.rb

### Parent

Object

### Methods

- ::new
- #agent
- #client
- #common
- #identify_packages

### Files

- COPYING
- README
- Rakefile
- PLACEHOLDER
- PLACEHOLDER

### Class/Module Index

Quicksearch

- MCollective
- MCollective::Agent
- MCollective::Agents
- MCollective::Aggregate
- MCollective::Aggregate::Base
- MCollective::Aggregate::Result
- MCollective::Aggregate::Result::Base
- MCollective::Aggregate::Result::CollectionResult
- MCollective::Aggregate::Result::NumericResult
- MCollective::Application
- MCollective::Applications
- MCollective::Client
- MCollective::Config
- MCollective::Connector
- MCollective::Connector::Base
- MCollective::DDL
- MCollective::DDLValidationError
- MCollective::Data
- MCollective::Data::Base
- MCollective::Data::Result
- MCollective::Discovery
- MCollective::Facts
- MCollective::Facts::Base
- MCollective::Generators
- MCollective::Generators::AgentGenerator
- MCollective::Generators::Base
- MCollective::Generators::DataGenerator
- MCollective::InvalidRPCData
- MCollective::Log
- MCollective::Logger
- MCollective::Logger::Base
- MCollective::Logger::Console_logger
- MCollective::Logger::File_logger
- MCollective::Logger::Syslog_logger
- MCollective::Matcher
- MCollective::Matcher::Parser
- MCollective::Matcher::Scanner
- MCollective::Message
- MCollective::MissingRPCData
- MCollective::MsgDoesNotMatchRequestID
- MCollective::MsgTTLExpired
- MCollective::NotTargettedAtUs
- MCollective::Optionparser
- MCollective::PluginManager
- MCollective::PluginPackager
- MCollective::PluginPackager::AgentDefinition
- MCollective::PluginPackager::StandardDefinition
- MCollective::RPC
- MCollective::RPC::ActionRunner
- MCollective::RPC::Agent
- MCollective::RPC::Audit
- MCollective::RPC::Client
- MCollective::RPC::Helpers
- MCollective::RPC::Progress
- MCollective::RPC::Reply
- MCollective::RPC::Request
- MCollective::RPC::Result
- MCollective::RPC::Stats
- MCollective::RPCAborted
- MCollective::RPCError
- MCollective::Registration
- MCollective::Registration::Base
- MCollective::Runner
- MCollective::RunnerStats
- MCollective::SSL
- MCollective::Security
- MCollective::Security::Base
- MCollective::SecurityValidationFailed
- MCollective::Shell
- MCollective::UnixDaemon
- MCollective::UnknownRPCAction
- MCollective::UnknownRPCError
- MCollective::Util
- MCollective::WindowsDaemon
- Array
- Dir
- Object
- String
- Symbol

No matching classes.

# MCollective::PluginPackager::AgentDefinition

MCollective Agent Plugin package

### Attributes

dependencies[RW]
iteration[RW]
mcclient[RW]
mccommon[RW]
mcserver[RW]
metadata[RW]
packagedata[RW]
path[RW]
plugintype[RW]
postinstall[RW]
preinstall[RW]
target_path[RW]
vendor[RW]

### Public Instance Methods

agent() click to toggle source

Obtain Agent package files and dependencies.

    # File lib/mcollective/pluginpackager/agent_definition.rb, line 37
    def agent
      agent = {:files => [],
               :dependencies => @dependencies.clone << @mcserver,
               :description => "Agent plugin for #{@metadata[:name]}"}

      agentdir = File.join(@path, "agent")

      if PluginPackager.check_dir_present agentdir
        ddls = Dir.glob(File.join(agentdir, "*.ddl"))
        agent[:files] = (Dir.glob(File.join(agentdir, "*")) - ddls)
        implementations = Dir.glob(File.join(@metadata[:name], "**"))
        agent[:files] += implementations unless implementations.empty?
      else
        return nil
      end
      agent[:dependencies] << ["mcollective-#{@metadata[:name]}-common", @metadata[:version]]
      agent
    end

client() click to toggle source

Obtain client package files and dependencies.

    # File lib/mcollective/pluginpackager/agent_definition.rb, line 57
    def client
      client = {:files => [],
                :dependencies => @dependencies.clone << @mcclient,
                :description => "Client plugin for #{@metadata[:name]}"}

      clientdir = File.join(@path, "application")
      bindir = File.join(@path, "bin")
      aggregatedir = File.join(@path, "aggregate")

      client[:files] += Dir.glob(File.join(clientdir, "*")) if PluginPackager.check_dir_present clientdir
      client[:files] += Dir.glob(File.join(bindir,"*")) if PluginPackager.check_dir_present bindir
      client[:files] += Dir.glob(File.join(aggregatedir, "*")) if PluginPackager.check_dir_present aggregatedir
      client[:dependencies] << ["mcollective-#{@metadata[:name]}-common", @metadata[:version]]
      client[:files].empty? ? nil : client
    end

common() click to toggle source

Obtain common package files and dependencies.

    # File lib/mcollective/pluginpackager/agent_definition.rb, line 74
    def common
      common = {:files =>[],
                :dependencies => @dependencies.clone << @mccommon,
                :description => "Common libraries for #{@metadata[:name]}"}

      commondir = File.join(@path, "util")
      ddldir = File.join(@path, "agent")
      common[:files] += Dir.glob(File.join(ddldir, "*.ddl")) if PluginPackager.check_dir_present ddldir

      # We fail if there is no ddl file present
      if common[:files].empty?
        raise "cannot create package - No ddl file found in #{File.join(@path, "agent")}"
      end

      common[:files] += Dir.glob(File.join(commondir,"*")) if PluginPackager.check_dir_present commondir
      common[:files].empty? ? nil : common
    end

identify_packages() click to toggle source

Identify present packages and populate packagedata hash.

    # File lib/mcollective/pluginpackager/agent_definition.rb, line 27
    def identify_packages
      common_package = common
      @packagedata[:common] = common_package if common_package
      agent_package = agent
      @packagedata[:agent] = agent_package if agent_package
      client_package = client
      @packagedata[:client] = client_package if client_package
    end

### Public Class Methods

new(path, name, vendor, preinstall, postinstall, iteration, dependencies, mcodependency, plugintype) click to toggle source

    # File lib/mcollective/pluginpackager/agent_definition.rb, line 8
    def initialize(path, name, vendor, preinstall, postinstall, iteration, dependencies, mcodependency, plugintype)
      @plugintype = plugintype
      @path = path
      @packagedata = {}
      @iteration = iteration || 1
      @preinstall = preinstall
      @postinstall = postinstall
      @vendor = vendor || "Puppet Labs"
      @mcserver = mcodependency[:server] || "mcollective"
      @mcclient = mcodependency[:client] || "mcollective-client"
      @mccommon = mcodependency[:common] || "mcollective-common"
      @dependencies = dependencies || []
      @target_path = File.expand_path(@path)
      @metadata = PluginPackager.get_metadata(@path, "agent")
      @metadata[:name] = (name || @metadata[:name]).downcase.gsub(" ", "-")
      identify_packages
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.