X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=doc%2FMCollective%2FApplication.html;fp=doc%2Fclasses%2FMCollective%2FApplication.html;h=662e0e9f664b1a787df99c9c99755b1a4cb5f9df;hb=refs%2Fheads%2Fhavana;hp=7e02d824c244e0eb7afe0d5816405ee4728bfe9b;hpb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;p=packages%2Fprecise%2Fmcollective.git diff --git a/doc/classes/MCollective/Application.html b/doc/MCollective/Application.html similarity index 56% rename from doc/classes/MCollective/Application.html rename to doc/MCollective/Application.html index 7e02d82..662e0e9 100644 --- a/doc/classes/MCollective/Application.html +++ b/doc/MCollective/Application.html @@ -1,271 +1,566 @@ - - - + + - Class: MCollective::Application - - - - - - - - - - -
- - - - - - - - - - - - - - -
ClassMCollective::Application
In: - - lib/mcollective/application.rb - -
-
Parent: - Object -
-
- - -
- - - -
- - - -
- -
-

Methods

- - -
- -
- - - -
-

Included Modules

+ -
- RPC -
-
+ Class: MCollective::Application -
+ + + + + - - - - - - - -
-

Public Class methods

- -
- - - - -
-

-retrieves a specific option + + + +

+
+
+

In Files

+ +
+ + +
+ + + +
+ + + + + +
+

Class Index + [+]

+
+
+ Quicksearch + +
+
+ + + +
+ + +
+
+ +
+

MCollective::Application

+ +
+ +
+ + + + + + + + + +
+

Public Class Methods

+ + +
+ + +
+ + [](option) + click to toggle source + +
+ +
+ +

+retrieves a specific option

-

[Source]

-
+ + + +
     # File lib/mcollective/application.rb, line 20
 20:       def [](option)
 21:         intialize_application_options unless @application_options
 22:         @application_options[option]
-23:       end
-
-
-
-
- -
- - - - -
-

-set an option in the options hash +23: end +

+ +
+ + +
+ + +
+ + +
+ + []=(option, value) + click to toggle source + +
+ +
+ +

+set an option in the options hash

-

[Source]

-
+ + + +
     # File lib/mcollective/application.rb, line 14
 14:       def []=(option, value)
 15:         intialize_application_options unless @application_options
 16:         @application_options[option] = value
-17:       end
-
-
-
-
- -
- - - - -
-

-Intialize a blank set of options if -its the first time used else returns active options +17: end +

+ +
+ + +
+ + +
+ + +
+ + application_options() + click to toggle source + +
+ +
+ +

+Intialize a blank set of options if its the first time used else returns +active options

-

[Source]

-
+ + + +
     # File lib/mcollective/application.rb, line 8
  8:       def application_options
  9:         intialize_application_options unless @application_options
 10:         @application_options
-11:       end
-
-
-
-
- -
- - - - -
-

-Sets the application description, -there can be only one description -per application so multiple calls will just change the description +11: end +

+ +
+ + +
+ + +
+ + +
+ + description(descr) + click to toggle source + +
+ +
+ +

+Sets the application description, there can be only one description per +application so multiple calls will just change the description

-

[Source]

-
+ + + +
     # File lib/mcollective/application.rb, line 28
 28:       def description(descr)
 29:         self[:description] = descr
-30:       end
-
-
-
-
- -
- - - - -
-

[Source]

-
+30: end +
+ +
+ + +
+ + +
+ + +
+ + exclude_argument_sections(*sections) + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
     # File lib/mcollective/application.rb, line 38
 38:       def exclude_argument_sections(*sections)
@@ -277,28 +572,36 @@ href="Application.html#M000348">description
 44: 
 45:         intialize_application_options unless @application_options
 46:         self[:exclude_arg_sections] = sections
-47:       end
-
-
-
-
- -
- - - - -
-

-Creates an empty set of options +47: end +

+ +
+ + +
+ + +
+ + +
+ + intialize_application_options() + click to toggle source + +
+ +
+ +

+Creates an empty set of options

-

[Source]

-
+ + + +
     # File lib/mcollective/application.rb, line 79
 79:       def intialize_application_options
@@ -306,25 +609,30 @@ Creates an empty set of options
 81:                                 :usage                => [],
 82:                                 :cli_arguments        => [],
 83:                                 :exclude_arg_sections => []}
-84:       end
-
-
-
-
- -
- - - - -
-

-Wrapper to create command line options +84: end +

+ +
+ + +
+ + +
+ + +
+ + option(name, arguments) + click to toggle source + +
+ +
+ +

+Wrapper to create command line options

  - name: varaible name that will be used to access the option value
@@ -341,12 +649,13 @@ href="Application.html#M000354">options
          :arguments   => ["--foo ARG"]
 

-after this the value supplied will be in configuration[:foo] +after this the value supplied will be in configuration[:foo]

-

[Source]

-
+ + + +
     # File lib/mcollective/application.rb, line 65
 65:       def option(name, arguments)
@@ -360,113 +669,146 @@ href="Application.html#M000353">configuration[:foo]
 73:         arguments.each_pair{|k,v| opt[k] = v}
 74: 
 75:         self[:cli_arguments] << opt
-76:       end
-
-
-
-
- -
- - - - -
-

-Supplies usage information, calling -multiple times will create multiple usage lines in —help output +76: end +

+ +
+ + +
+ + +
+ + +
+ + usage(usage) + click to toggle source + +
+ +
+ +

+Supplies usage information, calling multiple times will create multiple +usage lines in —help output

-

[Source]

-
+ + + +
     # File lib/mcollective/application.rb, line 34
 34:       def usage(usage)
 35:         self[:usage] << usage
-36:       end
-
-
-
-
- -

Public Instance methods

- -
- - - - -
-

+36: end +

+ +
+ + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ + +
+ + application_cli_arguments() + click to toggle source + +
+ +
+ +

Returns an array of all the arguments built using calls to optin

-

[Source]

-
+ + + +
      # File lib/mcollective/application.rb, line 247
 247:     def application_cli_arguments
 248:       application_options[:cli_arguments]
-249:     end
-
-
-
-
- -
- - - - -
-

-Retrieve the current application description +249: end +

+ +
+ + +
+ + +
+ + +
+ + application_description() + click to toggle source + +
+ +
+ +

+Retrieve the current application description

-

[Source]

-
+ + + +
      # File lib/mcollective/application.rb, line 234
 234:     def application_description
 235:       application_options[:description]
-236:     end
-
-
-
-
- -
- - - - -
-

-Handles failure, if we‘re far enough in the initialization phase it +236: end +

+ +
+ + +
+ + +
+ + +
+ + application_failure(e, err_dest=STDERR) + click to toggle source + +
+ +
+ +

+Handles failure, if we’re far enough in the initialization phase it will log backtraces if its in verbose mode only

-

[Source]

-
+ + + +
      # File lib/mcollective/application.rb, line 253
 253:     def application_failure(e, err_dest=STDERR)
@@ -502,57 +844,71 @@ will log backtraces if its in verbose mode only
 283:       disconnect
 284: 
 285:       exit 1
-286:     end
-
-
-
-
- -
- - - - -
-

-Retrieves the full hash of application options +286: end +

+ +
+ + +
+ + +
+ + +
+ + application_options() + click to toggle source + +
+ +
+ +

+Retrieves the full hash of application options

-

[Source]

-
+ + + +
      # File lib/mcollective/application.rb, line 229
 229:     def application_options
 230:       self.class.application_options
-231:     end
-
-
-
-
- -
- - - - -
-

-Builds an ObjectParser config, parse the CLI options and validates based on the option config +231: end +

+ +
+ + +
+ + +
+ + +
+ + application_parse_options(help=false) + click to toggle source + +
+ +
+ +

+Builds an ObjectParser config, parse the CLI options and validates based on +the option config

-

[Source]

-
+ + + +
      # File lib/mcollective/application.rb, line 135
 135:     def application_parse_options(help=false)
@@ -625,59 +981,73 @@ href="Application.html#M000351">option config
 202:           end
 203:         end
 204:       end
-205:     end
-
-
-
-
- -
- - - - -
-

-Return the current usage text false -if nothing is set +205: end +

+ +
+ + +
+ + +
+ + +
+ + application_usage() + click to toggle source + +
+ +
+ +

+Return the current usage text false if nothing is set

-

[Source]

-
+ + + +
      # File lib/mcollective/application.rb, line 239
 239:     def application_usage
 240:       usage = application_options[:usage]
 241: 
 242:       usage.empty? ? false : usage
-243:     end
-
-
-
-
- -
- - - - -
-

-Creates a standard options hash, -pass in a block to add extra headings etc see Optionparser +243: end +

+ +
+ + +
+ + +
+ + +
+ + clioptions(help) + click to toggle source + +
+ +
+ +

+Creates a standard options hash, pass in a block to add extra headings etc +see Optionparser

-

[Source]

-
+ + + +
      # File lib/mcollective/application.rb, line 111
 111:     def clioptions(help)
@@ -700,112 +1070,145 @@ href="Optionparser.html">Optionparser
 128:       return options
 129:     rescue Exception => e
 130:       application_failure(e)
-131:     end
-
-
-
-
- -
- - - - -
-

-The application configuration built -from CLI arguments +131: end +

+ +
+ + +
+ + +
+ + +
+ + configuration() + click to toggle source + +
+ +
+ +

+The application configuration built from CLI arguments

-

[Source]

-
+ + + +
     # File lib/mcollective/application.rb, line 88
 88:     def configuration
 89:       @application_configuration ||= {}
 90:       @application_configuration
-91:     end
-
-
-
-
- -
- - - - -
-

[Source]

-
+91: end +
+ +
+ + +
+ + +
+ + +
+ + disconnect() + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
      # File lib/mcollective/application.rb, line 310
 310:     def disconnect
 311:       MCollective::PluginManager["connector_plugin"].disconnect
 312:     rescue
-313:     end
-
-
-
-
- -
- - - - -
-

+313: end +

+ +
+ + +
+ + +
+ + +
+ + halt(stats) + click to toggle source + +
+ +
+ +

A helper that creates a consistent exit code for applications by looking at an instance of MCollective::RPC::Stats

Exit with 0 if nodes were discovered and all passed Exit with 0 if no -discovery were done and > 0 responses were received, all ok Exit with 1 -if no nodes were discovered Exit with 2 if nodes were discovered but some -RPC requests failed Exit with 3 if nodes were +discovery were done and > 0 responses were received, all ok Exit with 1 if +no nodes were discovered Exit with 2 if nodes were discovered but some RPC requests failed Exit with 3 if nodes were discovered, but no responses received Exit with 4 if no discovery were done and no responses were received

-

[Source]

-
+ + + +
      # File lib/mcollective/application.rb, line 345
 345:     def halt(stats)
 346:       exit(halt_code(stats))
-347:     end
-
-
-
-
- -
- - - - -
-

[Source]

-
+347: end +
+ +
+ + +
+ + +
+ + +
+ + halt_code(stats) + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
      # File lib/mcollective/application.rb, line 322
 322:     def halt_code(stats)
@@ -820,112 +1223,140 @@ and no responses were received
 331:       return 1 if request_stats[:discovered] == 0
 332:       return 0 if request_stats[:discoverytime] == 0 && request_stats[:discovered] == request_stats[:okcount]
 333:       return 0 if request_stats[:discovered] == request_stats[:okcount]
-334:     end
-
-
-
-
- -
- - - - -
-

[Source]

-
+334: end +
+ +
+ + +
+ + +
+ + +
+ + help() + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
      # File lib/mcollective/application.rb, line 288
 288:     def help
 289:       application_parse_options(true)
-290:     end
-
-
-
-
- -
- - - - -
-

+290: end +

+ +
+ + +
+ + +
+ + +
+ + main() + click to toggle source + +
+ +
+ +

Fake abstract class that logs if the user tries to use an application -without supplying a main override -method. +without supplying a main override method.

-

[Source]

-
+ + + +
      # File lib/mcollective/application.rb, line 317
 317:     def main
 318:       STDERR.puts "Applications need to supply a 'main' method"
 319:       exit 1
-320:     end
-
-
-
-
- -
- - - - -
-

-The active options hash used for -MC::Client and other configuration +320: end +

+ +
+ + +
+ + +
+ + +
+ + options() + click to toggle source + +
+ +
+ +

+The active options hash used for MC::Client and other configuration

-

[Source]

-
+ + + +
     # File lib/mcollective/application.rb, line 94
 94:     def options
 95:       @options
-96:     end
-
-
-
-
- -
- - - - -
-

-Wrapper around MC::RPC#rpcclient that -forcably supplies our options hash -if someone forgets to pass in options in an application the filters -and other cli options wouldnt take -effect which could have a disasterous outcome +96: end +

+ +
+ + +
+ + +
+ + +
+ + rpcclient(agent, flags = {}) + click to toggle source + +
+ +
+ +

+Wrapper around MC::RPC#rpcclient that forcably supplies our options hash if +someone forgets to pass in options in an application the filters and other +cli options wouldnt take effect which could have a disasterous outcome

-

[Source]

-
+ + + +
      # File lib/mcollective/application.rb, line 352
 352:     def rpcclient(agent, flags = {})
@@ -933,33 +1364,39 @@ effect which could have a disasterous outcome
 354:       flags[:exit_on_failure] = false
 355: 
 356:       super
-357:     end
-
-
-
-
- -
- - - - -
-

-The main logic loop, builds up the -options, validate configuration and calls the main as supplied by the user. -Disconnects when done and pass any exception onto the application_failure helper +357: end +

+ +
+ + +
+ + +
+ + +
+ + run() + click to toggle source + +
+ +
+ +

+The main logic loop, builds up the options, validate configuration and +calls the main as supplied by the user. Disconnects when done and pass any +exception onto the application_failure helper

-

[Source]

-
+ + + +
      # File lib/mcollective/application.rb, line 295
 295:     def run
@@ -975,25 +1412,34 @@ href="Application.html#M000363">application_failure helper
 305: 
 306:     rescue Exception => e
 307:       application_failure(e)
-308:     end
-
-
-
-
- -
- - - - -
-

[Source]

-
+308: end +
+ +
+ + +
+ + +
+ + +
+ + validate_cli_options() + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
      # File lib/mcollective/application.rb, line 207
 207:     def validate_cli_options
@@ -1015,30 +1461,37 @@ href="Application.html#M000363">application_failure helper
 223:       end
 224: 
 225: 
-226:     end
-
-
-
-
- -
- - - - -
-

-Calls the supplied block in an option for validation, an error raised -will log to STDERR and exit the application +226: end +

+ +
+ + +
+ + +
+ + +
+ + validate_option(blk, name, value) + click to toggle source + +
+ +
+ +

+Calls the supplied block in an option for validation, an error raised will +log to STDERR and exit the application

-

[Source]

-
+ + + +
      # File lib/mcollective/application.rb, line 100
 100:     def validate_option(blk, name, value)
@@ -1048,22 +1501,33 @@ will log to STDERR and exit the application
 104:         STDERR.puts "Validation of #{name} failed: #{validation_result}"
 105:         exit 1
 106:       end
-107:     end
-
-
-
-
+107: end +
+ +
+ +
-
+ +
+ +
-
+
+ +

Disabled; run with --debug to generate this.

+ +
-
-

[Validate]

-
+
+

[Validate]

+

Generated with the Darkfish + Rdoc Generator 1.1.6.

+
- \ No newline at end of file + +