Module: MotherBrain

Extended by:
Forwardable
Defined in:
lib/mb/chef/run_list_item.rb,
lib/mb/api.rb,
lib/mb/cli.rb,
lib/mb/job.rb,
lib/mb/chef.rb,
lib/mb/gear.rb,
lib/mb/test.rb,
lib/mb/group.rb,
lib/mb/config.rb,
lib/mb/errors.rb,
lib/mb/plugin.rb,
lib/mb/command.rb,
lib/mb/console.rb,
lib/mb/logging.rb,
lib/mb/srv_ctl.rb,
lib/mb/upgrade.rb,
lib/mb/version.rb,
lib/mb/cli/base.rb,
lib/mb/manifest.rb,
lib/motherbrain.rb,
lib/mb/berkshelf.rb,
lib/mb/bootstrap.rb,
lib/mb/cli/shell.rb,
lib/mb/component.rb,
lib/mb/gears/jmx.rb,
lib/mb/chef_mutex.rb,
lib/mb/cli_client.rb,
lib/mb/job/states.rb,
lib/mb/job_record.rb,
lib/mb/job_ticket.rb,
lib/mb/application.rb,
lib/mb/chef/config.rb,
lib/mb/cli_gateway.rb,
lib/mb/file_system.rb,
lib/mb/gears/mysql.rb,
lib/mb/job_manager.rb,
lib/mb/mixin/locks.rb,
lib/mb/node_filter.rb,
lib/mb/provisioner.rb,
lib/mb/lock_manager.rb,
lib/mb/node_querier.rb,
lib/mb/rest_gateway.rb,
lib/mb/cli/shell/ext.rb,
lib/mb/error_handler.rb,
lib/mb/gears/service.rb,
lib/mb/command_runner.rb,
lib/mb/config_manager.rb,
lib/mb/mixin/services.rb,
lib/mb/plugin_manager.rb,
lib/mb/upgrade/worker.rb,
lib/mb/clean_room_base.rb,
lib/mb/cli/shell/basic.rb,
lib/mb/cli/shell/color.rb,
lib/mb/cli/sub_command.rb,
lib/mb/command_invoker.rb,
lib/mb/upgrade/manager.rb,
lib/mb/bootstrap/worker.rb,
lib/mb/gears/jmx/action.rb,
lib/mb/mixin/coded_exit.rb,
lib/mb/provisioners/aws.rb,
lib/mb/bootstrap/manager.rb,
lib/mb/bootstrap/routine.rb,
lib/mb/cookbook_metadata.rb,
lib/mb/job/state_machine.rb,
lib/mb/bootstrap/manifest.rb,
lib/mb/bootstrap/template.rb,
lib/mb/gears/mysql/action.rb,
lib/mb/environment_manager.rb,
lib/mb/provisioner/manager.rb,
lib/mb/file_system/tempfile.rb,
lib/mb/gears/service/action.rb,
lib/mb/logging/basic_format.rb,
lib/mb/provisioner/manifest.rb,
lib/mb/gears/dynamic_service.rb,
lib/mb/cli/sub_command/plugin.rb,
lib/mb/command_invoker/worker.rb,
lib/mb/mixin/attribute_setting.rb,
lib/mb/cli/sub_command/component.rb,
lib/mb/provisioner/provision_data.rb,
lib/mb/gears/service/action_runner.rb,
lib/mb/cli_gateway/sub_commands/plugin.rb,
lib/mb/cli_gateway/sub_commands/environment.rb

Overview

Author

Daniel DeLeo (<[email protected]>)

Copyright

Copyright © 2010 Opscode, Inc.

License

Apache License, Version 2.0

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Retrieved on 1/28/2014 @ 24dc69a9a97e82a6e4207de68d6dcc664178249b Source: github.com/opscode/chef/blob/24dc69a9a97e82a6e4207de68d6dcc664178249b/lib/chef/run_list/run_list_item.rb

Defined Under Namespace

Modules: API, Application, Berkshelf, Bootstrap, Chef, Cli, Errors, FileSystem, Gear, Logging, Mixin, Provisioner, Upgrade Classes: APIError, AWSInstanceTimeoutError, AWSProvisionError, AWSRunInstancesError, AbstractFunction, ActionNotFound, ActionNotSupported, ApplicationPaused, ArgumentError, BootstrapError, BootstrapTemplateNotFound, ChefConnectionError, ChefError, ChefMutex, ChefRunFailure, ChefRunnerError, ChefTestRunFailure, CleanRoomBase, CliClient, CliGateway, Command, CommandInvoker, CommandNotFound, CommandRunner, Component, ComponentNotFound, ComponentNotVersioned, Config, ConfigExists, ConfigManager, ConfigNotFound, ConfigOptionMissing, Console, CookbookConstraintNotSatisfied, CookbookMetadata, DataBagItemNotFound, DataBagNotFound, DuplicateAction, DuplicateChefAttribute, DuplicateGear, DuplicateGearKeyword, DuplicateGroup, EnvironmentExists, EnvironmentManager, EnvironmentNotFound, ErrorHandler, FileNotFound, GearError, Group, GroupBootstrapError, GroupNotFound, InternalError, InvalidAttributesFile, InvalidBootstrapManifest, InvalidConfig, InvalidCookbookMetadata, InvalidDynamicService, InvalidEnvironmentJson, InvalidLockType, InvalidManifest, InvalidProvisionManifest, InvalidProvisionerClass, Job, JobManager, JobNotFound, JobRecord, JobTicket, LockManager, MBError, Manifest, ManifestNotFound, NoBootstrapRoutine, NoValueForAddressAttribute, NodeDisabled, NodeFilter, NodeNotFound, NodeQuerier, NodeSaveFailed, OmnibusUpgradeError, Plugin, PluginDownloadError, PluginLoadError, PluginManager, PluginNotFound, PluginSyntaxError, PrerequisiteNotInstalled, ProvisionError, ProvisionerNotRegistered, ProvisionerNotStarted, ProvisionerRegistrationError, ProvisionerSupervisor, RemoteCommandError, RemoteFileCopyError, RemoteScriptError, RequiredFileNotFound, ReservedGearKeyword, ResourceLocked, RestGateway, ServiceRunListNotFound, SrvCtl, Test, UnexpectedProvisionCount, ValidationFailed, ValidatorPemNotFound

Constant Summary collapse

VERSION =
'1.5.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.ui=(value) ⇒ Object (writeonly)

Sets the attribute ui

Parameters:

  • value

    the value to set the attribute ui to.



68
69
70
# File 'lib/motherbrain.rb', line 68

def ui=(value)
  @ui = value
end

Class Method Details

.app_rootPathname

Path to the root directory of the motherbrain application

Returns:

  • (Pathname)


76
77
78
# File 'lib/motherbrain.rb', line 76

def app_root
  @app_root ||= Pathname.new(File.expand_path('../', File.dirname(__FILE__)))
end

.expand_procs(procs) ⇒ Array

Takes an array of procs or a an array of arrays of procs and calls them returning their evaluated values in an array at the same depth.

Examples:

procs = [
  -> { :one },
  -> { :two },
  [
    -> { :nested },
    [
      -> { :deep_nested }
    ]
  ]
]

expand_procs(procs) => [
  :one,
  :two,
  [
    :nested,
    [
      :deep_nested
    ]
  ]
]

Parameters:

  • procs (Array<Proc>, Array<Array<Proc>>)

    an array of nested arrays and procs

Returns:

  • (Array)

    an array of nested arrays and their evaluated values



138
139
140
141
142
143
144
145
146
# File 'lib/motherbrain.rb', line 138

def expand_procs(procs)
  procs.map! do |l_proc|
    if l_proc.is_a?(Array)
      expand_procs(l_proc)
    else
      l_proc.call
    end
  end
end

.loggerLogger Also known as: log

Returns:

  • (Logger)


88
89
90
# File 'lib/motherbrain.rb', line 88

def logger
  MB::Logging.logger
end

.require_or_exit(library, message = nil) ⇒ Object



148
149
150
151
152
153
154
155
156
157
# File 'lib/motherbrain.rb', line 148

def require_or_exit(library, message = nil)
  begin
    require library
  rescue LoadError
    message ||=
      "#{library} was not found. Please add it to your Gemfile, " +
      "and then run `bundle install`."
    raise PrerequisiteNotInstalled, message
  end
end

.scriptsPathname

Path to the scripts directory

Returns:

  • (Pathname)


83
84
85
# File 'lib/motherbrain.rb', line 83

def scripts
  app_root.join('scripts')
end

.set_logger(obj) ⇒ Logger

Parameters:

  • obj (Logger, nil)

Returns:

  • (Logger)


96
97
98
# File 'lib/motherbrain.rb', line 96

def set_logger(obj)
  MB::Logging.set_logger(obj)
end

.testing?Boolean

Is motherbrain executing in test mode?

Returns:

  • (Boolean)


103
104
105
# File 'lib/motherbrain.rb', line 103

def testing?
  ENV['RUBY_ENV'] == 'test'
end