Module: PoolParty
- Includes:
- FileWriter
- Defined in:
- lib/poolparty/schema.rb,
lib/poolparty/lite.rb,
lib/poolparty/capistrano.rb,
lib/poolparty/plugins/git.rb,
lib/poolparty/plugins/svn.rb,
lib/poolparty/dependencies.rb,
lib/poolparty/plugins/bind.rb,
lib/poolparty/plugins/chef.rb,
lib/poolparty/net/messenger.rb,
lib/poolparty/plugins/runit.rb,
lib/poolparty/poolparty/key.rb,
lib/poolparty/helpers/binary.rb,
lib/poolparty/helpers/ruberl.rb,
lib/poolparty/modules/output.rb,
lib/poolparty/modules/pinger.rb,
lib/poolparty/plugins/nanite.rb,
lib/poolparty/poolparty/pool.rb,
lib/poolparty/resources/cron.rb,
lib/poolparty/resources/exec.rb,
lib/poolparty/resources/file.rb,
lib/poolparty/resources/host.rb,
lib/poolparty/resources/user.rb,
lib/poolparty/helpers/console.rb,
lib/poolparty/helpers/display.rb,
lib/poolparty/helpers/loading.rb,
lib/poolparty/poolparty/cloud.rb,
lib/poolparty/resources/mount.rb,
lib/poolparty/helpers/optioner.rb,
lib/poolparty/net/remoter_base.rb,
lib/poolparty/plugins/dynomite.rb,
lib/poolparty/poolparty/plugin.rb,
lib/poolparty/poolparty/script.rb,
lib/poolparty/resources/sshkey.rb,
lib/poolparty/extra/deployments.rb,
lib/poolparty/modules/callbacks.rb,
lib/poolparty/modules/cloud_dsl.rb,
lib/poolparty/poolparty/default.rb,
lib/poolparty/poolparty/service.rb,
lib/poolparty/resources/package.rb,
lib/poolparty/resources/service.rb,
lib/poolparty/resources/symlink.rb,
lib/poolparty/base_packages/ruby.rb,
lib/poolparty/poolparty/resource.rb,
lib/poolparty/poolparty/template.rb,
lib/poolparty/resources/variable.rb,
lib/poolparty/base_packages/runit.rb,
lib/poolparty/modules/file_writer.rb,
lib/poolparty/net/remote_instance.rb,
lib/poolparty/plugins/chef_deploy.rb,
lib/poolparty/plugins/gem_package.rb,
lib/poolparty/plugins/rsyncmirror.rb,
lib/poolparty/resources/directory.rb,
lib/poolparty/verification/verify.rb,
lib/poolparty/helpers/hash_printer.rb,
lib/poolparty/modules/user_helpers.rb,
lib/poolparty/plugins/line_in_file.rb,
lib/poolparty/plugins/tokyo_tyrant.rb,
lib/poolparty/services/conditional.rb,
lib/poolparty/base_packages/haproxy.rb,
lib/poolparty/modules/safe_instance.rb,
lib/poolparty/resources/remote_file.rb,
lib/poolparty/modules/pretty_printer.rb,
lib/poolparty/modules/resourcing_dsl.rb,
lib/poolparty/poolparty/plugin_model.rb,
lib/poolparty/provision/dr_configure.rb,
lib/poolparty/base_packages/heartbeat.rb,
lib/poolparty/base_packages/poolparty.rb,
lib/poolparty/modules/cloud_resourcer.rb,
lib/poolparty/net/remoter/connections.rb,
lib/poolparty/net/remoter/interactive.rb,
lib/poolparty/poolparty/neighborhoods.rb,
lib/poolparty/provision/boot_strapper.rb,
lib/poolparty/plugins/deploy_directory.rb,
lib/poolparty/net/remoter/cloud_control.rb,
lib/poolparty/net/remoter_bases/ec2/ec2.rb,
lib/poolparty/dependency_resolver/puppet.rb,
lib/poolparty/modules/definable_resource.rb,
lib/poolparty/verification/verifier_base.rb,
lib/poolparty/verification/verifiers/ping.rb,
lib/poolparty/net/remoter_bases/vmrun/vmrun.rb,
lib/poolparty/provision/configurations/chef.rb,
lib/poolparty/poolparty/poolparty_base_class.rb,
lib/poolparty/provision/configurations/puppet.rb,
lib/poolparty/dependency_resolver/chef_resolver.rb,
lib/poolparty/spec/matchers/have_deploydirectory.rb,
lib/poolparty/dependency_resolver/puppet_resolver.rb,
lib/poolparty/net/remoter_bases/vmrun/vmrun_instance.rb,
lib/poolparty/dependency_resolver/dependency_resolver.rb,
lib/poolparty/net/remoter_bases/ec2/ec2_remote_instance.rb,
lib/poolparty/dependency_resolver/dependency_resolver_cloud_extensions.rb,
lib/poolparty.rb,
lib/poolparty.rb
Overview
Load PoolParty Plugins and package
Defined Under Namespace
Modules: Binary, Callbacks, Capistrano, Cloud, CloudDsl, CloudResourcer, Console, DefinableResource, DependencyResolutions, DependencyResolverCloudExtensions, DependencyResolverResourceExtensions, Display, Extra, FileWriter, Loading, Messenger, Output, Pinger, Plugin, PluginModel, Pool, PrettyPrinter, Provision, Remote, Resources, ResourcingDsl, Ruberl, ThreadSafeInstance, Verification, Verifiers Classes: Base, Chef, ChefDeploy, ChefRecipe, ChefResolver, Conditional, Default, Dependencies, DependencyResolver, Deploydirectory, GempackageResource, GitResource, HashPrinter, Key, LineInFile, Nanite, Neighborhoods, Optioner, PoolParty, PoolPartyBaseClass, PuppetResolver, Rsyncmirror, Runit, Schema, Script, Service, SpecCore, SvnResource, Template, Verify
Class Method Summary collapse
Instance Method Summary collapse
- #case_of(o, &block) ⇒ Object
- #context_stack ⇒ Object
- #extract_cloud_from_options(o) ⇒ Object
- #extract_pool_from_options(o) ⇒ Object
-
#load_pool(filename = nil) ⇒ Object
Load a file that contains a pool into memory.
- #log ⇒ Object
-
#pack_user_directory(dirname) ⇒ Object
Add to the suitcase files below the clouds.rb base directory.
-
#pool_specfile ⇒ Object
Keep the pool_specfile.
-
#print_with_nice_printer(header = nil, strs = []) {|printer| ... } ⇒ Object
Helper to print with the nice printer.
-
#require_user_directory(dirname) ⇒ Object
Require all the files in a directory below the base.
- #reset! ⇒ Object
- #working_conditional ⇒ Object
Methods included from Remote
_nodes, are_any_nodes_exceeding_minimum_runtime?, are_too_few_instances_running?, are_too_many_instances_running?, commands, execute!, is_master_running?, list_of_instances, list_of_nodes_exceeding_minimum_runtime, master, netssh, nodes, remote_rsync_command, remote_ssh_array, remote_ssh_string, rsync, rsync_command, rsync_storage_files_to, rsync_storage_files_to_command, rsync_to, rsync_to_command, run_command_on, run_command_on_command, run_command_on_instance_number, run_local, run_remote, scp_array, scp_to_command, simplest_run_remote, ssh_array, ssh_command, ssh_into, ssh_into_instance_number, ssh_options, ssh_string, target_host
Methods included from Pinger
Methods included from FileWriter
#cleanup_storage_directory, #clear_base_directory, #copy_directory_into_storage_directory, #copy_directory_into_template_storage_directory, #copy_file_to_storage_directory, #copy_template_to_storage_directory, #make_base_directory, #make_base_path, #make_directory_in_storage_directory, #make_template_directory, #write_to_file, #write_to_file_in_storage_directory, #write_to_temp_file
Class Method Details
.load_cloud_from_json(json_file_path = nil) ⇒ Object
20 21 22 23 |
# File 'lib/poolparty/lite.rb', line 20 def self.load_cloud_from_json(json_file_path=nil) json_file = json_file_path || PoolParty::Default.properties_hash_file PoolParty::Schema.new( ::File.read(json_file) ) rescue exit 1 end |
.require_directory(dir) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/poolparty.rb', line 45 def PoolParty.require_directory(dir) if ::File.file?(dir) puts "#{::File.(dir)}" if $DEBUGGING || $GENERATING_MANIFEST require dir else Dir["#{dir}/*.rb"].sort.each do |file| puts "#{::File.(file)}" if $DEBUGGING || $GENERATING_MANIFEST require "#{file}" if ::File.file?(file) end Dir["#{dir}/*"].sort.each do |dir| require_directory(dir) if ::File.directory?(dir) end end end |
Instance Method Details
#case_of(o, &block) ⇒ Object
6 7 8 9 10 |
# File 'lib/poolparty/services/conditional.rb', line 6 def case_of o, &block c = Conditional.new({:name => "case_of_#{o}", :attribute => o}, &block) add_service c c end |
#context_stack ⇒ Object
5 6 7 |
# File 'lib/poolparty/poolparty/poolparty_base_class.rb', line 5 def context_stack $context_stack ||= [] end |
#extract_cloud_from_options(o) ⇒ Object
149 150 151 |
# File 'lib/poolparty/helpers/optioner.rb', line 149 def (o) o.cloudname ? [cloud(o.cloudname.downcase.to_sym)] : clouds.collect {|n,cl| cl} end |
#extract_pool_from_options(o) ⇒ Object
153 154 155 |
# File 'lib/poolparty/helpers/optioner.rb', line 153 def (o) o.poolname ? [pool(o.poolname.downcase.to_sym)] : pools.collect {|n,pl| pl} end |
#load_pool(filename = nil) ⇒ Object
Load a file that contains a pool into memory
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/poolparty/helpers/binary.rb', line 5 def load_pool(filename=nil) filename = filename || Binary.get_existing_spec_location dputs "Using spec at #{filename}" unless filename && ::File.readable?(filename) puts "Please specify your cloud with -s, move it to ./clouds.rb or in your POOL_SPEC environment variable" exit(1) else $pool_specfile = filename PoolParty::Pool::Pool.load_from_file filename end end |
#log ⇒ Object
109 110 111 |
# File 'lib/poolparty.rb', line 109 def log @logger ||= make_new_logger rescue STDOUT end |
#pack_user_directory(dirname) ⇒ Object
Add to the suitcase files below the clouds.rb base directory
13 14 15 16 17 18 19 |
# File 'lib/poolparty/modules/user_helpers.rb', line 13 def pack_user_directory(dirname) begin ::Suitcase::Zipper.add("#{::File.dirname($pool_specfile)}/#{dirname}", "etc") rescue Exception => e vputs "Error packing user directory #{dirname}: #{e}" end end |
#pool_specfile ⇒ Object
Keep the pool_specfile
30 31 32 |
# File 'lib/poolparty/helpers/binary.rb', line 30 def pool_specfile $pool_specfile end |
#print_with_nice_printer(header = nil, strs = []) {|printer| ... } ⇒ Object
Helper to print with the nice printer
19 20 21 22 23 24 25 26 27 |
# File 'lib/poolparty/helpers/binary.rb', line 19 def print_with_nice_printer(header=nil, strs=[], &block) printer = NicePrinter.new printer.header printer.center(header) if header yield(printer) strs.each {|st| printer << st if st} printer. printer.print end |
#require_user_directory(dirname) ⇒ Object
Require all the files in a directory below the base
3 4 5 6 7 8 9 10 |
# File 'lib/poolparty/modules/user_helpers.rb', line 3 def require_user_directory(dirname) begin cloud_dir = ::File.dirname($pool_specfile) Dir["#{cloud_dir}/#{dirname}/**"].each {|a| require a } rescue Exception => e vputs "Error requiring user directory #{dirname}: #{e}" end end |
#reset! ⇒ Object
112 113 114 |
# File 'lib/poolparty.rb', line 112 def reset! $pools = $clouds = $plugins = @describe_instances = nil end |
#working_conditional ⇒ Object
2 3 4 |
# File 'lib/poolparty/services/conditional.rb', line 2 def working_conditional @working_conditional ||= [] end |