bebox 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +78 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +163 -0
- data/LICENSE +21 -0
- data/README.md +372 -0
- data/Rakefile +8 -0
- data/bebox.gemspec +40 -0
- data/bin/bebox +5 -0
- data/lib/bebox/cli.rb +42 -0
- data/lib/bebox/commands/commands_helper.rb +33 -0
- data/lib/bebox/commands/environment_commands.rb +46 -0
- data/lib/bebox/commands/general_commands.rb +24 -0
- data/lib/bebox/commands/node_commands.rb +68 -0
- data/lib/bebox/commands/prepare_commands.rb +59 -0
- data/lib/bebox/commands/project_commands.rb +44 -0
- data/lib/bebox/commands/provision_commands.rb +145 -0
- data/lib/bebox/environment.rb +114 -0
- data/lib/bebox/logger.rb +51 -0
- data/lib/bebox/node.rb +308 -0
- data/lib/bebox/profile.rb +102 -0
- data/lib/bebox/project.rb +259 -0
- data/lib/bebox/provision.rb +257 -0
- data/lib/bebox/role.rb +103 -0
- data/lib/bebox/version.rb +3 -0
- data/lib/bebox/wizards/environment_wizard.rb +45 -0
- data/lib/bebox/wizards/node_wizard.rb +163 -0
- data/lib/bebox/wizards/profile_wizard.rb +91 -0
- data/lib/bebox/wizards/project_wizard.rb +175 -0
- data/lib/bebox/wizards/provision_wizard.rb +80 -0
- data/lib/bebox/wizards/role_wizard.rb +97 -0
- data/lib/bebox.rb +2 -0
- data/lib/deb/puppet_3.6.0/augeas-lenses_0.10.0-0ubuntu4_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/debconf-utils_1.5.42ubuntu1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/facter_2.0.1-1puppetlabs1_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/hiera_1.3.2-1puppetlabs1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/libaugeas-ruby1.8_0.3.0-1.1ubuntu4_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/libaugeas-ruby_0.3.0-1.1ubuntu4_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/libaugeas0_0.10.0-0ubuntu4_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/libjson-ruby_1.6.3-1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/libruby1.8_1.8.7.352-2ubuntu1.4_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/libruby_4.8_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/libshadow-ruby1.8_1.4.1-8build1_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/puppet-common_3.6.0-1puppetlabs1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/puppet_3.6.0-1puppetlabs1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/ruby-json_1.6.3-1_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/ruby-rgen_0.6.5-1puppetlabs1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/ruby1.8_1.8.7.352-2ubuntu1.4_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/ruby_4.8_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/virt-what_1.11-1_amd64.deb +0 -0
- data/lib/templates/node/Vagrantfile.erb +18 -0
- data/lib/templates/node/deploy_vagrant_node.erb +3 -0
- data/lib/templates/node/node.yml.erb +3 -0
- data/lib/templates/node/prepared_node.yml.erb +4 -0
- data/lib/templates/node/provisioned_node.yml.erb +4 -0
- data/lib/templates/project/Capfile.erb +2 -0
- data/lib/templates/project/Gemfile.erb +5 -0
- data/lib/templates/project/config/deploy/environment.erb +40 -0
- data/lib/templates/project/config/deploy/vagrant.erb +42 -0
- data/lib/templates/project/config/deploy.erb +120 -0
- data/lib/templates/project/dot_bebox.erb +4 -0
- data/lib/templates/project/gitignore.erb +7 -0
- data/lib/templates/project/ubuntu_dependencies +10 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/ruby/Puppetfile +0 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/ruby/manifests/init.pp +24 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/sudo/Puppetfile +0 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/sudo/manifests/init.pp +22 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/users/Puppetfile +0 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/users/manifests/init.pp +18 -0
- data/lib/templates/puppet/default_profiles/base/security/fail2ban/Puppetfile +2 -0
- data/lib/templates/puppet/default_profiles/base/security/fail2ban/manifests/init.pp +28 -0
- data/lib/templates/puppet/default_profiles/base/security/iptables/Puppetfile +2 -0
- data/lib/templates/puppet/default_profiles/base/security/iptables/manifests/init.pp +27 -0
- data/lib/templates/puppet/default_profiles/base/security/ssh/Puppetfile +2 -0
- data/lib/templates/puppet/default_profiles/base/security/ssh/manifests/init.pp +30 -0
- data/lib/templates/puppet/default_profiles/base/security/sysctl/Puppetfile +2 -0
- data/lib/templates/puppet/default_profiles/base/security/sysctl/manifests/init.pp +20 -0
- data/lib/templates/puppet/default_profiles/base/users/ssh/Puppetfile +2 -0
- data/lib/templates/puppet/default_profiles/base/users/ssh/manifests/init.pp +47 -0
- data/lib/templates/puppet/default_profiles/base/users/users/Puppetfile +0 -0
- data/lib/templates/puppet/default_profiles/base/users/users/manifests/init.pp +18 -0
- data/lib/templates/puppet/default_roles/fundamental/manifests/init.pp +16 -0
- data/lib/templates/puppet/default_roles/security/manifests/init.pp +17 -0
- data/lib/templates/puppet/default_roles/users/manifests/init.pp +15 -0
- data/lib/templates/puppet/profiles/Puppetfile.erb +24 -0
- data/lib/templates/puppet/profiles/manifests/init.pp.erb +17 -0
- data/lib/templates/puppet/roles/manifests/init.pp.erb +14 -0
- data/lib/templates/puppet/step-0/Puppetfile.erb +5 -0
- data/lib/templates/puppet/step-0/hiera/data/common.yaml.erb +26 -0
- data/lib/templates/puppet/step-0/hiera/data/environment.yaml.erb +26 -0
- data/lib/templates/puppet/step-0/hiera/data/node.yaml.erb +26 -0
- data/lib/templates/puppet/step-0/hiera/hiera.yaml.erb +11 -0
- data/lib/templates/puppet/step-0/manifests/node.erb +5 -0
- data/lib/templates/puppet/step-0/manifests/site.pp.erb +15 -0
- data/lib/templates/puppet/step-0/modules/rbenv/AUTHORS +11 -0
- data/lib/templates/puppet/step-0/modules/rbenv/CHANGELOG.md +70 -0
- data/lib/templates/puppet/step-0/modules/rbenv/Gemfile +8 -0
- data/lib/templates/puppet/step-0/modules/rbenv/Gemfile.lock +28 -0
- data/lib/templates/puppet/step-0/modules/rbenv/Modulefile +7 -0
- data/lib/templates/puppet/step-0/modules/rbenv/README.md +173 -0
- data/lib/templates/puppet/step-0/modules/rbenv/Rakefile +22 -0
- data/lib/templates/puppet/step-0/modules/rbenv/TODO +10 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/autospec +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/facter +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/filebucket +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/hiera +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/htmldiff +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/ldiff +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/pi +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet-lint +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet-module +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetca +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetd +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetdoc +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetmasterd +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetqd +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetrun +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/rake +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/ralsh +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/rspec +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/rspec-puppet-init +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/lib/puppet/provider/rbenvgem/default.rb +50 -0
- data/lib/templates/puppet/step-0/modules/rbenv/lib/puppet/type/rbenvgem.rb +62 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/bundle.pp +36 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/client.pp +48 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/compile.pp +102 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/definition.pp +31 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/centos.pp +25 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/suse.pp +28 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/ubuntu.pp +17 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies.pp +8 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/gem.pp +29 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/install.pp +55 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin/rbenvvars.pp +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin/rubybuild.pp +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin.pp +40 -0
- data/lib/templates/puppet/step-0/modules/rbenv/metadata.json +109 -0
- data/lib/templates/puppet/step-0/modules/rbenv/templates/Gemfile.erb +5 -0
- data/lib/templates/puppet/step-0/modules/rbenv/templates/dot.rbenvrc.erb +8 -0
- data/lib/templates/puppet/step-0/modules/stdlib/CHANGELOG.md +418 -0
- data/lib/templates/puppet/step-0/modules/stdlib/CONTRIBUTING.md +65 -0
- data/lib/templates/puppet/step-0/modules/stdlib/Gemfile +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/Gemfile.lock +166 -0
- data/lib/templates/puppet/step-0/modules/stdlib/LICENSE +19 -0
- data/lib/templates/puppet/step-0/modules/stdlib/Modulefile +11 -0
- data/lib/templates/puppet/step-0/modules/stdlib/README.markdown +1304 -0
- data/lib/templates/puppet/step-0/modules/stdlib/README_DEVELOPER.markdown +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/README_SPECS.markdown +7 -0
- data/lib/templates/puppet/step-0/modules/stdlib/RELEASE_PROCESS.markdown +24 -0
- data/lib/templates/puppet/step-0/modules/stdlib/Rakefile +18 -0
- data/lib/templates/puppet/step-0/modules/stdlib/checksums.json +349 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/facter_dot_d.rb +202 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/pe_version.rb +53 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/puppet_vardir.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/root_home.rb +32 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/util/puppet_settings.rb +21 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/abs.rb +36 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/any2array.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/base64.rb +37 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/bool2num.rb +49 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/capitalize.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/chomp.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/chop.rb +37 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/concat.rb +41 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/count.rb +22 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb +44 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete.rb +46 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_at.rb +49 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_undef_values.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_values.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/difference.rb +36 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/dirname.rb +15 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/downcase.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/empty.rb +28 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb +45 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/flatten.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/floor.rb +25 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb +46 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb +17 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/getparam.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/getvar.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/grep.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb +52 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb +25 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb +25 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_key.rb +28 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/hash.rb +41 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/intersection.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_array.rb +22 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_bool.rb +22 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb +50 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_float.rb +30 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_hash.rb +22 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_integer.rb +45 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb +32 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb +27 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb +75 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_string.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/join.rb +41 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb +47 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/keys.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb +20 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/lstrip.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/max.rb +21 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/member.rb +44 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/merge.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/min.rb +21 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/num2bool.rb +43 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/parsejson.rb +24 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb +24 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/pick.rb +29 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/pick_default.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/prefix.rb +45 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/range.rb +88 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/reject.rb +31 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/reverse.rb +28 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/rstrip.rb +32 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/shuffle.rb +46 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/size.rb +48 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/sort.rb +27 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/squeeze.rb +36 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/str2bool.rb +46 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb +32 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/strftime.rb +107 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/strip.rb +39 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/suffix.rb +45 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/swapcase.rb +39 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/time.rb +49 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb +28 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/type.rb +50 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/union.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/unique.rb +51 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/upcase.rb +41 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/uriescape.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb +56 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_array.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb +81 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb +48 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_ipv4_address.rb +48 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_ipv6_address.rb +49 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_re.rb +40 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb +71 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_string.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/values.rb +39 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/values_at.rb +98 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/zip.rb +65 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/provider/file_line/ruby.rb +83 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/type/anchor.rb +46 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/type/file_line.rb +79 -0
- data/lib/templates/puppet/step-0/modules/stdlib/manifests/init.pp +20 -0
- data/lib/templates/puppet/step-0/modules/stdlib/manifests/stages.pp +43 -0
- data/lib/templates/puppet/step-0/modules/stdlib/metadata.json +111 -0
- data/lib/templates/puppet/step-0/modules/sudo/.fixtures.yml +5 -0
- data/lib/templates/puppet/step-0/modules/sudo/.gemfile +14 -0
- data/lib/templates/puppet/step-0/modules/sudo/.gemfile.lock +43 -0
- data/lib/templates/puppet/step-0/modules/sudo/.travis.yml +34 -0
- data/lib/templates/puppet/step-0/modules/sudo/LICENSE +13 -0
- data/lib/templates/puppet/step-0/modules/sudo/Modulefile +9 -0
- data/lib/templates/puppet/step-0/modules/sudo/README.md +171 -0
- data/lib/templates/puppet/step-0/modules/sudo/Rakefile +1 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.aix +90 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.archlinux +90 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.deb +90 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.freebsd +98 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.omnios +90 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.rhel5 +97 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.rhel6 +115 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.solaris +90 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.suse +81 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.ubuntu +30 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.wheezy +17 -0
- data/lib/templates/puppet/step-0/modules/sudo/lib/augeas/lenses/fixedsudoers.aug +520 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/allow.pp +76 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/conf.pp +105 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/configs.pp +24 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/init.pp +151 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/package/aix.pp +46 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/package/solaris.pp +60 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/package.pp +61 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/params.pp +127 -0
- data/lib/templates/puppet/step-0/modules/sudo/metadata.json +59 -0
- data/lib/templates/puppet/step-0/modules/sudo/templates/users_groups.erb +9 -0
- data/lib/templates/puppet/step-0/modules/users/manifests/init.pp +15 -0
- data/lib/templates/puppet/step-0/modules/users/manifests/user.pp +50 -0
- data/lib/templates/puppet/step-1/Puppetfile.erb +5 -0
- data/lib/templates/puppet/step-1/hiera/data/common.yaml.erb +11 -0
- data/lib/templates/puppet/step-1/hiera/data/environment.yaml.erb +11 -0
- data/lib/templates/puppet/step-1/hiera/data/node.yaml.erb +11 -0
- data/lib/templates/puppet/step-1/hiera/hiera.yaml.erb +11 -0
- data/lib/templates/puppet/step-1/manifests/node.erb +5 -0
- data/lib/templates/puppet/step-1/manifests/site.pp.erb +15 -0
- data/lib/templates/puppet/step-1/modules/users/manifests/init.pp +15 -0
- data/lib/templates/puppet/step-1/modules/users/manifests/user.pp +49 -0
- data/lib/templates/puppet/step-2/Puppetfile.erb +5 -0
- data/lib/templates/puppet/step-2/hiera/data/common.yaml.erb +1 -0
- data/lib/templates/puppet/step-2/hiera/data/environment.yaml.erb +1 -0
- data/lib/templates/puppet/step-2/hiera/data/node.yaml.erb +1 -0
- data/lib/templates/puppet/step-2/hiera/hiera.yaml.erb +11 -0
- data/lib/templates/puppet/step-2/manifests/node.erb +3 -0
- data/lib/templates/puppet/step-2/manifests/site.pp.erb +10 -0
- data/lib/templates/puppet/step-3/Puppetfile.erb +5 -0
- data/lib/templates/puppet/step-3/hiera/data/common.yaml.erb +99 -0
- data/lib/templates/puppet/step-3/hiera/data/environment.yaml.erb +99 -0
- data/lib/templates/puppet/step-3/hiera/data/node.yaml.erb +99 -0
- data/lib/templates/puppet/step-3/hiera/hiera.yaml.erb +11 -0
- data/lib/templates/puppet/step-3/manifests/node.erb +5 -0
- data/lib/templates/puppet/step-3/manifests/site.pp.erb +15 -0
- data/spec/environment_spec.rb +82 -0
- data/spec/factories/environment.rb +20 -0
- data/spec/factories/node.rb +22 -0
- data/spec/factories/profile.rb +10 -0
- data/spec/factories/project.rb +17 -0
- data/spec/factories/provision.rb +13 -0
- data/spec/factories/role.rb +9 -0
- data/spec/fixtures/Capfile.test +2 -0
- data/spec/fixtures/Gemfile.test +5 -0
- data/spec/fixtures/config/deploy/environment.test +35 -0
- data/spec/fixtures/config/deploy/production.test +35 -0
- data/spec/fixtures/config/deploy/staging.test +35 -0
- data/spec/fixtures/config/deploy/vagrant.test +37 -0
- data/spec/fixtures/config/deploy.test +120 -0
- data/spec/fixtures/dot_bebox.test.erb +4 -0
- data/spec/fixtures/dot_gitignore.test +8 -0
- data/spec/fixtures/node/Vagrantfile.test.erb +18 -0
- data/spec/fixtures/node/node_0.test.erb +3 -0
- data/spec/fixtures/node/prepared_node_0.test.erb +4 -0
- data/spec/fixtures/node/provisioned_node_0.test.erb +4 -0
- data/spec/fixtures/node/vagrant_deploy.test +38 -0
- data/spec/fixtures/puppet/hiera/data/node0.server1.test.yaml.test +4 -0
- data/spec/fixtures/puppet/profiles/test/profile_0/Puppetfile.test +24 -0
- data/spec/fixtures/puppet/profiles/test/profile_0/Puppetfile_with_modules.test +20 -0
- data/spec/fixtures/puppet/profiles/test/profile_0/manifests/init.pp.test +17 -0
- data/spec/fixtures/puppet/profiles/test/profile_0/manifests/init_with_content.pp.test +22 -0
- data/spec/fixtures/puppet/roles/manifests/init.pp.test +14 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/common.yaml.test +26 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/node0.server1.test.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/pname_env.yaml.test +26 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/production.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/staging.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/vagrant.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/hiera.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-0/manifests/site.pp.test +10 -0
- data/spec/fixtures/puppet/steps/step-0/manifests/site_with_node.pp.test +15 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/common.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/node0.server1.test.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/pname_env.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/production.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/staging.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/vagrant.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/hiera.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-1/manifests/site.pp.test +10 -0
- data/spec/fixtures/puppet/steps/step-1/manifests/site_with_node.pp.test +15 -0
- data/spec/fixtures/puppet/steps/step-2/Puppetfile.test +6 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/common.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/node0.server1.test.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/pname_env.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/production.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/staging.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/vagrant.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/hiera.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-2/manifests/site.pp.test +10 -0
- data/spec/fixtures/puppet/steps/step-2/manifests/site_with_node.pp.test +13 -0
- data/spec/fixtures/puppet/steps/step-2/manifests/site_with_node_role_association.pp.test +16 -0
- data/spec/fixtures/puppet/steps/step-2/modules/profiles/manifests/test/profile_0.pp.test +17 -0
- data/spec/fixtures/puppet/steps/step-2/modules/roles/manifests/role_0.pp.test +16 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/common.yaml.test +99 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/node0.server1.test.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/pname_env.yaml.test +99 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/production.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/staging.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/vagrant.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/hiera.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-3/manifests/site.pp.test +10 -0
- data/spec/fixtures/puppet/steps/step-3/manifests/site_with_node.pp.test +15 -0
- data/spec/fixtures/puppet/ubuntu_dependencies.test +10 -0
- data/spec/node0.server1.test/prepare_phase_spec.rb +53 -0
- data/spec/node0.server1.test/provision_step_0_spec.rb +46 -0
- data/spec/node0.server1.test/provision_step_1_spec.rb +41 -0
- data/spec/node0.server1.test/provision_step_2_spec.rb +79 -0
- data/spec/node0.server1.test/provision_step_3_spec.rb +76 -0
- data/spec/node_role_spec.rb +20 -0
- data/spec/node_spec.rb +71 -0
- data/spec/node_wizard_spec.rb +22 -0
- data/spec/ordered_phases_spec.rb +55 -0
- data/spec/pre_prepare_spec.rb +78 -0
- data/spec/pre_provision_steps_spec.rb +40 -0
- data/spec/profile_spec.rb +70 -0
- data/spec/project_spec.rb +195 -0
- data/spec/project_wizard_spec.rb +51 -0
- data/spec/puppet_spec_helper.rb +15 -0
- data/spec/role_profiles_spec.rb +40 -0
- data/spec/role_spec.rb +56 -0
- data/spec/spec_helper.rb +37 -0
- data/spec/support/config_specs.yaml.example +2 -0
- data/spec/vagrant_spec_helper.rb +15 -0
- metadata +625 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
module Puppet::Parser::Functions
|
2
|
+
newfunction(:delete_values, :type => :rvalue, :doc => <<-EOS
|
3
|
+
Deletes all instances of a given value from a hash.
|
4
|
+
|
5
|
+
*Examples:*
|
6
|
+
|
7
|
+
delete_values({'a'=>'A','b'=>'B','c'=>'C','B'=>'D'}, 'B')
|
8
|
+
|
9
|
+
Would return: {'a'=>'A','c'=>'C','B'=>'D'}
|
10
|
+
|
11
|
+
EOS
|
12
|
+
) do |arguments|
|
13
|
+
|
14
|
+
raise(Puppet::ParseError,
|
15
|
+
"delete_values(): Wrong number of arguments given " +
|
16
|
+
"(#{arguments.size} of 2)") if arguments.size != 2
|
17
|
+
|
18
|
+
hash, item = arguments
|
19
|
+
|
20
|
+
if not hash.is_a?(Hash)
|
21
|
+
raise(TypeError, "delete_values(): First argument must be a Hash. " + \
|
22
|
+
"Given an argument of class #{hash.class}.")
|
23
|
+
end
|
24
|
+
hash.dup.delete_if { |key, val| item == val }
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#
|
2
|
+
# difference.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
module Puppet::Parser::Functions
|
6
|
+
newfunction(:difference, :type => :rvalue, :doc => <<-EOS
|
7
|
+
This function returns the difference between two arrays.
|
8
|
+
The returned array is a copy of the original array, removing any items that
|
9
|
+
also appear in the second array.
|
10
|
+
|
11
|
+
*Examples:*
|
12
|
+
|
13
|
+
difference(["a","b","c"],["b","c","d"])
|
14
|
+
|
15
|
+
Would return: ["a"]
|
16
|
+
EOS
|
17
|
+
) do |arguments|
|
18
|
+
|
19
|
+
# Two arguments are required
|
20
|
+
raise(Puppet::ParseError, "difference(): Wrong number of arguments " +
|
21
|
+
"given (#{arguments.size} for 2)") if arguments.size != 2
|
22
|
+
|
23
|
+
first = arguments[0]
|
24
|
+
second = arguments[1]
|
25
|
+
|
26
|
+
unless first.is_a?(Array) && second.is_a?(Array)
|
27
|
+
raise(Puppet::ParseError, 'difference(): Requires 2 arrays')
|
28
|
+
end
|
29
|
+
|
30
|
+
result = first - second
|
31
|
+
|
32
|
+
return result
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# vim: set ts=2 sw=2 et :
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Puppet::Parser::Functions
|
2
|
+
newfunction(:dirname, :type => :rvalue, :doc => <<-EOS
|
3
|
+
Returns the dirname of a path.
|
4
|
+
EOS
|
5
|
+
) do |arguments|
|
6
|
+
|
7
|
+
raise(Puppet::ParseError, "dirname(): Wrong number of arguments " +
|
8
|
+
"given (#{arguments.size} for 1)") if arguments.size < 1
|
9
|
+
|
10
|
+
path = arguments[0]
|
11
|
+
return File.dirname(path)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# vim: set ts=2 sw=2 et :
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#
|
2
|
+
# downcase.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
module Puppet::Parser::Functions
|
6
|
+
newfunction(:downcase, :type => :rvalue, :doc => <<-EOS
|
7
|
+
Converts the case of a string or all strings in an array to lower case.
|
8
|
+
EOS
|
9
|
+
) do |arguments|
|
10
|
+
|
11
|
+
raise(Puppet::ParseError, "downcase(): Wrong number of arguments " +
|
12
|
+
"given (#{arguments.size} for 1)") if arguments.size < 1
|
13
|
+
|
14
|
+
value = arguments[0]
|
15
|
+
klass = value.class
|
16
|
+
|
17
|
+
unless [Array, String].include?(klass)
|
18
|
+
raise(Puppet::ParseError, 'downcase(): Requires either ' +
|
19
|
+
'array or string to work with')
|
20
|
+
end
|
21
|
+
|
22
|
+
if value.is_a?(Array)
|
23
|
+
# Numbers in Puppet are often string-encoded which is troublesome ...
|
24
|
+
result = value.collect { |i| i.is_a?(String) ? i.downcase : i }
|
25
|
+
else
|
26
|
+
result = value.downcase
|
27
|
+
end
|
28
|
+
|
29
|
+
return result
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# vim: set ts=2 sw=2 et :
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# empty.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
module Puppet::Parser::Functions
|
6
|
+
newfunction(:empty, :type => :rvalue, :doc => <<-EOS
|
7
|
+
Returns true if the variable is empty.
|
8
|
+
EOS
|
9
|
+
) do |arguments|
|
10
|
+
|
11
|
+
raise(Puppet::ParseError, "empty(): Wrong number of arguments " +
|
12
|
+
"given (#{arguments.size} for 1)") if arguments.size < 1
|
13
|
+
|
14
|
+
value = arguments[0]
|
15
|
+
klass = value.class
|
16
|
+
|
17
|
+
unless [Array, Hash, String].include?(klass)
|
18
|
+
raise(Puppet::ParseError, 'empty(): Requires either ' +
|
19
|
+
'array, hash or string to work with')
|
20
|
+
end
|
21
|
+
|
22
|
+
result = value.empty?
|
23
|
+
|
24
|
+
return result
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# vim: set ts=2 sw=2 et :
|
data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# ensure_packages.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
module Puppet::Parser::Functions
|
6
|
+
newfunction(:ensure_packages, :type => :statement, :doc => <<-EOS
|
7
|
+
Takes a list of packages and only installs them if they don't already exist.
|
8
|
+
It optionally takes a hash as a second parameter that will be passed as the
|
9
|
+
third argument to the ensure_resource() function.
|
10
|
+
EOS
|
11
|
+
) do |arguments|
|
12
|
+
|
13
|
+
if arguments.size > 2 or arguments.size == 0
|
14
|
+
raise(Puppet::ParseError, "ensure_packages(): Wrong number of arguments " +
|
15
|
+
"given (#{arguments.size} for 1 or 2)")
|
16
|
+
elsif arguments.size == 2 and !arguments[1].is_a?(Hash)
|
17
|
+
raise(Puppet::ParseError, 'ensure_packages(): Requires second argument to be a Hash')
|
18
|
+
end
|
19
|
+
|
20
|
+
packages = Array(arguments[0])
|
21
|
+
|
22
|
+
if arguments[1]
|
23
|
+
defaults = { 'ensure' => 'present' }.merge(arguments[1])
|
24
|
+
else
|
25
|
+
defaults = { 'ensure' => 'present' }
|
26
|
+
end
|
27
|
+
|
28
|
+
Puppet::Parser::Functions.function(:ensure_resource)
|
29
|
+
packages.each { |package_name|
|
30
|
+
function_ensure_resource(['package', package_name, defaults ])
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# vim: set ts=2 sw=2 et :
|
data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Test whether a given class or definition is defined
|
2
|
+
require 'puppet/parser/functions'
|
3
|
+
|
4
|
+
Puppet::Parser::Functions.newfunction(:ensure_resource,
|
5
|
+
:type => :statement,
|
6
|
+
:doc => <<-'ENDOFDOC'
|
7
|
+
Takes a resource type, title, and a list of attributes that describe a
|
8
|
+
resource.
|
9
|
+
|
10
|
+
user { 'dan':
|
11
|
+
ensure => present,
|
12
|
+
}
|
13
|
+
|
14
|
+
This example only creates the resource if it does not already exist:
|
15
|
+
|
16
|
+
ensure_resource('user', 'dan', {'ensure' => 'present' })
|
17
|
+
|
18
|
+
If the resource already exists but does not match the specified parameters,
|
19
|
+
this function will attempt to recreate the resource leading to a duplicate
|
20
|
+
resource definition error.
|
21
|
+
|
22
|
+
An array of resources can also be passed in and each will be created with
|
23
|
+
the type and parameters specified if it doesn't already exist.
|
24
|
+
|
25
|
+
ensure_resource('user', ['dan','alex'], {'ensure' => 'present'})
|
26
|
+
|
27
|
+
ENDOFDOC
|
28
|
+
) do |vals|
|
29
|
+
type, title, params = vals
|
30
|
+
raise(ArgumentError, 'Must specify a type') unless type
|
31
|
+
raise(ArgumentError, 'Must specify a title') unless title
|
32
|
+
params ||= {}
|
33
|
+
|
34
|
+
items = [title].flatten
|
35
|
+
|
36
|
+
items.each do |item|
|
37
|
+
Puppet::Parser::Functions.function(:defined_with_params)
|
38
|
+
if function_defined_with_params(["#{type}[#{item}]", params])
|
39
|
+
Puppet.debug("Resource #{type}[#{item}] not created because it already exists")
|
40
|
+
else
|
41
|
+
Puppet::Parser::Functions.function(:create_resources)
|
42
|
+
function_create_resources([type.capitalize, { item => params }])
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#
|
2
|
+
# flatten.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
module Puppet::Parser::Functions
|
6
|
+
newfunction(:flatten, :type => :rvalue, :doc => <<-EOS
|
7
|
+
This function flattens any deeply nested arrays and returns a single flat array
|
8
|
+
as a result.
|
9
|
+
|
10
|
+
*Examples:*
|
11
|
+
|
12
|
+
flatten(['a', ['b', ['c']]])
|
13
|
+
|
14
|
+
Would return: ['a','b','c']
|
15
|
+
EOS
|
16
|
+
) do |arguments|
|
17
|
+
|
18
|
+
raise(Puppet::ParseError, "flatten(): Wrong number of arguments " +
|
19
|
+
"given (#{arguments.size} for 1)") if arguments.size != 1
|
20
|
+
|
21
|
+
array = arguments[0]
|
22
|
+
|
23
|
+
unless array.is_a?(Array)
|
24
|
+
raise(Puppet::ParseError, 'flatten(): Requires array to work with')
|
25
|
+
end
|
26
|
+
|
27
|
+
result = array.flatten
|
28
|
+
|
29
|
+
return result
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# vim: set ts=2 sw=2 et :
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Puppet::Parser::Functions
|
2
|
+
newfunction(:floor, :type => :rvalue, :doc => <<-EOS
|
3
|
+
Returns the largest integer less or equal to the argument.
|
4
|
+
Takes a single numeric value as an argument.
|
5
|
+
EOS
|
6
|
+
) do |arguments|
|
7
|
+
|
8
|
+
raise(Puppet::ParseError, "floor(): Wrong number of arguments " +
|
9
|
+
"given (#{arguments.size} for 1)") if arguments.size != 1
|
10
|
+
|
11
|
+
begin
|
12
|
+
arg = Float(arguments[0])
|
13
|
+
rescue TypeError, ArgumentError => e
|
14
|
+
raise(Puppet::ParseError, "floor(): Wrong argument type " +
|
15
|
+
"given (#{arguments[0]} for Numeric)")
|
16
|
+
end
|
17
|
+
|
18
|
+
raise(Puppet::ParseError, "floor(): Wrong argument type " +
|
19
|
+
"given (#{arg.class} for Numeric)") if arg.is_a?(Numeric) == false
|
20
|
+
|
21
|
+
arg.floor
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# vim: set ts=2 sw=2 et :
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#
|
2
|
+
# fqdn_rotate.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
module Puppet::Parser::Functions
|
6
|
+
newfunction(:fqdn_rotate, :type => :rvalue, :doc => <<-EOS
|
7
|
+
Rotates an array a random number of times based on a nodes fqdn.
|
8
|
+
EOS
|
9
|
+
) do |arguments|
|
10
|
+
|
11
|
+
raise(Puppet::ParseError, "fqdn_rotate(): Wrong number of arguments " +
|
12
|
+
"given (#{arguments.size} for 1)") if arguments.size < 1
|
13
|
+
|
14
|
+
value = arguments[0]
|
15
|
+
klass = value.class
|
16
|
+
require 'digest/md5'
|
17
|
+
|
18
|
+
unless [Array, String].include?(klass)
|
19
|
+
raise(Puppet::ParseError, 'fqdn_rotate(): Requires either ' +
|
20
|
+
'array or string to work with')
|
21
|
+
end
|
22
|
+
|
23
|
+
result = value.clone
|
24
|
+
|
25
|
+
string = value.is_a?(String) ? true : false
|
26
|
+
|
27
|
+
# Check whether it makes sense to rotate ...
|
28
|
+
return result if result.size <= 1
|
29
|
+
|
30
|
+
# We turn any string value into an array to be able to rotate ...
|
31
|
+
result = string ? result.split('') : result
|
32
|
+
|
33
|
+
elements = result.size
|
34
|
+
|
35
|
+
srand(Digest::MD5.hexdigest([lookupvar('::fqdn'),arguments].join(':')).hex)
|
36
|
+
rand(elements).times {
|
37
|
+
result.push result.shift
|
38
|
+
}
|
39
|
+
|
40
|
+
result = string ? result.join : result
|
41
|
+
|
42
|
+
return result
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# vim: set ts=2 sw=2 et :
|
data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Puppet::Parser::Functions
|
2
|
+
newfunction(:get_module_path, :type =>:rvalue, :doc => <<-EOT
|
3
|
+
Returns the absolute path of the specified module for the current
|
4
|
+
environment.
|
5
|
+
|
6
|
+
Example:
|
7
|
+
$module_path = get_module_path('stdlib')
|
8
|
+
EOT
|
9
|
+
) do |args|
|
10
|
+
raise(Puppet::ParseError, "get_module_path(): Wrong number of arguments, expects one") unless args.size == 1
|
11
|
+
if module_path = Puppet::Module.find(args[0], compiler.environment.to_s)
|
12
|
+
module_path.path
|
13
|
+
else
|
14
|
+
raise(Puppet::ParseError, "Could not find module #{args[0]} in environment #{compiler.environment}")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Test whether a given class or definition is defined
|
2
|
+
require 'puppet/parser/functions'
|
3
|
+
|
4
|
+
Puppet::Parser::Functions.newfunction(:getparam,
|
5
|
+
:type => :rvalue,
|
6
|
+
:doc => <<-'ENDOFDOC'
|
7
|
+
Takes a resource reference and name of the parameter and
|
8
|
+
returns value of resource's parameter.
|
9
|
+
|
10
|
+
*Examples:*
|
11
|
+
|
12
|
+
define example_resource($param) {
|
13
|
+
}
|
14
|
+
|
15
|
+
example_resource { "example_resource_instance":
|
16
|
+
param => "param_value"
|
17
|
+
}
|
18
|
+
|
19
|
+
getparam(Example_resource["example_resource_instance"], "param")
|
20
|
+
|
21
|
+
Would return: param_value
|
22
|
+
ENDOFDOC
|
23
|
+
) do |vals|
|
24
|
+
reference, param = vals
|
25
|
+
raise(ArgumentError, 'Must specify a reference') unless reference
|
26
|
+
raise(ArgumentError, 'Must specify name of a parameter') unless param and param.instance_of? String
|
27
|
+
|
28
|
+
return '' if param.empty?
|
29
|
+
|
30
|
+
if resource = findresource(reference.to_s)
|
31
|
+
return resource[param] if resource[param]
|
32
|
+
end
|
33
|
+
|
34
|
+
return ''
|
35
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Puppet::Parser::Functions
|
2
|
+
|
3
|
+
newfunction(:getvar, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
|
4
|
+
Lookup a variable in a remote namespace.
|
5
|
+
|
6
|
+
For example:
|
7
|
+
|
8
|
+
$foo = getvar('site::data::foo')
|
9
|
+
# Equivalent to $foo = $site::data::foo
|
10
|
+
|
11
|
+
This is useful if the namespace itself is stored in a string:
|
12
|
+
|
13
|
+
$datalocation = 'site::data'
|
14
|
+
$bar = getvar("${datalocation}::bar")
|
15
|
+
# Equivalent to $bar = $site::data::bar
|
16
|
+
ENDHEREDOC
|
17
|
+
|
18
|
+
unless args.length == 1
|
19
|
+
raise Puppet::ParseError, ("getvar(): wrong number of arguments (#{args.length}; must be 1)")
|
20
|
+
end
|
21
|
+
|
22
|
+
self.lookupvar("#{args[0]}")
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#
|
2
|
+
# grep.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
module Puppet::Parser::Functions
|
6
|
+
newfunction(:grep, :type => :rvalue, :doc => <<-EOS
|
7
|
+
This function searches through an array and returns any elements that match
|
8
|
+
the provided regular expression.
|
9
|
+
|
10
|
+
*Examples:*
|
11
|
+
|
12
|
+
grep(['aaa','bbb','ccc','aaaddd'], 'aaa')
|
13
|
+
|
14
|
+
Would return:
|
15
|
+
|
16
|
+
['aaa','aaaddd']
|
17
|
+
EOS
|
18
|
+
) do |arguments|
|
19
|
+
|
20
|
+
if (arguments.size != 2) then
|
21
|
+
raise(Puppet::ParseError, "grep(): Wrong number of arguments "+
|
22
|
+
"given #{arguments.size} for 2")
|
23
|
+
end
|
24
|
+
|
25
|
+
a = arguments[0]
|
26
|
+
pattern = Regexp.new(arguments[1])
|
27
|
+
|
28
|
+
a.grep(pattern)
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# vim: set ts=2 sw=2 et :
|
data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#
|
2
|
+
# has_interface_with
|
3
|
+
#
|
4
|
+
|
5
|
+
module Puppet::Parser::Functions
|
6
|
+
newfunction(:has_interface_with, :type => :rvalue, :doc => <<-EOS
|
7
|
+
Returns boolean based on kind and value:
|
8
|
+
* macaddress
|
9
|
+
* netmask
|
10
|
+
* ipaddress
|
11
|
+
* network
|
12
|
+
|
13
|
+
has_interface_with("macaddress", "x:x:x:x:x:x")
|
14
|
+
has_interface_with("ipaddress", "127.0.0.1") => true
|
15
|
+
etc.
|
16
|
+
|
17
|
+
If no "kind" is given, then the presence of the interface is checked:
|
18
|
+
has_interface_with("lo") => true
|
19
|
+
EOS
|
20
|
+
) do |args|
|
21
|
+
|
22
|
+
raise(Puppet::ParseError, "has_interface_with(): Wrong number of arguments " +
|
23
|
+
"given (#{args.size} for 1 or 2)") if args.size < 1 or args.size > 2
|
24
|
+
|
25
|
+
interfaces = lookupvar('interfaces')
|
26
|
+
|
27
|
+
# If we do not have any interfaces, then there are no requested attributes
|
28
|
+
return false if (interfaces == :undefined)
|
29
|
+
|
30
|
+
interfaces = interfaces.split(',')
|
31
|
+
|
32
|
+
if args.size == 1
|
33
|
+
return interfaces.member?(args[0])
|
34
|
+
end
|
35
|
+
|
36
|
+
kind, value = args
|
37
|
+
|
38
|
+
if lookupvar(kind) == value
|
39
|
+
return true
|
40
|
+
end
|
41
|
+
|
42
|
+
result = false
|
43
|
+
interfaces.each do |iface|
|
44
|
+
if value == lookupvar("#{kind}_#{iface}")
|
45
|
+
result = true
|
46
|
+
break
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
result
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#
|
2
|
+
# has_ip_address
|
3
|
+
#
|
4
|
+
|
5
|
+
module Puppet::Parser::Functions
|
6
|
+
newfunction(:has_ip_address, :type => :rvalue, :doc => <<-EOS
|
7
|
+
Returns true if the client has the requested IP address on some interface.
|
8
|
+
|
9
|
+
This function iterates through the 'interfaces' fact and checks the
|
10
|
+
'ipaddress_IFACE' facts, performing a simple string comparison.
|
11
|
+
EOS
|
12
|
+
) do |args|
|
13
|
+
|
14
|
+
raise(Puppet::ParseError, "has_ip_address(): Wrong number of arguments " +
|
15
|
+
"given (#{args.size} for 1)") if args.size != 1
|
16
|
+
|
17
|
+
Puppet::Parser::Functions.autoloader.load(:has_interface_with) \
|
18
|
+
unless Puppet::Parser::Functions.autoloader.loaded?(:has_interface_with)
|
19
|
+
|
20
|
+
function_has_interface_with(['ipaddress', args[0]])
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# vim:sts=2 sw=2
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#
|
2
|
+
# has_ip_network
|
3
|
+
#
|
4
|
+
|
5
|
+
module Puppet::Parser::Functions
|
6
|
+
newfunction(:has_ip_network, :type => :rvalue, :doc => <<-EOS
|
7
|
+
Returns true if the client has an IP address within the requested network.
|
8
|
+
|
9
|
+
This function iterates through the 'interfaces' fact and checks the
|
10
|
+
'network_IFACE' facts, performing a simple string comparision.
|
11
|
+
EOS
|
12
|
+
) do |args|
|
13
|
+
|
14
|
+
raise(Puppet::ParseError, "has_ip_network(): Wrong number of arguments " +
|
15
|
+
"given (#{args.size} for 1)") if args.size != 1
|
16
|
+
|
17
|
+
Puppet::Parser::Functions.autoloader.load(:has_interface_with) \
|
18
|
+
unless Puppet::Parser::Functions.autoloader.loaded?(:has_interface_with)
|
19
|
+
|
20
|
+
function_has_interface_with(['network', args[0]])
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# vim:sts=2 sw=2
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Puppet::Parser::Functions
|
2
|
+
|
3
|
+
newfunction(:has_key, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
|
4
|
+
Determine if a hash has a certain key value.
|
5
|
+
|
6
|
+
Example:
|
7
|
+
|
8
|
+
$my_hash = {'key_one' => 'value_one'}
|
9
|
+
if has_key($my_hash, 'key_two') {
|
10
|
+
notice('we will not reach here')
|
11
|
+
}
|
12
|
+
if has_key($my_hash, 'key_one') {
|
13
|
+
notice('this will be printed')
|
14
|
+
}
|
15
|
+
|
16
|
+
ENDHEREDOC
|
17
|
+
|
18
|
+
unless args.length == 2
|
19
|
+
raise Puppet::ParseError, ("has_key(): wrong number of arguments (#{args.length}; must be 2)")
|
20
|
+
end
|
21
|
+
unless args[0].is_a?(Hash)
|
22
|
+
raise Puppet::ParseError, "has_key(): expects the first argument to be a hash, got #{args[0].inspect} which is of type #{args[0].class}"
|
23
|
+
end
|
24
|
+
args[0].has_key?(args[1])
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#
|
2
|
+
# hash.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
module Puppet::Parser::Functions
|
6
|
+
newfunction(:hash, :type => :rvalue, :doc => <<-EOS
|
7
|
+
This function converts an array into a hash.
|
8
|
+
|
9
|
+
*Examples:*
|
10
|
+
|
11
|
+
hash(['a',1,'b',2,'c',3])
|
12
|
+
|
13
|
+
Would return: {'a'=>1,'b'=>2,'c'=>3}
|
14
|
+
EOS
|
15
|
+
) do |arguments|
|
16
|
+
|
17
|
+
raise(Puppet::ParseError, "hash(): Wrong number of arguments " +
|
18
|
+
"given (#{arguments.size} for 1)") if arguments.size < 1
|
19
|
+
|
20
|
+
array = arguments[0]
|
21
|
+
|
22
|
+
unless array.is_a?(Array)
|
23
|
+
raise(Puppet::ParseError, 'hash(): Requires array to work with')
|
24
|
+
end
|
25
|
+
|
26
|
+
result = {}
|
27
|
+
|
28
|
+
begin
|
29
|
+
# This is to make it compatible with older version of Ruby ...
|
30
|
+
array = array.flatten
|
31
|
+
result = Hash[*array]
|
32
|
+
rescue Exception
|
33
|
+
raise(Puppet::ParseError, 'hash(): Unable to compute ' +
|
34
|
+
'hash from array given')
|
35
|
+
end
|
36
|
+
|
37
|
+
return result
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# vim: set ts=2 sw=2 et :
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#
|
2
|
+
# intersection.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
module Puppet::Parser::Functions
|
6
|
+
newfunction(:intersection, :type => :rvalue, :doc => <<-EOS
|
7
|
+
This function returns an array an intersection of two.
|
8
|
+
|
9
|
+
*Examples:*
|
10
|
+
|
11
|
+
intersection(["a","b","c"],["b","c","d"])
|
12
|
+
|
13
|
+
Would return: ["b","c"]
|
14
|
+
EOS
|
15
|
+
) do |arguments|
|
16
|
+
|
17
|
+
# Two arguments are required
|
18
|
+
raise(Puppet::ParseError, "intersection(): Wrong number of arguments " +
|
19
|
+
"given (#{arguments.size} for 2)") if arguments.size != 2
|
20
|
+
|
21
|
+
first = arguments[0]
|
22
|
+
second = arguments[1]
|
23
|
+
|
24
|
+
unless first.is_a?(Array) && second.is_a?(Array)
|
25
|
+
raise(Puppet::ParseError, 'intersection(): Requires 2 arrays')
|
26
|
+
end
|
27
|
+
|
28
|
+
result = first & second
|
29
|
+
|
30
|
+
return result
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# vim: set ts=2 sw=2 et :
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# is_array.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
module Puppet::Parser::Functions
|
6
|
+
newfunction(:is_array, :type => :rvalue, :doc => <<-EOS
|
7
|
+
Returns true if the variable passed to this function is an array.
|
8
|
+
EOS
|
9
|
+
) do |arguments|
|
10
|
+
|
11
|
+
raise(Puppet::ParseError, "is_array(): Wrong number of arguments " +
|
12
|
+
"given (#{arguments.size} for 1)") if arguments.size < 1
|
13
|
+
|
14
|
+
type = arguments[0]
|
15
|
+
|
16
|
+
result = type.is_a?(Array)
|
17
|
+
|
18
|
+
return result
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# vim: set ts=2 sw=2 et :
|