From 9fadcb74cd7c2a067b5ccb315cd439ca95c947bd Mon Sep 17 00:00:00 2001 From: Sergio Oliveira Date: Fri, 25 Jul 2014 15:19:43 -0300 Subject: [PATCH] Removed modules from repo. We'll use it from forge. --- puppet/modules/apt/.bundle/config | 2 -- puppet/modules/apt/.fixtures.yml | 5 ----- puppet/modules/apt/.forge-release/pom.xml | 29 ----------------------------- puppet/modules/apt/.forge-release/publish | 18 ------------------ puppet/modules/apt/.forge-release/settings.xml | 34 ---------------------------------- puppet/modules/apt/.forge-release/validate | 6 ------ puppet/modules/apt/.nodeset.yml | 19 ------------------- puppet/modules/apt/.travis.yml | 40 ---------------------------------------- puppet/modules/apt/CHANGELOG | 183 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- puppet/modules/apt/Gemfile | 16 ---------------- puppet/modules/apt/Gemfile.lock | 70 ---------------------------------------------------------------------- puppet/modules/apt/LICENSE | 19 ------------------- puppet/modules/apt/Modulefile | 14 -------------- puppet/modules/apt/README.md | 226 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- puppet/modules/apt/Rakefile | 2 -- puppet/modules/apt/manifests/backports.pp | 48 ------------------------------------------------ puppet/modules/apt/manifests/builddep.pp | 16 ---------------- puppet/modules/apt/manifests/conf.pp | 18 ------------------ puppet/modules/apt/manifests/debian/testing.pp | 21 --------------------- puppet/modules/apt/manifests/debian/unstable.pp | 21 --------------------- puppet/modules/apt/manifests/force.pp | 24 ------------------------ puppet/modules/apt/manifests/init.pp | 121 ------------------------------------------------------------------------------------------------------------------------- puppet/modules/apt/manifests/key.pp | 90 ------------------------------------------------------------------------------------------ puppet/modules/apt/manifests/params.pp | 33 --------------------------------- puppet/modules/apt/manifests/pin.pp | 73 ------------------------------------------------------------------------- puppet/modules/apt/manifests/ppa.pp | 63 --------------------------------------------------------------- puppet/modules/apt/manifests/release.pp | 17 ----------------- puppet/modules/apt/manifests/source.pp | 85 ------------------------------------------------------------------------------------- puppet/modules/apt/manifests/unattended_upgrades.pp | 68 -------------------------------------------------------------------- puppet/modules/apt/manifests/update.pp | 10 ---------- puppet/modules/apt/metadata.json | 87 --------------------------------------------------------------------------------------- puppet/modules/apt/spec/classes/apt_spec.rb | 133 ------------------------------------------------------------------------------------------------------------------------------------- puppet/modules/apt/spec/classes/backports_spec.rb | 71 ----------------------------------------------------------------------- puppet/modules/apt/spec/classes/debian_testing_spec.rb | 14 -------------- puppet/modules/apt/spec/classes/debian_unstable_spec.rb | 14 -------------- puppet/modules/apt/spec/classes/params_spec.rb | 13 ------------- puppet/modules/apt/spec/classes/release_spec.rb | 22 ---------------------- puppet/modules/apt/spec/classes/unattended_upgrades_spec.rb | 204 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ puppet/modules/apt/spec/defines/builddep_spec.rb | 18 ------------------ puppet/modules/apt/spec/defines/conf_spec.rb | 57 --------------------------------------------------------- puppet/modules/apt/spec/defines/force_spec.rb | 41 ----------------------------------------- puppet/modules/apt/spec/defines/key_spec.rb | 123 --------------------------------------------------------------------------------------------------------------------------- puppet/modules/apt/spec/defines/pin_spec.rb | 101 ----------------------------------------------------------------------------------------------------- puppet/modules/apt/spec/defines/ppa_spec.rb | 143 ----------------------------------------------------------------------------------------------------------------------------------------------- puppet/modules/apt/spec/defines/source_spec.rb | 166 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- puppet/modules/apt/spec/spec_helper.rb | 1 - puppet/modules/apt/spec/spec_helper_system.rb | 30 ------------------------------ puppet/modules/apt/spec/system/apt_builddep_spec.rb | 38 -------------------------------------- puppet/modules/apt/spec/system/apt_key_spec.rb | 53 ----------------------------------------------------- puppet/modules/apt/spec/system/apt_ppa_spec.rb | 59 ----------------------------------------------------------- puppet/modules/apt/spec/system/apt_source_spec.rb | 51 --------------------------------------------------- puppet/modules/apt/spec/system/basic_spec.rb | 10 ---------- puppet/modules/apt/spec/system/class_spec.rb | 20 -------------------- puppet/modules/apt/templates/10periodic.erb | 12 ------------ puppet/modules/apt/templates/50unattended-upgrades.erb | 53 ----------------------------------------------------- puppet/modules/apt/templates/pin.pref.erb | 22 ---------------------- puppet/modules/apt/templates/source.list.erb | 5 ----- puppet/modules/apt/tests/builddep.pp | 2 -- puppet/modules/apt/tests/debian/testing.pp | 2 -- puppet/modules/apt/tests/debian/unstable.pp | 2 -- puppet/modules/apt/tests/force.pp | 7 ------- puppet/modules/apt/tests/init.pp | 1 - puppet/modules/apt/tests/key.pp | 6 ------ puppet/modules/apt/tests/params.pp | 1 - puppet/modules/apt/tests/pin.pp | 5 ----- puppet/modules/apt/tests/ppa.pp | 4 ---- puppet/modules/apt/tests/release.pp | 4 ---- puppet/modules/apt/tests/source.pp | 29 ----------------------------- puppet/modules/apt/tests/unattended-upgrades.pp | 1 - puppet/modules/locale/README.md | 2 -- puppet/modules/locale/TODO | 1 - puppet/modules/locale/manifests/init.pp | 56 -------------------------------------------------------- puppet/modules/locale/test/init.pp | 1 - puppet/modules/nginx/LICENSE | 12 ------------ puppet/modules/nginx/Modulefile | 8 -------- puppet/modules/nginx/README | 116 -------------------------------------------------------------------------------------------------------------------- puppet/modules/nginx/manifests/config.pp | 27 --------------------------- puppet/modules/nginx/manifests/fcgi.pp | 13 ------------- puppet/modules/nginx/manifests/fcgi/site.pp | 86 -------------------------------------------------------------------------------------- puppet/modules/nginx/manifests/init.pp | 102 ------------------------------------------------------------------------------------------------------ puppet/modules/nginx/manifests/install_site.pp | 42 ------------------------------------------ puppet/modules/nginx/manifests/site.pp | 27 --------------------------- puppet/modules/nginx/manifests/site_include.pp | 20 -------------------- puppet/modules/nginx/templates/fcgi_site.erb | 39 --------------------------------------- puppet/modules/nginx/templates/includes/fastcgi_params.erb | 23 ----------------------- puppet/modules/nginx/templates/nginx.conf.erb | 37 ------------------------------------- puppet/modules/ntp/.gitignore | 18 ------------------ puppet/modules/ntp/README.md | 16 ---------------- puppet/modules/ntp/manifests/init.pp | 15 --------------- puppet/modules/ntp/tests/init.pp | 1 - puppet/modules/postfix/README.md | 2 -- puppet/modules/postfix/manifests/init.pp | 41 ----------------------------------------- puppet/modules/postfix/templates/postfix.preseed.erb | 17 ----------------- puppet/modules/postfix/tests/init.pp | 2 -- puppet/modules/ps1/README.md | 18 ------------------ puppet/modules/ps1/manifests/init.pp | 37 ------------------------------------- puppet/modules/ps1/test/init.pp | 1 - puppet/modules/stdlib/CHANGELOG | 278 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- puppet/modules/stdlib/CONTRIBUTING.md | 65 ----------------------------------------------------------------- puppet/modules/stdlib/Gemfile | 42 ------------------------------------------ puppet/modules/stdlib/LICENSE | 19 ------------------- puppet/modules/stdlib/Modulefile | 11 ----------- puppet/modules/stdlib/README.markdown | 1194 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ puppet/modules/stdlib/README_DEVELOPER.markdown | 35 ----------------------------------- puppet/modules/stdlib/README_SPECS.markdown | 7 ------- puppet/modules/stdlib/RELEASE_PROCESS.markdown | 24 ------------------------ puppet/modules/stdlib/Rakefile | 2 -- puppet/modules/stdlib/lib/facter/facter_dot_d.rb | 202 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- puppet/modules/stdlib/lib/facter/pe_version.rb | 53 ----------------------------------------------------- puppet/modules/stdlib/lib/facter/puppet_vardir.rb | 26 -------------------------- puppet/modules/stdlib/lib/facter/root_home.rb | 19 ------------------- puppet/modules/stdlib/lib/facter/util/puppet_settings.rb | 21 --------------------- puppet/modules/stdlib/lib/puppet/parser/functions/abs.rb | 36 ------------------------------------ puppet/modules/stdlib/lib/puppet/parser/functions/any2array.rb | 33 --------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/bool2num.rb | 49 ------------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/capitalize.rb | 34 ---------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/chomp.rb | 35 ----------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/chop.rb | 37 ------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/concat.rb | 37 ------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/count.rb | 22 ---------------------- puppet/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb | 35 ----------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/delete.rb | 46 ---------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/delete_at.rb | 49 ------------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/dirname.rb | 15 --------------- puppet/modules/stdlib/lib/puppet/parser/functions/downcase.rb | 33 --------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/empty.rb | 28 ---------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb | 24 ------------------------ puppet/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb | 45 --------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/flatten.rb | 33 --------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/floor.rb | 20 -------------------- puppet/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb | 46 ---------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb | 17 ----------------- puppet/modules/stdlib/lib/puppet/parser/functions/getparam.rb | 35 ----------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/getvar.rb | 26 -------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/grep.rb | 33 --------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb | 52 ---------------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb | 25 ------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb | 25 ------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/has_key.rb | 28 ---------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/hash.rb | 41 ----------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/is_array.rb | 22 ---------------------- puppet/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb | 47 ----------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/is_float.rb | 27 --------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb | 23 ----------------------- puppet/modules/stdlib/lib/puppet/parser/functions/is_hash.rb | 22 ---------------------- puppet/modules/stdlib/lib/puppet/parser/functions/is_integer.rb | 27 --------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb | 32 -------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb | 27 --------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb | 27 --------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/is_string.rb | 26 -------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/join.rb | 41 ----------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb | 47 ----------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/keys.rb | 26 -------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb | 20 -------------------- puppet/modules/stdlib/lib/puppet/parser/functions/lstrip.rb | 33 --------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/max.rb | 21 --------------------- puppet/modules/stdlib/lib/puppet/parser/functions/member.rb | 44 -------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/merge.rb | 33 --------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/min.rb | 21 --------------------- puppet/modules/stdlib/lib/puppet/parser/functions/num2bool.rb | 43 ------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/parsejson.rb | 24 ------------------------ puppet/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb | 24 ------------------------ puppet/modules/stdlib/lib/puppet/parser/functions/pick.rb | 29 ----------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/prefix.rb | 45 --------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/range.rb | 80 -------------------------------------------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/reject.rb | 31 ------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/reverse.rb | 28 ---------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/rstrip.rb | 32 -------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/shuffle.rb | 46 ---------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/size.rb | 48 ------------------------------------------------ puppet/modules/stdlib/lib/puppet/parser/functions/sort.rb | 27 --------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/squeeze.rb | 36 ------------------------------------ puppet/modules/stdlib/lib/puppet/parser/functions/str2bool.rb | 46 ---------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb | 32 -------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/strftime.rb | 107 ----------------------------------------------------------------------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/strip.rb | 39 --------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/suffix.rb | 45 --------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/swapcase.rb | 39 --------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/time.rb | 49 ------------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb | 28 ---------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/type.rb | 50 -------------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/unique.rb | 51 --------------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/upcase.rb | 41 ----------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/uriescape.rb | 36 ------------------------------------ puppet/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb | 56 -------------------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/validate_array.rb | 33 --------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb | 81 --------------------------------------------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb | 34 ---------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb | 47 ----------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb | 33 --------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/validate_re.rb | 40 ---------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb | 52 ---------------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/validate_string.rb | 33 --------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/values.rb | 39 --------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/values_at.rb | 98 -------------------------------------------------------------------------------------------------- puppet/modules/stdlib/lib/puppet/parser/functions/zip.rb | 65 ----------------------------------------------------------------- puppet/modules/stdlib/lib/puppet/provider/file_line/ruby.rb | 59 ----------------------------------------------------------- puppet/modules/stdlib/lib/puppet/type/anchor.rb | 46 ---------------------------------------------- puppet/modules/stdlib/lib/puppet/type/file_line.rb | 70 ---------------------------------------------------------------------- puppet/modules/stdlib/manifests/init.pp | 20 -------------------- puppet/modules/stdlib/manifests/stages.pp | 43 ------------------------------------------- puppet/modules/stdlib/metadata.json | 270 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ puppet/modules/stdlib/spec/classes/anchor_spec.rb | 32 -------------------------------- puppet/modules/stdlib/spec/fixtures/manifests/site.pp | 0 puppet/modules/stdlib/spec/functions/defined_with_params_spec.rb | 37 ------------------------------------- puppet/modules/stdlib/spec/functions/ensure_packages_spec.rb | 42 ------------------------------------------ puppet/modules/stdlib/spec/functions/ensure_resource_spec.rb | 64 ---------------------------------------------------------------- puppet/modules/stdlib/spec/functions/getparam_spec.rb | 34 ---------------------------------- puppet/modules/stdlib/spec/monkey_patches/alias_should_to_must.rb | 8 -------- puppet/modules/stdlib/spec/monkey_patches/publicize_methods.rb | 10 ---------- puppet/modules/stdlib/spec/spec.opts | 6 ------ puppet/modules/stdlib/spec/spec_helper.rb | 28 ---------------------------- puppet/modules/stdlib/spec/unit/facter/pe_required_facts_spec.rb | 69 --------------------------------------------------------------------- puppet/modules/stdlib/spec/unit/facter/pe_version_spec.rb | 76 ---------------------------------------------------------------------------- puppet/modules/stdlib/spec/unit/facter/root_home_spec.rb | 40 ---------------------------------------- puppet/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb | 35 ----------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/abs_spec.rb | 25 ------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/any2array_spec.rb | 55 ------------------------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/bool2num_spec.rb | 24 ------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/capitalize_spec.rb | 19 ------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/chomp_spec.rb | 19 ------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/chop_spec.rb | 19 ------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/concat_spec.rb | 15 --------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/count_spec.rb | 31 ------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/delete_at_spec.rb | 19 ------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/delete_spec.rb | 38 -------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/dirname_spec.rb | 24 ------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/downcase_spec.rb | 24 ------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/empty_spec.rb | 23 ----------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/flatten_spec.rb | 27 --------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/floor_spec.rb | 39 --------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb | 33 --------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/get_module_path_spec.rb | 46 ---------------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/getvar_spec.rb | 37 ------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/grep_spec.rb | 19 ------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_interface_with_spec.rb | 64 ---------------------------------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_address_spec.rb | 39 --------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_network_spec.rb | 36 ------------------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_key_spec.rb | 42 ------------------------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/hash_spec.rb | 19 ------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_array_spec.rb | 29 ----------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_domain_name_spec.rb | 64 ---------------------------------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_float_spec.rb | 33 --------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_function_available.rb | 31 ------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_hash_spec.rb | 29 ----------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb | 34 ---------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_ip_address_spec.rb | 39 --------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_mac_address_spec.rb | 29 ----------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_numeric_spec.rb | 39 --------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_string_spec.rb | 34 ---------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb | 40 ---------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/join_spec.rb | 19 ------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/keys_spec.rb | 21 --------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/lstrip_spec.rb | 19 ------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/max_spec.rb | 27 --------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/member_spec.rb | 24 ------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/merge_spec.rb | 47 ----------------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/min_spec.rb | 27 --------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/num2bool_spec.rb | 67 ------------------------------------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/parsejson_spec.rb | 22 ---------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/parseyaml_spec.rb | 24 ------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/pick_spec.rb | 34 ---------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/prefix_spec.rb | 19 ------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/range_spec.rb | 34 ---------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/reject_spec.rb | 20 -------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/reverse_spec.rb | 19 ------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/rstrip_spec.rb | 24 ------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/shuffle_spec.rb | 24 ------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/size_spec.rb | 24 ------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/sort_spec.rb | 24 ------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/squeeze_spec.rb | 24 ------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb | 31 ------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb | 45 --------------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/strftime_spec.rb | 29 ----------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/strip_spec.rb | 18 ------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/suffix_spec.rb | 19 ------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/swapcase_spec.rb | 19 ------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/time_spec.rb | 29 ----------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/to_bytes_spec.rb | 58 ---------------------------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/type_spec.rb | 43 ------------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/unique_spec.rb | 24 ------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/upcase_spec.rb | 24 ------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/uriescape_spec.rb | 24 ------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb | 83 ----------------------------------------------------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_array_spec.rb | 38 -------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_augeas_spec.rb | 102 ------------------------------------------------------------------------------------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_bool_spec.rb | 51 --------------------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_cmd_spec.rb | 81 --------------------------------------------------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_hash_spec.rb | 43 ------------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_re_spec.rb | 76 ---------------------------------------------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_slength_spec.rb | 48 ------------------------------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_string_spec.rb | 60 ------------------------------------------------------------ puppet/modules/stdlib/spec/unit/puppet/parser/functions/values_at_spec.rb | 38 -------------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/values_spec.rb | 31 ------------------------------- puppet/modules/stdlib/spec/unit/puppet/parser/functions/zip_spec.rb | 15 --------------- puppet/modules/stdlib/spec/unit/puppet/provider/file_line/ruby_spec.rb | 127 ------------------------------------------------------------------------------------------------------------------------------- puppet/modules/stdlib/spec/unit/puppet/type/anchor_spec.rb | 11 ----------- puppet/modules/stdlib/spec/unit/puppet/type/file_line_spec.rb | 69 --------------------------------------------------------------------- puppet/modules/stdlib/spec/watchr.rb | 86 -------------------------------------------------------------------------------------- puppet/modules/stdlib/tests/file_line.pp | 9 --------- puppet/modules/stdlib/tests/has_interface_with.pp | 10 ---------- puppet/modules/stdlib/tests/has_ip_address.pp | 3 --- puppet/modules/stdlib/tests/has_ip_network.pp | 4 ---- puppet/modules/stdlib/tests/init.pp | 1 - puppet/modules/supervisor/Modulefile | 9 --------- puppet/modules/supervisor/README.md | 27 --------------------------- puppet/modules/supervisor/files/debian-isnok-initscript | 217 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- puppet/modules/supervisor/files/supervisord.conf | 139 ------------------------------------------------------------------------------------------------------------------------------------------- puppet/modules/supervisor/files/ubuntu-initscript | 170 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- puppet/modules/supervisor/manifests/app.pp | 34 ---------------------------------- puppet/modules/supervisor/manifests/init.pp | 45 --------------------------------------------- puppet/modules/supervisor/templates/supervisor.conf.erb | 16 ---------------- puppet/modules/supervisor/tests/init.pp | 7 ------- puppet/modules/timezone/.gitignore | 2 -- puppet/modules/timezone/LICENSE | 202 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- puppet/modules/timezone/Modulefile | 9 --------- puppet/modules/timezone/README.md | 26 -------------------------- puppet/modules/timezone/manifests/init.pp | 82 ---------------------------------------------------------------------------------- puppet/modules/timezone/manifests/params.pp | 12 ------------ puppet/modules/timezone/spec/spec.opts | 6 ------ puppet/modules/timezone/spec/spec_helper.rb | 18 ------------------ puppet/modules/timezone/tests/init.pp | 1 - puppet/modules/vim/README.md | 2 -- puppet/modules/vim/files/vimrc.local | 0 puppet/modules/vim/manifests/init.pp | 23 ----------------------- puppet/modules/vim/test/init.pp | 0 326 files changed, 0 insertions(+), 14031 deletions(-) delete mode 100644 puppet/modules/apt/.bundle/config delete mode 100644 puppet/modules/apt/.fixtures.yml delete mode 100644 puppet/modules/apt/.forge-release/pom.xml delete mode 100644 puppet/modules/apt/.forge-release/publish delete mode 100644 puppet/modules/apt/.forge-release/settings.xml delete mode 100644 puppet/modules/apt/.forge-release/validate delete mode 100644 puppet/modules/apt/.nodeset.yml delete mode 100644 puppet/modules/apt/.travis.yml delete mode 100644 puppet/modules/apt/CHANGELOG delete mode 100644 puppet/modules/apt/Gemfile delete mode 100644 puppet/modules/apt/Gemfile.lock delete mode 100644 puppet/modules/apt/LICENSE delete mode 100644 puppet/modules/apt/Modulefile delete mode 100644 puppet/modules/apt/README.md delete mode 100644 puppet/modules/apt/Rakefile delete mode 100644 puppet/modules/apt/manifests/backports.pp delete mode 100644 puppet/modules/apt/manifests/builddep.pp delete mode 100644 puppet/modules/apt/manifests/conf.pp delete mode 100644 puppet/modules/apt/manifests/debian/testing.pp delete mode 100644 puppet/modules/apt/manifests/debian/unstable.pp delete mode 100644 puppet/modules/apt/manifests/force.pp delete mode 100644 puppet/modules/apt/manifests/init.pp delete mode 100644 puppet/modules/apt/manifests/key.pp delete mode 100644 puppet/modules/apt/manifests/params.pp delete mode 100644 puppet/modules/apt/manifests/pin.pp delete mode 100644 puppet/modules/apt/manifests/ppa.pp delete mode 100644 puppet/modules/apt/manifests/release.pp delete mode 100644 puppet/modules/apt/manifests/source.pp delete mode 100644 puppet/modules/apt/manifests/unattended_upgrades.pp delete mode 100644 puppet/modules/apt/manifests/update.pp delete mode 100644 puppet/modules/apt/metadata.json delete mode 100644 puppet/modules/apt/spec/classes/apt_spec.rb delete mode 100644 puppet/modules/apt/spec/classes/backports_spec.rb delete mode 100644 puppet/modules/apt/spec/classes/debian_testing_spec.rb delete mode 100644 puppet/modules/apt/spec/classes/debian_unstable_spec.rb delete mode 100644 puppet/modules/apt/spec/classes/params_spec.rb delete mode 100644 puppet/modules/apt/spec/classes/release_spec.rb delete mode 100644 puppet/modules/apt/spec/classes/unattended_upgrades_spec.rb delete mode 100644 puppet/modules/apt/spec/defines/builddep_spec.rb delete mode 100644 puppet/modules/apt/spec/defines/conf_spec.rb delete mode 100644 puppet/modules/apt/spec/defines/force_spec.rb delete mode 100644 puppet/modules/apt/spec/defines/key_spec.rb delete mode 100644 puppet/modules/apt/spec/defines/pin_spec.rb delete mode 100644 puppet/modules/apt/spec/defines/ppa_spec.rb delete mode 100644 puppet/modules/apt/spec/defines/source_spec.rb delete mode 100644 puppet/modules/apt/spec/spec_helper.rb delete mode 100644 puppet/modules/apt/spec/spec_helper_system.rb delete mode 100644 puppet/modules/apt/spec/system/apt_builddep_spec.rb delete mode 100644 puppet/modules/apt/spec/system/apt_key_spec.rb delete mode 100644 puppet/modules/apt/spec/system/apt_ppa_spec.rb delete mode 100644 puppet/modules/apt/spec/system/apt_source_spec.rb delete mode 100644 puppet/modules/apt/spec/system/basic_spec.rb delete mode 100644 puppet/modules/apt/spec/system/class_spec.rb delete mode 100644 puppet/modules/apt/templates/10periodic.erb delete mode 100644 puppet/modules/apt/templates/50unattended-upgrades.erb delete mode 100644 puppet/modules/apt/templates/pin.pref.erb delete mode 100644 puppet/modules/apt/templates/source.list.erb delete mode 100644 puppet/modules/apt/tests/builddep.pp delete mode 100644 puppet/modules/apt/tests/debian/testing.pp delete mode 100644 puppet/modules/apt/tests/debian/unstable.pp delete mode 100644 puppet/modules/apt/tests/force.pp delete mode 100644 puppet/modules/apt/tests/init.pp delete mode 100644 puppet/modules/apt/tests/key.pp delete mode 100644 puppet/modules/apt/tests/params.pp delete mode 100644 puppet/modules/apt/tests/pin.pp delete mode 100644 puppet/modules/apt/tests/ppa.pp delete mode 100644 puppet/modules/apt/tests/release.pp delete mode 100644 puppet/modules/apt/tests/source.pp delete mode 100644 puppet/modules/apt/tests/unattended-upgrades.pp delete mode 100644 puppet/modules/locale/README.md delete mode 100644 puppet/modules/locale/TODO delete mode 100644 puppet/modules/locale/manifests/init.pp delete mode 100644 puppet/modules/locale/test/init.pp delete mode 100644 puppet/modules/nginx/LICENSE delete mode 100644 puppet/modules/nginx/Modulefile delete mode 100644 puppet/modules/nginx/README delete mode 100644 puppet/modules/nginx/manifests/config.pp delete mode 100644 puppet/modules/nginx/manifests/fcgi.pp delete mode 100644 puppet/modules/nginx/manifests/fcgi/site.pp delete mode 100644 puppet/modules/nginx/manifests/init.pp delete mode 100644 puppet/modules/nginx/manifests/install_site.pp delete mode 100644 puppet/modules/nginx/manifests/site.pp delete mode 100644 puppet/modules/nginx/manifests/site_include.pp delete mode 100644 puppet/modules/nginx/templates/fcgi_site.erb delete mode 100644 puppet/modules/nginx/templates/includes/fastcgi_params.erb delete mode 100644 puppet/modules/nginx/templates/nginx.conf.erb delete mode 100644 puppet/modules/ntp/.gitignore delete mode 100644 puppet/modules/ntp/README.md delete mode 100644 puppet/modules/ntp/manifests/init.pp delete mode 100644 puppet/modules/ntp/tests/init.pp delete mode 100644 puppet/modules/postfix/README.md delete mode 100644 puppet/modules/postfix/manifests/init.pp delete mode 100644 puppet/modules/postfix/templates/postfix.preseed.erb delete mode 100644 puppet/modules/postfix/tests/init.pp delete mode 100644 puppet/modules/ps1/README.md delete mode 100644 puppet/modules/ps1/manifests/init.pp delete mode 100644 puppet/modules/ps1/test/init.pp delete mode 100644 puppet/modules/stdlib/CHANGELOG delete mode 100644 puppet/modules/stdlib/CONTRIBUTING.md delete mode 100644 puppet/modules/stdlib/Gemfile delete mode 100644 puppet/modules/stdlib/LICENSE delete mode 100644 puppet/modules/stdlib/Modulefile delete mode 100644 puppet/modules/stdlib/README.markdown delete mode 100644 puppet/modules/stdlib/README_DEVELOPER.markdown delete mode 100644 puppet/modules/stdlib/README_SPECS.markdown delete mode 100644 puppet/modules/stdlib/RELEASE_PROCESS.markdown delete mode 100644 puppet/modules/stdlib/Rakefile delete mode 100644 puppet/modules/stdlib/lib/facter/facter_dot_d.rb delete mode 100644 puppet/modules/stdlib/lib/facter/pe_version.rb delete mode 100644 puppet/modules/stdlib/lib/facter/puppet_vardir.rb delete mode 100644 puppet/modules/stdlib/lib/facter/root_home.rb delete mode 100644 puppet/modules/stdlib/lib/facter/util/puppet_settings.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/abs.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/any2array.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/bool2num.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/capitalize.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/chomp.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/chop.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/concat.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/count.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/delete.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/delete_at.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/dirname.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/downcase.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/empty.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/flatten.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/floor.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/getparam.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/getvar.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/grep.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/has_key.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/hash.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/is_array.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/is_float.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/is_hash.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/is_integer.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/is_string.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/join.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/keys.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/lstrip.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/max.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/member.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/merge.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/min.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/num2bool.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/parsejson.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/pick.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/prefix.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/range.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/reject.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/reverse.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/rstrip.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/shuffle.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/size.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/sort.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/squeeze.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/str2bool.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/strftime.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/strip.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/suffix.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/swapcase.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/time.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/type.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/unique.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/upcase.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/uriescape.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/validate_array.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/validate_re.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/validate_string.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/values.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/values_at.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/parser/functions/zip.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/provider/file_line/ruby.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/type/anchor.rb delete mode 100644 puppet/modules/stdlib/lib/puppet/type/file_line.rb delete mode 100644 puppet/modules/stdlib/manifests/init.pp delete mode 100644 puppet/modules/stdlib/manifests/stages.pp delete mode 100644 puppet/modules/stdlib/metadata.json delete mode 100644 puppet/modules/stdlib/spec/classes/anchor_spec.rb delete mode 100644 puppet/modules/stdlib/spec/fixtures/manifests/site.pp delete mode 100644 puppet/modules/stdlib/spec/functions/defined_with_params_spec.rb delete mode 100644 puppet/modules/stdlib/spec/functions/ensure_packages_spec.rb delete mode 100644 puppet/modules/stdlib/spec/functions/ensure_resource_spec.rb delete mode 100644 puppet/modules/stdlib/spec/functions/getparam_spec.rb delete mode 100755 puppet/modules/stdlib/spec/monkey_patches/alias_should_to_must.rb delete mode 100755 puppet/modules/stdlib/spec/monkey_patches/publicize_methods.rb delete mode 100644 puppet/modules/stdlib/spec/spec.opts delete mode 100644 puppet/modules/stdlib/spec/spec_helper.rb delete mode 100644 puppet/modules/stdlib/spec/unit/facter/pe_required_facts_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/facter/pe_version_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/facter/root_home_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/abs_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/any2array_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/bool2num_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/capitalize_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/chomp_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/chop_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/concat_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/count_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/delete_at_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/delete_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/dirname_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/downcase_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/empty_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/flatten_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/floor_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/get_module_path_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/getvar_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/grep_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_interface_with_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_address_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_network_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_key_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/hash_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_array_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_domain_name_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_float_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_function_available.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_hash_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_ip_address_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_mac_address_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_numeric_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_string_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/join_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/keys_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/lstrip_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/max_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/member_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/merge_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/min_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/num2bool_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/parsejson_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/parseyaml_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/pick_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/prefix_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/range_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/reject_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/reverse_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/rstrip_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/shuffle_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/size_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/sort_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/squeeze_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/strftime_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/strip_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/suffix_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/swapcase_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/time_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/to_bytes_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/type_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/unique_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/upcase_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/uriescape_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_array_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_augeas_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_bool_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_cmd_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_hash_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_re_spec.rb delete mode 100755 puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_slength_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_string_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/values_at_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/values_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/parser/functions/zip_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/provider/file_line/ruby_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/type/anchor_spec.rb delete mode 100644 puppet/modules/stdlib/spec/unit/puppet/type/file_line_spec.rb delete mode 100644 puppet/modules/stdlib/spec/watchr.rb delete mode 100644 puppet/modules/stdlib/tests/file_line.pp delete mode 100644 puppet/modules/stdlib/tests/has_interface_with.pp delete mode 100644 puppet/modules/stdlib/tests/has_ip_address.pp delete mode 100644 puppet/modules/stdlib/tests/has_ip_network.pp delete mode 100644 puppet/modules/stdlib/tests/init.pp delete mode 100644 puppet/modules/supervisor/Modulefile delete mode 100644 puppet/modules/supervisor/README.md delete mode 100755 puppet/modules/supervisor/files/debian-isnok-initscript delete mode 100644 puppet/modules/supervisor/files/supervisord.conf delete mode 100755 puppet/modules/supervisor/files/ubuntu-initscript delete mode 100644 puppet/modules/supervisor/manifests/app.pp delete mode 100644 puppet/modules/supervisor/manifests/init.pp delete mode 100644 puppet/modules/supervisor/templates/supervisor.conf.erb delete mode 100644 puppet/modules/supervisor/tests/init.pp delete mode 100644 puppet/modules/timezone/.gitignore delete mode 100644 puppet/modules/timezone/LICENSE delete mode 100644 puppet/modules/timezone/Modulefile delete mode 100644 puppet/modules/timezone/README.md delete mode 100644 puppet/modules/timezone/manifests/init.pp delete mode 100644 puppet/modules/timezone/manifests/params.pp delete mode 100644 puppet/modules/timezone/spec/spec.opts delete mode 100644 puppet/modules/timezone/spec/spec_helper.rb delete mode 100644 puppet/modules/timezone/tests/init.pp delete mode 100644 puppet/modules/vim/README.md delete mode 100644 puppet/modules/vim/files/vimrc.local delete mode 100644 puppet/modules/vim/manifests/init.pp delete mode 100644 puppet/modules/vim/test/init.pp diff --git a/puppet/modules/apt/.bundle/config b/puppet/modules/apt/.bundle/config deleted file mode 100644 index 2ddd802..0000000 --- a/puppet/modules/apt/.bundle/config +++ /dev/null @@ -1,2 +0,0 @@ ---- -BUNDLE_WITHOUT: development diff --git a/puppet/modules/apt/.fixtures.yml b/puppet/modules/apt/.fixtures.yml deleted file mode 100644 index dbd5621..0000000 --- a/puppet/modules/apt/.fixtures.yml +++ /dev/null @@ -1,5 +0,0 @@ -fixtures: - repositories: - "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" - symlinks: - "apt": "#{source_dir}" diff --git a/puppet/modules/apt/.forge-release/pom.xml b/puppet/modules/apt/.forge-release/pom.xml deleted file mode 100644 index b788e86..0000000 --- a/puppet/modules/apt/.forge-release/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - 4.0.0 - puppetlabs - ghpublisher - 1.0.0 - puppet-module - ghpublisher - - - ${env.PUBLISHER_LOGIN} - ${env.PUBLISHER_PASSWORD} - - - - - - org.cloudsmith.geppetto - forge-maven-plugin - 3.2.0 - true - - false - ${project.build.directory}/forgeCache - - - - - diff --git a/puppet/modules/apt/.forge-release/publish b/puppet/modules/apt/.forge-release/publish deleted file mode 100644 index 7d8665f..0000000 --- a/puppet/modules/apt/.forge-release/publish +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# -# Perform GitHub publish -if [ -z "$PUBLISHER_LOGIN" ] -then - echo "Environment variable PUBLISHER_LOGIN must be set" - exit 1 -fi - -if [ -z "$PUBLISHER_PASSWORD" ] -then - echo "Environment variable PUBLISHER_PASSWORD must be set" - exit 1 -fi - -MODULES_ROOT=`pwd` -cd $(dirname $0) -mvn -q -s settings.xml -Dforge.modules.root="$MODULES_ROOT" deploy \ No newline at end of file diff --git a/puppet/modules/apt/.forge-release/settings.xml b/puppet/modules/apt/.forge-release/settings.xml deleted file mode 100644 index 3ec7de2..0000000 --- a/puppet/modules/apt/.forge-release/settings.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - cloudsmith - - - cloudsmith - https://am0.cloudsmith.com/nexus/content/repositories/releases/ - - true - - - false - - - - - - cloudsmith - https://am0.cloudsmith.com/nexus/content/repositories/releases/ - - true - - - false - - - - - - - cloudsmith - - diff --git a/puppet/modules/apt/.forge-release/validate b/puppet/modules/apt/.forge-release/validate deleted file mode 100644 index 190ed33..0000000 --- a/puppet/modules/apt/.forge-release/validate +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# -# Perform GitHub publish -MODULES_ROOT=`pwd` -cd $(dirname $0) -mvn -q -s settings.xml -Dforge.modules.root="$MODULES_ROOT" compile \ No newline at end of file diff --git a/puppet/modules/apt/.nodeset.yml b/puppet/modules/apt/.nodeset.yml deleted file mode 100644 index ad056fe..0000000 --- a/puppet/modules/apt/.nodeset.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -default_set: 'ubuntu-server-12042-x64' -sets: - 'debian-607-x64': - nodes: - "main.foo.vm": - prefab: 'debian-607-x64' - 'debian-70rc1-x64': - nodes: - "main.foo.vm": - prefab: 'debian-70rc1-x64' - 'ubuntu-server-10044-x64': - nodes: - "main.foo.vm": - prefab: 'ubuntu-server-10044-x64' - 'ubuntu-server-12042-x64': - nodes: - "main.foo.vm": - prefab: 'ubuntu-server-12042-x64' diff --git a/puppet/modules/apt/.travis.yml b/puppet/modules/apt/.travis.yml deleted file mode 100644 index 00924ba..0000000 --- a/puppet/modules/apt/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ ---- -branches: - only: - - master -language: ruby -bundler_args: --without development -script: bundle exec rake spec SPEC_OPTS='--format documentation' -after_success: - - git clone -q git://github.com/puppetlabs/ghpublisher.git .forge-release - - .forge-release/publish -rvm: - - 1.8.7 - - 1.9.3 - - 2.0.0 -env: - matrix: - - PUPPET_GEM_VERSION="~> 2.7.0" - - PUPPET_GEM_VERSION="~> 3.0.0" - - PUPPET_GEM_VERSION="~> 3.1.0" - - PUPPET_GEM_VERSION="~> 3.2.0" - global: - - PUBLISHER_LOGIN=puppetlabs - - secure: |- - ipB/CV1rVSTXU9ZDuzrFOlzJrRmJob36tKns2xszuH4r9s5P9qivNAngRGdV - msb69xvOlzQykM0WRF+4kJ6TZ7AbMiDI+VZ8GDtsRaU5/q3BpsvFe8aato+6 - QeyFtBG62OsosTEhGws4mqiFsPDu3dHlakuJc9zevlTuhNwbKSs= -matrix: - exclude: - - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 2.7.0" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 2.7.0" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.0.0" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.1.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 3.2.0" -notifications: - email: false diff --git a/puppet/modules/apt/CHANGELOG b/puppet/modules/apt/CHANGELOG deleted file mode 100644 index 0d321bc..0000000 --- a/puppet/modules/apt/CHANGELOG +++ /dev/null @@ -1,183 +0,0 @@ -2013-10-08 1.4.0 - -Summary: - -Minor bugfix and allow the timeout to be adjusted. - -Features: -- Add an `updates_timeout` to apt::params - -Fixes: -- Ensure apt::ppa can readd a ppa removed by hand. - -Summary - -1.3.0 -===== - -Summary: - -This major feature in this release is the new apt::unattended_upgrades class, -allowing you to handle Ubuntu's unattended feature. This allows you to select -specific packages to automatically upgrade without any further user -involvement. - -In addition we extend our Wheezy support, add proxy support to apt:ppa and do -various cleanups and tweaks. - -Features: -- Add apt::unattended_upgrades support for Ubuntu. -- Add wheezy backports support. -- Use the geoDNS http.debian.net instead of the main debian ftp server. -- Add `options` parameter to apt::ppa in order to pass options to apt-add-repository command. -- Add proxy support for apt::ppa (uses proxy_host and proxy_port from apt). - -Bugfixes: -- Fix regsubst() calls to quote single letters (for future parser). -- Fix lint warnings and other misc cleanup. - -1.2.0 -===== - -Features: -- Add geppetto `.project` natures -- Add GH auto-release -- Add `apt::key::key_options` parameter -- Add complex pin support using distribution properties for `apt::pin` via new properties: - - `apt::pin::codename` - - `apt::pin::release_version` - - `apt::pin::component` - - `apt::pin::originator` - - `apt::pin::label` -- Add source architecture support to `apt::source::architecture` - -Bugfixes: -- Use apt-get instead of aptitude in apt::force -- Update default backports location -- Add dependency for required packages before apt-get update - - -1.1.1 -===== - -This is a bug fix release that resolves a number of issues: - -* By changing template variable usage, we remove the deprecation warnings - for Puppet 3.2.x -* Fixed proxy file removal, when proxy absent - -Some documentation, style and whitespaces changes were also merged. This -release also introduced proper rspec-puppet unit testing on Travis-CI to help -reduce regression. - -Thanks to all the community contributors below that made this patch possible. - -#### Detail Changes - -* fix minor comment type (Chris Rutter) -* whitespace fixes (Michael Moll) -* Update travis config file (William Van Hevelingen) -* Build all branches on travis (William Van Hevelingen) -* Standardize travis.yml on pattern introduced in stdlib (William Van Hevelingen) -* Updated content to conform to README best practices template (Lauren Rother) -* Fix apt::release example in readme (Brian Galey) -* add @ to variables in template (Peter Hoeg) -* Remove deprecation warnings for pin.pref.erb as well (Ken Barber) -* Update travis.yml to latest versions of puppet (Ken Barber) -* Fix proxy file removal (Scott Barber) -* Add spec test for removing proxy configuration (Dean Reilly) -* Fix apt::key listing longer than 8 chars (Benjamin Knofe) - - ---------------------------------------- - -1.1.0 -===== - -This release includes Ubuntu 12.10 (Quantal) support for PPAs. - ---------------------------------------- - -2012-05-25 Puppet Labs - 0.0.4 - * Fix ppa list filename when there is a period in the PPA name - * Add .pref extension to apt preferences files - * Allow preferences to be purged - * Extend pin support - -2012-05-04 Puppet Labs - 0.0.3 - * only invoke apt-get update once - * only install python-software-properties if a ppa is added - * support 'ensure => absent' for all defined types - * add apt::conf - * add apt::backports - * fixed Modulefile for module tool dependency resolution - * configure proxy before doing apt-get update - * use apt-get update instead of aptitude for apt::ppa - * add support to pin release - - -2012-03-26 Puppet Labs - 0.0.2 -41cedbb (#13261) Add real examples to smoke tests. -d159a78 (#13261) Add key.pp smoke test -7116c7a (#13261) Replace foo source with puppetlabs source -1ead0bf Ignore pkg directory. -9c13872 (#13289) Fix some more style violations -0ea4ffa (#13289) Change test scaffolding to use a module & manifest dir fixture path -a758247 (#13289) Clean up style violations and fix corresponding tests -99c3fd3 (#13289) Add puppet lint tests to Rakefile -5148cbf (#13125) Apt keys should be case insensitive -b9607a4 Convert apt::key to use anchors - -2012-03-07 Puppet Labs - 0.0.1 -d4fec56 Modify apt::source release parameter test -1132a07 (#12917) Add contributors to README -8cdaf85 (#12823) Add apt::key defined type and modify apt::source to use it -7c0d10b (#12809) $release should use $lsbdistcodename and fall back to manual input -be2cc3e (#12522) Adjust spec test for splitting purge -7dc60ae (#12522) Split purge option to spare sources.list -9059c4e Fix source specs to test all key permutations -8acb202 Add test for python-software-properties package -a4af11f Check if python-software-properties is defined before attempting to define it. -1dcbf3d Add tests for required_packages change -f3735d2 Allow duplicate $required_packages -74c8371 (#12430) Add tests for changes to apt module -97ebb2d Test two sources with the same key -1160bcd (#12526) Add ability to reverse apt { disable_keys => true } -2842d73 Add Modulefile to puppet-apt -c657742 Allow the use of the same key in multiple sources -8c27963 (#12522) Adding purge option to apt class -997c9fd (#12529) Add unit test for apt proxy settings -50f3cca (#12529) Add parameter to support setting a proxy for apt -d522877 (#12094) Replace chained .with_* with a hash -8cf1bd0 (#12094) Remove deprecated spec.opts file -2d688f4 (#12094) Add rspec-puppet tests for apt -0fb5f78 (#12094) Replace name with path in file resources -f759bc0 (#11953) Apt::force passes $version to aptitude -f71db53 (#11413) Add spec test for apt::force to verify changes to unless -2f5d317 (#11413) Update dpkg query used by apt::force -cf6caa1 (#10451) Add test coverage to apt::ppa -0dd697d include_src parameter in example; Whitespace cleanup -b662eb8 fix typos in "repositories" -1be7457 Fix (#10451) - apt::ppa fails to "apt-get update" when new PPA source is added -864302a Set the pin priority before adding the source (Fix #10449) -1de4e0a Refactored as per mlitteken -1af9a13 Added some crazy bash madness to check if the ppa is installed already. Otherwise the manifest tries to add it on every run! -52ca73e (#8720) Replace Apt::Ppa with Apt::Builddep -5c05fa0 added builddep command. -a11af50 added the ability to specify the content of a key -c42db0f Fixes ppa test. -77d2b0d reformatted whitespace to match recommended style of 2 space indentation. -27ebdfc ignore swap files. -377d58a added smoke tests for module. -18f614b reformatted apt::ppa according to recommended style. -d8a1e4e Created a params class to hold global data. -636ae85 Added two params for apt class -148fc73 Update LICENSE. -ed2d19e Support ability to add more than one PPA -420d537 Add call to apt-update after add-apt-repository in apt::ppa -945be77 Add package definition for python-software-properties -71fc425 Abs paths for all commands -9d51cd1 Adding LICENSE -71796e3 Heading fix in README -87777d8 Typo in README -f848bac First commit diff --git a/puppet/modules/apt/Gemfile b/puppet/modules/apt/Gemfile deleted file mode 100644 index 15bd29d..0000000 --- a/puppet/modules/apt/Gemfile +++ /dev/null @@ -1,16 +0,0 @@ -source 'https://rubygems.org' - -group :development, :test do - gem 'rake', :require => false - gem 'rspec-puppet', :require => false - gem 'puppetlabs_spec_helper', :require => false - gem 'rspec-system', :require => false - gem 'rspec-system-puppet', :require => false - gem 'rspec-system-serverspec', :require => false -end - -if puppetversion = ENV['PUPPET_GEM_VERSION'] - gem 'puppet', puppetversion, :require => false -else - gem 'puppet', :require => false -end diff --git a/puppet/modules/apt/Gemfile.lock b/puppet/modules/apt/Gemfile.lock deleted file mode 100644 index 9932e16..0000000 --- a/puppet/modules/apt/Gemfile.lock +++ /dev/null @@ -1,70 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - builder (3.2.2) - diff-lcs (1.2.4) - facter (1.6.18) - hiera (1.0.0) - highline (1.6.19) - kwalify (0.7.2) - metaclass (0.0.1) - mocha (0.14.0) - metaclass (~> 0.0.1) - net-scp (1.1.2) - net-ssh (>= 2.6.5) - net-ssh (2.7.0) - nokogiri (1.5.10) - puppet (3.0.2) - facter (~> 1.6.11) - hiera (~> 1.0.0) - puppetlabs_spec_helper (0.4.1) - mocha (>= 0.10.5) - rake - rspec (>= 2.9.0) - rspec-puppet (>= 0.1.1) - rake (10.1.0) - rbvmomi (1.6.0) - builder - nokogiri (>= 1.4.1) - trollop - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.5) - rspec-expectations (2.14.3) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.3) - rspec-puppet (0.1.6) - rspec - rspec-system (2.3.0) - kwalify (~> 0.7.2) - net-scp (~> 1.1) - net-ssh (~> 2.6) - nokogiri (~> 1.5.9) - rbvmomi (~> 1.6) - rspec (~> 2.13) - systemu (~> 2.5) - rspec-system-puppet (2.2.0) - rspec-system (~> 2.0) - rspec-system-serverspec (1.0.1) - rspec-system (~> 2.0) - serverspec (~> 0.0) - serverspec (0.10.5) - highline - net-ssh - rspec (>= 2.13.0) - systemu (2.5.2) - trollop (2.0) - -PLATFORMS - ruby - -DEPENDENCIES - puppet (~> 3.0.0) - puppetlabs_spec_helper - rake - rspec-puppet - rspec-system - rspec-system-puppet - rspec-system-serverspec diff --git a/puppet/modules/apt/LICENSE b/puppet/modules/apt/LICENSE deleted file mode 100644 index 638c347..0000000 --- a/puppet/modules/apt/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Evolving Web Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/puppet/modules/apt/Modulefile b/puppet/modules/apt/Modulefile deleted file mode 100644 index 72aa142..0000000 --- a/puppet/modules/apt/Modulefile +++ /dev/null @@ -1,14 +0,0 @@ -name 'puppetlabs-apt' -version '1.4.0' -source 'https://github.com/puppetlabs/puppetlabs-apt' -author 'Evolving Web / Puppet Labs' -license 'Apache License 2.0' -summary 'Puppet Labs Apt Module' -description 'APT Module for Puppet' -project_page 'https://github.com/puppetlabs/puppetlabs-apt' - -## Add dependencies, if any: -#dependency 'puppetlabs/stdlib', '2.x' -# The dependency should be written as above but librarian-puppet -# does not support the expression as the PMT does. -dependency 'puppetlabs/stdlib', '>= 2.2.1' diff --git a/puppet/modules/apt/README.md b/puppet/modules/apt/README.md deleted file mode 100644 index 2ce5340..0000000 --- a/puppet/modules/apt/README.md +++ /dev/null @@ -1,226 +0,0 @@ -apt -=== - -[![Build Status](https://travis-ci.org/puppetlabs/puppetlabs-apt.png?branch=master)](https://travis-ci.org/puppetlabs/puppetlabs-apt) - -## Description -Provides helpful definitions for dealing with Apt. -======= -Overview --------- - -The APT module provides a simple interface for managing APT source, key, and definitions with Puppet. - -Module Description ------------------- - -APT automates obtaining and installing software packages on *nix systems. - -Setup ------ - -**What APT affects:** - -* package/service/configuration files for APT -* your system's `sources.list` file and `sources.list.d` directory - * NOTE: Setting the `purge_sources_list` and `purge_sources_list_d` parameters to 'true' will destroy any existing content that was not declared with Puppet. The default for these parameters is 'false'. -* system repositories -* authentication keys -* wget (optional) - -###Beginning with APT - -To begin using the APT module with default parameters, declare the class - - class { 'apt': } - -Puppet code that uses anything from the APT module requires that the core apt class be declared. - -Usage ------ - -Using the APT module consists predominantly in declaring classes that provide desired functionality and features. - -###apt - -`apt` provides a number of common resources and options that are shared by the various defined types in this module, so you MUST always include this class in your manifests. - -The parameters for `apt` are not required in general and are predominantly for development environment use-cases. - - class { 'apt': - always_apt_update => false, - disable_keys => undef, - proxy_host => false, - proxy_port => '8080', - purge_sources_list => false, - purge_sources_list_d => false, - purge_preferences_d => false, - update_timeout => undef - } - -Puppet will manage your system's `sources.list` file and `sources.list.d` directory but will do its best to respect existing content. - -If you declare your apt class with `purge_sources_list` and `purge_sources_list_d` set to 'true', Puppet will unapologetically purge any existing content it finds that wasn't declared with Puppet. - -###apt::builddep - -Installs the build depends of a specified package. - - apt::builddep { 'glusterfs-server': } - -###apt::force - -Forces a package to be installed from a specific release. This class is particularly useful when using repositories, like Debian, that are unstable in Ubuntu. - - apt::force { 'glusterfs-server': - release => 'unstable', - version => '3.0.3', - require => Apt::Source['debian_unstable'], - } - -###apt::key - -Adds a key to the list of keys used by APT to authenticate packages. - - apt::key { 'puppetlabs': - key => '4BD6EC30', - key_server => 'pgp.mit.edu', - } - - apt::key { 'jenkins': - key => 'D50582E6', - key_source => 'http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key', - } - -Note that use of `key_source` requires wget to be installed and working. - -###apt::pin - -Adds an apt pin for a certain release. - - apt::pin { 'karmic': priority => 700 } - apt::pin { 'karmic-updates': priority => 700 } - apt::pin { 'karmic-security': priority => 700 } - -Note you can also specifying more complex pins using distribution properties. - - apt::pin { 'stable': - priority => -10, - originator => 'Debian', - release_version => '3.0', - component => 'main', - label => 'Debian' - } - -###apt::ppa - -Adds a ppa repository using `add-apt-repository`. - - apt::ppa { 'ppa:drizzle-developers/ppa': } - -###apt::release - -Sets the default apt release. This class is particularly useful when using repositories, like Debian, that are unstable in Ubuntu. - - class { 'apt::release': - release_id => 'precise', - } - -###apt::source - -Adds an apt source to `/etc/apt/sources.list.d/`. - - apt::source { 'debian_unstable': - location => 'http://debian.mirror.iweb.ca/debian/', - release => 'unstable', - repos => 'main contrib non-free', - required_packages => 'debian-keyring debian-archive-keyring', - key => '55BE302B', - key_server => 'subkeys.pgp.net', - pin => '-10', - include_src => true - } - -If you would like to configure your system so the source is the Puppet Labs APT repository - - apt::source { 'puppetlabs': - location => 'http://apt.puppetlabs.com', - repos => 'main', - key => '4BD6EC30', - key_server => 'pgp.mit.edu', - } - -###Testing - -The APT module is mostly a collection of defined resource types, which provide reusable logic that can be leveraged to manage APT. It does provide smoke tests for testing functionality on a target system, as well as spec tests for checking a compiled catalog against an expected set of resources. - -####Example Test - -This test will set up a Puppet Labs apt repository. Start by creating a new smoke test in the apt module's test folder. Call it puppetlabs-apt.pp. Inside, declare a single resource representing the Puppet Labs APT source and gpg key - - apt::source { 'puppetlabs': - location => 'http://apt.puppetlabs.com', - repos => 'main', - key => '4BD6EC30', - key_server => 'pgp.mit.edu', - } - -This resource creates an apt source named puppetlabs and gives Puppet information about the repository's location and key used to sign its packages. Puppet leverages Facter to determine the appropriate release, but you can set it directly by adding the release type. - -Check your smoke test for syntax errors - - $ puppet parser validate tests/puppetlabs-apt.pp - -If you receive no output from that command, it means nothing is wrong. Then apply the code - - $ puppet apply --verbose tests/puppetlabs-apt.pp - notice: /Stage[main]//Apt::Source[puppetlabs]/File[puppetlabs.list]/ensure: defined content as '{md5}3be1da4923fb910f1102a233b77e982e' - info: /Stage[main]//Apt::Source[puppetlabs]/File[puppetlabs.list]: Scheduling refresh of Exec[puppetlabs apt update] - notice: /Stage[main]//Apt::Source[puppetlabs]/Exec[puppetlabs apt update]: Triggered 'refresh' from 1 events> - -The above example used a smoke test to easily lay out a resource declaration and apply it on your system. In production, you may want to declare your APT sources inside the classes where they’re needed. - -Implementation --------------- - -###apt::backports - -Adds the necessary components to get backports for Ubuntu and Debian. The release name defaults to `$lsbdistcodename`. Setting this manually can cause undefined behavior (read: universe exploding). - -Limitations ------------ - -This module should work across all versions of Debian/Ubuntu and support all major APT repository management features. - -Development ------------- - -Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve. - -We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. - -You can read the complete module contribution guide [on the Puppet Labs wiki.](http://projects.puppetlabs.com/projects/module-site/wiki/Module_contributing) - -Contributors ------------- - -A lot of great people have contributed to this module. A somewhat current list follows: - -* Ben Godfrey -* Branan Purvine-Riley -* Christian G. Warden -* Dan Bode -* Garrett Honeycutt -* Jeff Wallace -* Ken Barber -* Matthaus Litteken -* Matthias Pigulla -* Monty Taylor -* Peter Drake -* Reid Vandewiele -* Robert Navarro -* Ryan Coleman -* Scott McLeod -* Spencer Krum -* William Van Hevelingen -* Zach Leslie diff --git a/puppet/modules/apt/Rakefile b/puppet/modules/apt/Rakefile deleted file mode 100644 index bb60173..0000000 --- a/puppet/modules/apt/Rakefile +++ /dev/null @@ -1,2 +0,0 @@ -require 'puppetlabs_spec_helper/rake_tasks' -require 'rspec-system/rake_task' diff --git a/puppet/modules/apt/manifests/backports.pp b/puppet/modules/apt/manifests/backports.pp deleted file mode 100644 index e9180c4..0000000 --- a/puppet/modules/apt/manifests/backports.pp +++ /dev/null @@ -1,48 +0,0 @@ -# This adds the necessary components to get backports for ubuntu and debian -# -# == Parameters -# -# [*release*] -# The ubuntu/debian release name. Defaults to $lsbdistcodename. Setting this -# manually can cause undefined behavior. (Read: universe exploding) -# -# == Examples -# -# include apt::backports -# -# class { 'apt::backports': -# release => 'natty', -# } -# -# == Authors -# -# Ben Hughes, I think. At least blame him if this goes wrong. -# I just added puppet doc. -# -# == Copyright -# -# Copyright 2011 Puppet Labs Inc, unless otherwise noted. -class apt::backports( - $release = $::lsbdistcodename, - $location = $apt::params::backports_location -) inherits apt::params { - - $release_real = downcase($release) - $key = $::lsbdistid ? { - 'debian' => '55BE302B', - 'ubuntu' => '437D05B5', - } - $repos = $::lsbdistid ? { - 'debian' => 'main contrib non-free', - 'ubuntu' => 'main universe multiverse restricted', - } - - apt::source { 'backports': - location => $location, - release => "${release_real}-backports", - repos => $repos, - key => $key, - key_server => 'pgp.mit.edu', - pin => '200', - } -} diff --git a/puppet/modules/apt/manifests/builddep.pp b/puppet/modules/apt/manifests/builddep.pp deleted file mode 100644 index 3294f71..0000000 --- a/puppet/modules/apt/manifests/builddep.pp +++ /dev/null @@ -1,16 +0,0 @@ -# builddep.pp - -define apt::builddep() { - include apt::update - - exec { "apt-builddep-${name}": - command => "/usr/bin/apt-get -y --force-yes build-dep ${name}", - logoutput => 'on_failure', - notify => Exec['apt_update'], - } - - # Need anchor to provide containment for dependencies. - anchor { "apt::builddep::${name}": - require => Class['apt::update'], - } -} diff --git a/puppet/modules/apt/manifests/conf.pp b/puppet/modules/apt/manifests/conf.pp deleted file mode 100644 index 3c4cb19..0000000 --- a/puppet/modules/apt/manifests/conf.pp +++ /dev/null @@ -1,18 +0,0 @@ -define apt::conf ( - $content, - $ensure = present, - $priority = '50' -) { - - include apt::params - - $apt_conf_d = $apt::params::apt_conf_d - - file { "${apt_conf_d}/${priority}${name}": - ensure => $ensure, - content => $content, - owner => root, - group => root, - mode => '0644', - } -} diff --git a/puppet/modules/apt/manifests/debian/testing.pp b/puppet/modules/apt/manifests/debian/testing.pp deleted file mode 100644 index 4513347..0000000 --- a/puppet/modules/apt/manifests/debian/testing.pp +++ /dev/null @@ -1,21 +0,0 @@ -# testing.pp - -class apt::debian::testing { - include apt - - # deb http://debian.mirror.iweb.ca/debian/ testing main contrib non-free - # deb-src http://debian.mirror.iweb.ca/debian/ testing main contrib non-free - # Key: 55BE302B Server: subkeys.pgp.net - # debian-keyring - # debian-archive-keyring - - apt::source { 'debian_testing': - location => 'http://debian.mirror.iweb.ca/debian/', - release => 'testing', - repos => 'main contrib non-free', - required_packages => 'debian-keyring debian-archive-keyring', - key => '55BE302B', - key_server => 'subkeys.pgp.net', - pin => '-10', - } -} diff --git a/puppet/modules/apt/manifests/debian/unstable.pp b/puppet/modules/apt/manifests/debian/unstable.pp deleted file mode 100644 index 401c9c5..0000000 --- a/puppet/modules/apt/manifests/debian/unstable.pp +++ /dev/null @@ -1,21 +0,0 @@ -# unstable.pp - -class apt::debian::unstable { - include apt - - # deb http://debian.mirror.iweb.ca/debian/ unstable main contrib non-free - # deb-src http://debian.mirror.iweb.ca/debian/ unstable main contrib non-free - # Key: 55BE302B Server: subkeys.pgp.net - # debian-keyring - # debian-archive-keyring - - apt::source { 'debian_unstable': - location => 'http://debian.mirror.iweb.ca/debian/', - release => 'unstable', - repos => 'main contrib non-free', - required_packages => 'debian-keyring debian-archive-keyring', - key => '55BE302B', - key_server => 'subkeys.pgp.net', - pin => '-10', - } -} diff --git a/puppet/modules/apt/manifests/force.pp b/puppet/modules/apt/manifests/force.pp deleted file mode 100644 index 2d33e94..0000000 --- a/puppet/modules/apt/manifests/force.pp +++ /dev/null @@ -1,24 +0,0 @@ -# force.pp -# force a package from a specific release - -define apt::force( - $release = 'testing', - $version = false, - $timeout = 300 -) { - - $version_string = $version ? { - false => undef, - default => "=${version}", - } - - $install_check = $version ? { - false => "/usr/bin/dpkg -s ${name} | grep -q 'Status: install'", - default => "/usr/bin/dpkg -s ${name} | grep -q 'Version: ${version}'", - } - exec { "/usr/bin/apt-get -y -t ${release} install ${name}${version_string}": - unless => $install_check, - logoutput => 'on_failure', - timeout => $timeout, - } -} diff --git a/puppet/modules/apt/manifests/init.pp b/puppet/modules/apt/manifests/init.pp deleted file mode 100644 index b106ad4..0000000 --- a/puppet/modules/apt/manifests/init.pp +++ /dev/null @@ -1,121 +0,0 @@ -# Class: apt -# -# This module manages the initial configuration of apt. -# -# Parameters: -# The parameters listed here are not required in general and were -# added for use cases related to development environments. -# disable_keys - disables the requirement for all packages to be signed -# always_apt_update - rather apt should be updated on every run (intended -# for development environments where package updates are frequent) -# purge_sources_list - Accepts true or false. Defaults to false If set to -# true, Puppet will purge all unmanaged entries from sources.list -# purge_sources_list_d - Accepts true or false. Defaults to false. If set -# to true, Puppet will purge all unmanaged entries from sources.list.d -# update_timeout - Overrides the exec timeout in seconds for apt-get update. -# If not set defaults to Exec's default (300) -# -# Actions: -# -# Requires: -# puppetlabs/stdlib -# Sample Usage: -# class { 'apt': } - -class apt( - $always_apt_update = false, - $disable_keys = undef, - $proxy_host = false, - $proxy_port = '8080', - $purge_sources_list = false, - $purge_sources_list_d = false, - $purge_preferences_d = false, - $update_timeout = undef -) { - - include apt::params - include apt::update - - validate_bool($purge_sources_list, $purge_sources_list_d, $purge_preferences_d) - - $sources_list_content = $purge_sources_list ? { - false => undef, - true => "# Repos managed by puppet.\n", - } - - if $always_apt_update == true { - Exec <| title=='apt_update' |> { - refreshonly => false, - } - } - - $root = $apt::params::root - $apt_conf_d = $apt::params::apt_conf_d - $sources_list_d = $apt::params::sources_list_d - $preferences_d = $apt::params::preferences_d - $provider = $apt::params::provider - - file { 'sources.list': - ensure => present, - path => "${root}/sources.list", - owner => root, - group => root, - mode => '0644', - content => $sources_list_content, - notify => Exec['apt_update'], - } - - file { 'sources.list.d': - ensure => directory, - path => $sources_list_d, - owner => root, - group => root, - purge => $purge_sources_list_d, - recurse => $purge_sources_list_d, - notify => Exec['apt_update'], - } - - file { 'preferences.d': - ensure => directory, - path => $preferences_d, - owner => root, - group => root, - purge => $purge_preferences_d, - recurse => $purge_preferences_d, - } - - case $disable_keys { - true: { - file { '99unauth': - ensure => present, - content => "APT::Get::AllowUnauthenticated 1;\n", - path => "${apt_conf_d}/99unauth", - } - } - false: { - file { '99unauth': - ensure => absent, - path => "${apt_conf_d}/99unauth", - } - } - undef: { } # do nothing - default: { fail('Valid values for disable_keys are true or false') } - } - - $proxy_set = $proxy_host ? { - false => absent, - default => present - } - - file { 'configure-apt-proxy': - ensure => $proxy_set, - path => "${apt_conf_d}/proxy", - content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";", - notify => Exec['apt_update'], - } - - # Need anchor to provide containment for dependencies. - anchor { 'apt::update': - require => Class['apt::update'], - } -} diff --git a/puppet/modules/apt/manifests/key.pp b/puppet/modules/apt/manifests/key.pp deleted file mode 100644 index c78bf65..0000000 --- a/puppet/modules/apt/manifests/key.pp +++ /dev/null @@ -1,90 +0,0 @@ -define apt::key ( - $key = $title, - $ensure = present, - $key_content = false, - $key_source = false, - $key_server = 'keyserver.ubuntu.com', - $key_options = false -) { - - include apt::params - - $upkey = upcase($key) - # trim the key to the last 8 chars so we can match longer keys with apt-key list too - $trimmedkey = regsubst($upkey, '^.*(.{8})$', '\1') - - if $key_content { - $method = 'content' - } elsif $key_source { - $method = 'source' - } elsif $key_server { - $method = 'server' - } - - # This is a hash of the parts of the key definition that we care about. - # It is used as a unique identifier for this instance of apt::key. It gets - # hashed to ensure that the resource name doesn't end up being pages and - # pages (e.g. in the situation where key_content is specified). - $digest = sha1("${upkey}/${key_content}/${key_source}/${key_server}/") - - # Allow multiple ensure => present for the same key to account for many - # apt::source resources that all reference the same key. - case $ensure { - present: { - - anchor { "apt::key/${title}": } - - if defined(Exec["apt::key ${upkey} absent"]) { - fail("Cannot ensure Apt::Key[${upkey}] present; ${upkey} already ensured absent") - } - - if !defined(Anchor["apt::key ${upkey} present"]) { - anchor { "apt::key ${upkey} present": } - } - - if $key_options{ - $options_string = "--keyserver-options ${key_options}" - } - else{ - $options_string = '' - } - - if !defined(Exec[$digest]) { - $digest_command = $method ? { - 'content' => "echo '${key_content}' | /usr/bin/apt-key add -", - 'source' => "wget -q '${key_source}' -O- | apt-key add -", - 'server' => "apt-key adv --keyserver '${key_server}' ${options_string} --recv-keys '${upkey}'", - } - exec { $digest: - command => $digest_command, - path => '/bin:/usr/bin', - unless => "/usr/bin/apt-key list | /bin/grep '${trimmedkey}'", - logoutput => 'on_failure', - before => Anchor["apt::key ${upkey} present"], - } - } - - Anchor["apt::key ${upkey} present"] -> Anchor["apt::key/${title}"] - - } - absent: { - - if defined(Anchor["apt::key ${upkey} present"]) { - fail("Cannot ensure Apt::Key[${upkey}] absent; ${upkey} already ensured present") - } - - exec { "apt::key ${upkey} absent": - command => "apt-key del '${upkey}'", - path => '/bin:/usr/bin', - onlyif => "apt-key list | grep '${trimmedkey}'", - user => 'root', - group => 'root', - logoutput => 'on_failure', - } - } - - default: { - fail "Invalid 'ensure' value '${ensure}' for aptkey" - } - } -} diff --git a/puppet/modules/apt/manifests/params.pp b/puppet/modules/apt/manifests/params.pp deleted file mode 100644 index 955954f..0000000 --- a/puppet/modules/apt/manifests/params.pp +++ /dev/null @@ -1,33 +0,0 @@ -class apt::params { - $root = '/etc/apt' - $provider = '/usr/bin/apt-get' - $sources_list_d = "${root}/sources.list.d" - $apt_conf_d = "${root}/apt.conf.d" - $preferences_d = "${root}/preferences.d" - - case $::lsbdistid { - 'debian': { - case $::lsbdistcodename { - 'squeeze': { - $backports_location = 'http://backports.debian.org/debian-backports' - } - 'wheezy': { - $backports_location = 'http://ftp.debian.org/debian/' - } - default: { - $backports_location = 'http://http.debian.net/debian/' - } - } - } - 'ubuntu': { - case $::lsbdistcodename { - 'hardy','lucid','maverick','natty','oneiric','precise': { - $backports_location = 'http://us.archive.ubuntu.com/ubuntu' - } - default: { - $backports_location = 'http://old-releases.ubuntu.com/ubuntu' - } - } - } - } -} diff --git a/puppet/modules/apt/manifests/pin.pp b/puppet/modules/apt/manifests/pin.pp deleted file mode 100644 index 402e79e..0000000 --- a/puppet/modules/apt/manifests/pin.pp +++ /dev/null @@ -1,73 +0,0 @@ -# pin.pp -# pin a release in apt, useful for unstable repositories - -define apt::pin( - $ensure = present, - $explanation = "${::caller_module_name}: ${name}", - $order = '', - $packages = '*', - $priority = 0, - $release = '', # a= - $origin = '', - $version = '', - $codename = '', # n= - $release_version = '', # v= - $component = '', # c= - $originator = '', # o= - $label = '' # l= -) { - - include apt::params - - $preferences_d = $apt::params::preferences_d - - if $order != '' and !is_integer($order) { - fail('Only integers are allowed in the apt::pin order param') - } - - $pin_release_array = [ - $release, - $codename, - $release_version, - $component, - $originator, - $label] - $pin_release = join($pin_release_array, '') - - # Read the manpage 'apt_preferences(5)', especially the chapter - # 'Thea Effect of APT Preferences' to understand the following logic - # and the difference between specific and general form - if $packages != '*' { # specific form - - if ( $pin_release != '' and ( $origin != '' or $version != '' )) or - ( $origin != '' and ( $pin_release != '' or $version != '' )) or - ( $version != '' and ( $pin_release != '' or $origin != '' )) { - fail('parameters release, origin, and version are mutually exclusive') - } - - } else { # general form - - if $version != '' { - fail('parameter version cannot be used in general form') - } - - if ( $pin_release != '' and $origin != '' ) or - ( $origin != '' and $pin_release != '' ) { - fail('parmeters release and origin are mutually exclusive') - } - - } - - $path = $order ? { - '' => "${preferences_d}/${name}.pref", - default => "${preferences_d}/${order}-${name}.pref", - } - file { "${name}.pref": - ensure => $ensure, - path => $path, - owner => root, - group => root, - mode => '0644', - content => template('apt/pin.pref.erb'), - } -} diff --git a/puppet/modules/apt/manifests/ppa.pp b/puppet/modules/apt/manifests/ppa.pp deleted file mode 100644 index 7cb88c8..0000000 --- a/puppet/modules/apt/manifests/ppa.pp +++ /dev/null @@ -1,63 +0,0 @@ -# ppa.pp - -define apt::ppa( - $release = $::lsbdistcodename, - $options = '-y' -) { - include apt::params - include apt::update - - $sources_list_d = $apt::params::sources_list_d - - if ! $release { - fail('lsbdistcodename fact not available: release parameter required') - } - - $filename_without_slashes = regsubst($name, '/', '-', 'G') - $filename_without_dots = regsubst($filename_without_slashes, '\.', '_', 'G') - $filename_without_ppa = regsubst($filename_without_dots, '^ppa:', '', 'G') - $sources_list_d_filename = "${filename_without_ppa}-${release}.list" - - $package = $::lsbdistrelease ? { - /^[1-9]\..*|1[01]\..*|12.04$/ => 'python-software-properties', - default => 'software-properties-common', - } - - if ! defined(Package[$package]) { - package { $package: } - } - - if defined(Class[apt]) { - $proxy_host = getparam(Class[apt], 'proxy_host') - $proxy_port = getparam(Class[apt], 'proxy_port') - case $proxy_host { - false, '': { - $proxy_env = [] - } - default: {$proxy_env = ["http_proxy=http://${proxy_host}:${proxy_port}", "https_proxy=http://${proxy_host}:${proxy_port}"]} - } - } else { - $proxy_env = [] - } - exec { "add-apt-repository-${name}": - environment => $proxy_env, - command => "/usr/bin/add-apt-repository ${options} ${name}", - unless => "/usr/bin/test -s ${sources_list_d}/${sources_list_d_filename}", - logoutput => 'on_failure', - notify => Exec['apt_update'], - require => [ - File[$sources_list_d], - Package[$package], - ], - } - - file { "${sources_list_d}/${sources_list_d_filename}": - ensure => file, - require => Exec["add-apt-repository-${name}"], - } - - # Need anchor to provide containment for dependencies. - anchor { "apt::ppa::${name}": - require => Class['apt::update'], - } -} diff --git a/puppet/modules/apt/manifests/release.pp b/puppet/modules/apt/manifests/release.pp deleted file mode 100644 index 6e0a38f..0000000 --- a/puppet/modules/apt/manifests/release.pp +++ /dev/null @@ -1,17 +0,0 @@ -# release.pp - -class apt::release ( - $release_id -) { - - include apt::params - - $root = $apt::params::root - - file { "${root}/apt.conf.d/01release": - owner => root, - group => root, - mode => '0644', - content => "APT::Default-Release \"${release_id}\";" - } -} diff --git a/puppet/modules/apt/manifests/source.pp b/puppet/modules/apt/manifests/source.pp deleted file mode 100644 index 713c7e9..0000000 --- a/puppet/modules/apt/manifests/source.pp +++ /dev/null @@ -1,85 +0,0 @@ -# source.pp -# add an apt source - -define apt::source( - $ensure = present, - $location = '', - $release = 'UNDEF', - $repos = 'main', - $include_src = true, - $required_packages = false, - $key = false, - $key_server = 'keyserver.ubuntu.com', - $key_content = false, - $key_source = false, - $pin = false, - $architecture = undef -) { - - include apt::params - include apt::update - - $sources_list_d = $apt::params::sources_list_d - $provider = $apt::params::provider - - if $release == 'UNDEF' { - if $::lsbdistcodename == undef { - fail('lsbdistcodename fact not available: release parameter required') - } else { - $release_real = $::lsbdistcodename - } - } else { - $release_real = $release - } - - file { "${name}.list": - ensure => $ensure, - path => "${sources_list_d}/${name}.list", - owner => root, - group => root, - mode => '0644', - content => template("${module_name}/source.list.erb"), - notify => Exec['apt_update'], - } - - - if ($pin != false) { - # Get the host portion out of the url so we can pin to origin - $url_split = split($location, '/') - $host = $url_split[2] - - apt::pin { $name: - ensure => $ensure, - priority => $pin, - before => File["${name}.list"], - origin => $host, - } - } - - if ($required_packages != false) and ($ensure == 'present') { - exec { "Required packages: '${required_packages}' for ${name}": - command => "${provider} -y install ${required_packages}", - logoutput => 'on_failure', - refreshonly => true, - subscribe => File["${name}.list"], - before => Exec['apt_update'], - } - } - - # We do not want to remove keys when the source is absent. - if ($key != false) and ($ensure == 'present') { - apt::key { "Add key: ${key} from Apt::Source ${title}": - ensure => present, - key => $key, - key_server => $key_server, - key_content => $key_content, - key_source => $key_source, - before => File["${name}.list"], - } - } - - # Need anchor to provide containment for dependencies. - anchor { "apt::source::${name}": - require => Class['apt::update'], - } -} diff --git a/puppet/modules/apt/manifests/unattended_upgrades.pp b/puppet/modules/apt/manifests/unattended_upgrades.pp deleted file mode 100644 index f006bd5..0000000 --- a/puppet/modules/apt/manifests/unattended_upgrades.pp +++ /dev/null @@ -1,68 +0,0 @@ -# Class: apt::unattended_upgrades -# -# This class manages the unattended-upgrades package and related configuration -# files for ubuntu -# -# origins are the repositories to automatically upgrade included packages -# blacklist is a list of packages to not automatically upgrade -# update is how often to run "apt-get update" in days -# download is how often to run "apt-get upgrade --download-only" in days -# upgrade is how often to upgrade packages included in the origins list in days -# autoclean is how often to run "apt-get autoclean" in days -# -# information on the other options can be found in the 50unattended-upgrades -# file and in /etc/cron.daily/apt -# -class apt::unattended_upgrades ( - $origins = ['${distro_id}:${distro_codename}-security'], - $blacklist = [], - $update = "1", - $download = "1", - $upgrade = "1", - $autoclean = "7", - $auto_fix = true, - $minimal_steps = false, - $install_on_shutdown = false, - $mail_to = "NONE", - $mail_only_on_error = false, - $remove_unused = true, - $auto_reboot = false, - $dl_limit = "NONE", - $enable = "1", - $backup_interval = "0", - $backup_level = "3", - $max_age = "0", - $min_age = "0", - $max_size = "0", - $download_delta = "0", - $verbose = "0", -) { - - validate_bool( - $auto_fix, - $minimal_steps, - $install_on_shutdown, - $mail_only_on_error, - $remove_unused, - $auto_reboot - ) - - package { 'unattended-upgrades': - ensure => present, - } - - File { - ensure => file, - owner => 'root', - group => 'root', - mode => '0644', - require => Package['unattended-upgrades'], - } - - file { - '/etc/apt/apt.conf.d/50unattended-upgrades': - content => template('apt/50unattended-upgrades.erb'); - '/etc/apt/apt.conf.d/10periodic': - content => template('apt/10periodic.erb'); - } -} diff --git a/puppet/modules/apt/manifests/update.pp b/puppet/modules/apt/manifests/update.pp deleted file mode 100644 index ce0b78f..0000000 --- a/puppet/modules/apt/manifests/update.pp +++ /dev/null @@ -1,10 +0,0 @@ -class apt::update { - include apt::params - - exec { 'apt_update': - command => "${apt::params::provider} update", - logoutput => 'on_failure', - refreshonly => true, - timeout => $apt::update_timeout, - } -} diff --git a/puppet/modules/apt/metadata.json b/puppet/modules/apt/metadata.json deleted file mode 100644 index 3e4c992..0000000 --- a/puppet/modules/apt/metadata.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "name": "puppetlabs-apt", - "version": "1.4.0", - "summary": "Puppet Labs Apt Module", - "author": "Evolving Web / Puppet Labs", - "description": "APT Module for Puppet", - "dependencies": [ - { - "name": "puppetlabs/stdlib", - "version_requirement": "\u003e\u003d 2.2.1" - } - ], - "types": [], - "checksums": { - ".bundle/config": "7f1c988748783d2a8d455376eed1470c", - ".fixtures.yml": "0c43f56b0bb8e8d04e8051a0e7aa37a5", - ".forge-release/pom.xml": "c650a84961ad88de03192e23b63b3549", - ".forge-release/publish": "1c1d6dd64ef52246db485eb5459aa941", - ".forge-release/settings.xml": "06d768a57d582fe1ee078b563427e750", - ".forge-release/validate": "7fffde8112f42a1ec986d49ba80ac219", - ".nodeset.yml": "78d78c172336a387a1067464434ffbcb", - ".travis.yml": "782420dcc9d6412c79c30f03b1f3613c", - "CHANGELOG": "f5488e1e891a8f8c47143dac790ddab3", - "Gemfile": "1bfa7eb6e30346c9ddb4a8b144b0d255", - "Gemfile.lock": "8ff8bc3d32bb7412bd97e48190a93b2f", - "LICENSE": "20bcc606fc61ffba2b8cea840e8dce4d", - "Modulefile": "b34e93626fbc137cbb651952e7509839", - "README.md": "65176b395f7202fe5d222ae7b0de4e05", - "Rakefile": "0428ea3759a4692c91604396c406a9c1", - "manifests/backports.pp": "09f1d86603d0f44a2169acb3eeea2a70", - "manifests/builddep.pp": "4f313b5140c84aa7d5793b5a073c30dd", - "manifests/conf.pp": "5ddf258195d414d93284dfd281a8d6e3", - "manifests/debian/testing.pp": "aeb625bacb6a8df46c864ee9ee1cb5a5", - "manifests/debian/unstable.pp": "108038596b05dc1d28975884693f73f5", - "manifests/force.pp": "cf871e869f4114f32ab164de2a67e7e2", - "manifests/init.pp": "5ec106a7a03313c544159a9a1f6b78e6", - "manifests/key.pp": "3cf082ed91a3933ab7218d1be3464f4f", - "manifests/params.pp": "ca4ce3730a65c43f884ab3e6445f1661", - "manifests/pin.pp": "dea8cbaabc37010ce25838080608802b", - "manifests/ppa.pp": "754a83944ae79b5001fc0c0a8c775985", - "manifests/release.pp": "427f3ee70a6a1e55fa291e58655bd5d9", - "manifests/source.pp": "6eab8d33c173a066f5dec8474efdedb6", - "manifests/unattended_upgrades.pp": "e97f908b42010ff9a85be4afd2c721ab", - "manifests/update.pp": "436c79f160f2cb603710795a9ec71ac7", - "spec/classes/apt_spec.rb": "54841b04b42026770ed6d744a82c55df", - "spec/classes/backports_spec.rb": "7d2454a881cc26edd3dcd3acb7ffd20f", - "spec/classes/debian_testing_spec.rb": "fad1384cb9d3c99b2663d7df4762dc0e", - "spec/classes/debian_unstable_spec.rb": "11131efffd18db3c96e2bbe3d98a2fb7", - "spec/classes/params_spec.rb": "a25396d3f0bbac784a7951f03ad7e8f4", - "spec/classes/release_spec.rb": "d8f01a3cf0c2f6f6952b835196163ce4", - "spec/classes/unattended_upgrades_spec.rb": "a2e206bda79d24cdb43312d035eff66f", - "spec/defines/builddep_spec.rb": "e1300bb4f3abbd34029b11d8b733a6e5", - "spec/defines/conf_spec.rb": "b7fc9fb6cb270c276aacbfa4a43f228c", - "spec/defines/force_spec.rb": "97098c5b123be49e321e71cda288fe53", - "spec/defines/key_spec.rb": "7800c30647b1ddf799b991110109cba0", - "spec/defines/pin_spec.rb": "c912e59e9e3d1145280d659cccabe72b", - "spec/defines/ppa_spec.rb": "72ce037a1d6ea0a33f369b1f3d98b3d6", - "spec/defines/source_spec.rb": "e553bb9598dbe2becba6ae7f91d4deb0", - "spec/spec_helper.rb": "0db89c9a486df193c0e40095422e19dc", - "spec/spec_helper_system.rb": "e67d2574baae312f1095f90d78fdf5e9", - "spec/system/apt_builddep_spec.rb": "97be5a48d2d16d96cb7c35ccdbcdcb69", - "spec/system/apt_key_spec.rb": "098835d0c53c69390d4c3b6ea8ef3815", - "spec/system/apt_ppa_spec.rb": "c96f6d0bbdafac39beaf0d5e6eba9010", - "spec/system/apt_source_spec.rb": "df5aa98b03688884903c564bb507469f", - "spec/system/basic_spec.rb": "0a5b33d18254bedcb7886e34846ebff6", - "spec/system/class_spec.rb": "2ba4265236f00685c23cb00f908defc1", - "templates/10periodic.erb": "2aeea866a39f19a62254abbb4f1bc59d", - "templates/50unattended-upgrades.erb": "ae995ade214fdaefab51d335c85819ae", - "templates/pin.pref.erb": "623249839cee7788fa0805a3474396db", - "templates/source.list.erb": "65a016e60daf065c481f3d5f2c883324", - "tests/builddep.pp": "4773f57072111e58f2ed833fa4489a88", - "tests/debian/testing.pp": "1cbee56baddd6a91d981db8fddec70fb", - "tests/debian/unstable.pp": "4b2a090afeb315752262386f4dbcd8ca", - "tests/force.pp": "2bb6cf0b3d655cb51f95aeb79035e600", - "tests/init.pp": "551138eb704e71ab3687932dda429a81", - "tests/key.pp": "371a695e1332d51a38e283a87be52798", - "tests/params.pp": "900db40f3fc84b0be173278df2ebff35", - "tests/pin.pp": "4b4c3612d75a19dba8eb7227070fa4ab", - "tests/ppa.pp": "b902cce8159128b5e8b21bed540743ff", - "tests/release.pp": "53ce5debe6fa5bee42821767599cc768", - "tests/source.pp": "9cecd9aa0dcde250fe49be9e26971a98", - "tests/unattended-upgrades.pp": "cdc853f1b58e5206c5a538621ddca161" - }, - "source": "https://github.com/puppetlabs/puppetlabs-apt", - "project_page": "https://github.com/puppetlabs/puppetlabs-apt", - "license": "Apache License 2.0" -} \ No newline at end of file diff --git a/puppet/modules/apt/spec/classes/apt_spec.rb b/puppet/modules/apt/spec/classes/apt_spec.rb deleted file mode 100644 index a66feac..0000000 --- a/puppet/modules/apt/spec/classes/apt_spec.rb +++ /dev/null @@ -1,133 +0,0 @@ -require 'spec_helper' -describe 'apt', :type => :class do - let :default_params do - { - :disable_keys => :undef, - :always_apt_update => false, - :purge_sources_list => false, - :purge_sources_list_d => false, - } - end - - [{}, - { - :disable_keys => true, - :always_apt_update => true, - :proxy_host => true, - :proxy_port => '3128', - :purge_sources_list => true, - :purge_sources_list_d => true, - }, - { - :disable_keys => false - } - ].each do |param_set| - describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do - let :param_hash do - default_params.merge(param_set) - end - - let :params do - param_set - end - - let :refresh_only_apt_update do - if param_hash[:always_apt_update] - false - else - true - end - end - - it { should include_class("apt::params") } - - it { - if param_hash[:purge_sources_list] - should contain_file("sources.list").with({ - 'path' => "/etc/apt/sources.list", - 'ensure' => "present", - 'owner' => "root", - 'group' => "root", - 'mode' => "0644", - "content" => "# Repos managed by puppet.\n" - }) - else - should contain_file("sources.list").with({ - 'path' => "/etc/apt/sources.list", - 'ensure' => "present", - 'owner' => "root", - 'group' => "root", - 'mode' => "0644", - 'content' => nil - }) - end - } - it { - if param_hash[:purge_sources_list_d] - should create_file("sources.list.d").with({ - 'path' => "/etc/apt/sources.list.d", - 'ensure' => "directory", - 'owner' => "root", - 'group' => "root", - 'purge' => true, - 'recurse' => true, - 'notify' => 'Exec[apt_update]' - }) - else - should create_file("sources.list.d").with({ - 'path' => "/etc/apt/sources.list.d", - 'ensure' => "directory", - 'owner' => "root", - 'group' => "root", - 'purge' => false, - 'recurse' => false, - 'notify' => 'Exec[apt_update]' - }) - end - } - - it { - should contain_exec("apt_update").with({ - 'command' => "/usr/bin/apt-get update", - 'refreshonly' => refresh_only_apt_update - }) - } - - it { - if param_hash[:disable_keys] == true - should create_file("99unauth").with({ - 'content' => "APT::Get::AllowUnauthenticated 1;\n", - 'ensure' => "present", - 'path' => "/etc/apt/apt.conf.d/99unauth" - }) - elsif param_hash[:disable_keys] == false - should create_file("99unauth").with({ - 'ensure' => "absent", - 'path' => "/etc/apt/apt.conf.d/99unauth" - }) - elsif param_hash[:disable_keys] != :undef - should_not create_file("99unauth").with({ - 'path' => "/etc/apt/apt.conf.d/99unauth" - }) - end - } - describe 'when setting a proxy' do - it { - if param_hash[:proxy_host] - should contain_file('configure-apt-proxy').with( - 'path' => '/etc/apt/apt.conf.d/proxy', - 'content' => "Acquire::http::Proxy \"http://#{param_hash[:proxy_host]}:#{param_hash[:proxy_port]}\";", - 'notify' => "Exec[apt_update]" - ) - else - should contain_file('configure-apt-proxy').with( - 'path' => '/etc/apt/apt.conf.d/proxy', - 'notify' => 'Exec[apt_update]', - 'ensure' => 'absent' - ) - end - } - end - end - end -end diff --git a/puppet/modules/apt/spec/classes/backports_spec.rb b/puppet/modules/apt/spec/classes/backports_spec.rb deleted file mode 100644 index 27c6708..0000000 --- a/puppet/modules/apt/spec/classes/backports_spec.rb +++ /dev/null @@ -1,71 +0,0 @@ -require 'spec_helper' -describe 'apt::backports', :type => :class do - - describe 'when turning on backports for ubuntu karmic' do - - let :facts do - { - 'lsbdistcodename' => 'Karmic', - 'lsbdistid' => 'Ubuntu' - } - end - - it { should contain_apt__source('backports').with({ - 'location' => 'http://old-releases.ubuntu.com/ubuntu', - 'release' => 'karmic-backports', - 'repos' => 'main universe multiverse restricted', - 'key' => '437D05B5', - 'key_server' => 'pgp.mit.edu', - 'pin' => '200', - }) - } - end - - describe "when turning on backports for debian squeeze" do - - let :facts do - { - 'lsbdistcodename' => 'Squeeze', - 'lsbdistid' => 'Debian', - } - end - - it { should contain_apt__source('backports').with({ - 'location' => 'http://backports.debian.org/debian-backports', - 'release' => 'squeeze-backports', - 'repos' => 'main contrib non-free', - 'key' => '55BE302B', - 'key_server' => 'pgp.mit.edu', - 'pin' => '200', - }) - } - end - - describe "when turning on backports for debian squeeze but using your own mirror" do - - let :facts do - { - 'lsbdistcodename' => 'Squeeze', - 'lsbdistid' => 'Debian' - } - end - - let :location do - 'http://mirrors.example.com/debian-backports' - end - - let :params do - { 'location' => location } - end - - it { should contain_apt__source('backports').with({ - 'location' => location, - 'release' => 'squeeze-backports', - 'repos' => 'main contrib non-free', - 'key' => '55BE302B', - 'key_server' => 'pgp.mit.edu', - 'pin' => '200', - }) - } - end -end diff --git a/puppet/modules/apt/spec/classes/debian_testing_spec.rb b/puppet/modules/apt/spec/classes/debian_testing_spec.rb deleted file mode 100644 index 6006afb..0000000 --- a/puppet/modules/apt/spec/classes/debian_testing_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'spec_helper' -describe 'apt::debian::testing', :type => :class do - it { - should contain_apt__source("debian_testing").with({ - "location" => "http://debian.mirror.iweb.ca/debian/", - "release" => "testing", - "repos" => "main contrib non-free", - "required_packages" => "debian-keyring debian-archive-keyring", - "key" => "55BE302B", - "key_server" => "subkeys.pgp.net", - "pin" => "-10" - }) - } -end diff --git a/puppet/modules/apt/spec/classes/debian_unstable_spec.rb b/puppet/modules/apt/spec/classes/debian_unstable_spec.rb deleted file mode 100644 index 411182d..0000000 --- a/puppet/modules/apt/spec/classes/debian_unstable_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'spec_helper' -describe 'apt::debian::unstable', :type => :class do - it { - should contain_apt__source("debian_unstable").with({ - "location" => "http://debian.mirror.iweb.ca/debian/", - "release" => "unstable", - "repos" => "main contrib non-free", - "required_packages" => "debian-keyring debian-archive-keyring", - "key" => "55BE302B", - "key_server" => "subkeys.pgp.net", - "pin" => "-10" - }) - } -end diff --git a/puppet/modules/apt/spec/classes/params_spec.rb b/puppet/modules/apt/spec/classes/params_spec.rb deleted file mode 100644 index f2790b0..0000000 --- a/puppet/modules/apt/spec/classes/params_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'spec_helper' -describe 'apt::params', :type => :class do - let (:title) { 'my_package' } - - it { should contain_apt__params } - - # There are 4 resources in this class currently - # there should not be any more resources because it is a params class - # The resources are class[apt::params], class[main], class[settings], stage[main] - it "Should not contain any resources" do - subject.resources.size.should == 4 - end -end diff --git a/puppet/modules/apt/spec/classes/release_spec.rb b/puppet/modules/apt/spec/classes/release_spec.rb deleted file mode 100644 index d131b22..0000000 --- a/puppet/modules/apt/spec/classes/release_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'spec_helper' -describe 'apt::release', :type => :class do - let (:title) { 'my_package' } - - let :param_set do - { :release_id => 'precise' } - end - - let (:params) { param_set } - - it { should include_class("apt::params") } - - it { - should contain_file("/etc/apt/apt.conf.d/01release").with({ - "mode" => "0644", - "owner" => "root", - "group" => "root", - "content" => "APT::Default-Release \"#{param_set[:release_id]}\";" - }) - } -end - diff --git a/puppet/modules/apt/spec/classes/unattended_upgrades_spec.rb b/puppet/modules/apt/spec/classes/unattended_upgrades_spec.rb deleted file mode 100644 index 8abc603..0000000 --- a/puppet/modules/apt/spec/classes/unattended_upgrades_spec.rb +++ /dev/null @@ -1,204 +0,0 @@ -require 'spec_helper' -describe 'apt::unattended_upgrades', :type => :class do - let(:file_unattended) { '/etc/apt/apt.conf.d/50unattended-upgrades' } - let(:file_periodic) { '/etc/apt/apt.conf.d/10periodic' } - - it { should contain_package("unattended-upgrades") } - - it { - should create_file("/etc/apt/apt.conf.d/50unattended-upgrades").with({ - "owner" => "root", - "group" => "root", - "mode" => "0644", - "require" => "Package[unattended-upgrades]", - }) - } - - it { - should create_file("/etc/apt/apt.conf.d/10periodic").with({ - "owner" => "root", - "group" => "root", - "mode" => "0644", - "require" => "Package[unattended-upgrades]", - }) - } - - describe "origins" do - describe "with param defaults" do - let(:params) {{ }} - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Allowed-Origins \{\n\t"\${distro_id}:\${distro_codename}-security";\n\};$/) } - end - - describe "with origins => ['ubuntu:precise-security']" do - let :params do - { :origins => ['ubuntu:precise-security'] } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Allowed-Origins \{\n\t"ubuntu:precise-security";\n\};$/) } - end - end - - describe "blacklist" do - describe "with param defaults" do - let(:params) {{ }} - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Package-Blacklist \{\n\};$/) } - end - - describe "with blacklist => []" do - let :params do - { :blacklist => ['libc6', 'libc6-dev'] } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Package-Blacklist \{\n\t"libc6";\n\t"libc6-dev";\n\};$/) } - end - end - - describe "with update => 2" do - let :params do - { :update => "2" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::Update-Package-Lists "2";$/) } - end - - describe "with download => 2" do - let :params do - { :download => "2" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::Download-Upgradeable-Packages "2";$/) } - end - - describe "with upgrade => 2" do - let :params do - { :upgrade => "2" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::Unattended-Upgrade "2";$/) } - end - - describe "with autoclean => 2" do - let :params do - { :autoclean => "2" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::AutocleanInterval "2";$/) } - end - - describe "with auto_fix => false" do - let :params do - { :auto_fix => false } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::AutoFixInterruptedDpkg "false";$/) } - end - - describe "with minimal_steps => true" do - let :params do - { :minimal_steps => true } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::MinimalSteps "true";$/) } - end - - describe "with install_on_shutdown => true" do - let :params do - { :install_on_shutdown => true } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::InstallOnShutdown "true";$/) } - end - - describe "mail_to" do - describe "param defaults" do - let(:params) {{ }} - it { should_not contain_file(file_unattended).with_content(/^Unattended-Upgrade::Mail /) } - it { should_not contain_file(file_unattended).with_content(/^Unattended-Upgrade::MailOnlyOnError /) } - end - - describe "with mail_to => user@website, mail_only_on_error => true" do - let :params do - { :mail_to => "user@website", - :mail_only_on_error => true } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Mail "user@website";$/) } - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::MailOnlyOnError "true";$/) } - end - end - - describe "with remove_unused => false" do - let :params do - { :remove_unused => false } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Remove-Unused-Dependencies "false";$/) } - end - - describe "with auto_reboot => true" do - let :params do - { :auto_reboot => true } - end - it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Automatic-Reboot "true";$/) } - end - - describe "dl_limit" do - describe "param defaults" do - let(:params) {{ }} - it { should_not contain_file(file_unattended).with_content(/^Acquire::http::Dl-Limit /) } - end - - describe "with dl_limit => 70" do - let :params do - { :dl_limit => "70" } - end - it { should contain_file(file_unattended).with_content(/^Acquire::http::Dl-Limit "70";$/) } - end - end - - describe "with enable => 0" do - let :params do - { :enable => "0" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::Enable "0";$/) } - end - - describe "with backup_interval => 1" do - let :params do - { :backup_interval => "1" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::BackUpArchiveInterval "1";$/) } - end - - describe "with backup_level => 0" do - let :params do - { :backup_level => "0" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::BackUpLevel "0";$/) } - end - - describe "with max_age => 1" do - let :params do - { :max_age => "1" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::MaxAge "1";$/) } - end - - describe "with min_age => 1" do - let :params do - { :min_age => "1" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::MinAge "1";$/) } - end - - describe "with max_size => 1" do - let :params do - { :max_size => "1" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::MaxSize "1";$/) } - end - - describe "with download_delta => 2" do - let :params do - { :download_delta => "2" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::Download-Upgradeable-Packages-Debdelta "2";$/) } - end - - describe "with verbose => 2" do - let :params do - { :verbose => "2" } - end - it { should contain_file(file_periodic).with_content(/^APT::Periodic::Verbose "2";$/) } - end - -end diff --git a/puppet/modules/apt/spec/defines/builddep_spec.rb b/puppet/modules/apt/spec/defines/builddep_spec.rb deleted file mode 100644 index 4e2b698..0000000 --- a/puppet/modules/apt/spec/defines/builddep_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'spec_helper' -describe 'apt::builddep', :type => :define do - - let(:title) { 'my_package' } - - describe "should require apt-get update" do - it { should contain_exec("apt_update").with({ - 'command' => "/usr/bin/apt-get update", - 'refreshonly' => true - }) - } - it { should contain_anchor("apt::builddep::my_package").with({ - 'require' => 'Class[Apt::Update]', - }) - } - end - -end diff --git a/puppet/modules/apt/spec/defines/conf_spec.rb b/puppet/modules/apt/spec/defines/conf_spec.rb deleted file mode 100644 index 5a81b51..0000000 --- a/puppet/modules/apt/spec/defines/conf_spec.rb +++ /dev/null @@ -1,57 +0,0 @@ -require 'spec_helper' -describe 'apt::conf', :type => :define do - let :title do - 'norecommends' - end - - describe "when creating an apt preference" do - let :params do - { - :priority => '00', - :content => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n" - } - end - - let :filename do - "/etc/apt/apt.conf.d/00norecommends" - end - - it { should contain_apt__conf('norecommends').with({ - 'priority' => '00', - 'content' => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n" - }) - } - - it { should contain_file(filename).with({ - 'ensure' => 'present', - 'content' => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n", - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - }) - } - end - - describe "when removing an apt preference" do - let :params do - { - :ensure => 'absent', - :priority => '00', - :content => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n" - } - end - - let :filename do - "/etc/apt/apt.conf.d/00norecommends" - end - - it { should contain_file(filename).with({ - 'ensure' => 'absent', - 'content' => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n", - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - }) - } - end -end diff --git a/puppet/modules/apt/spec/defines/force_spec.rb b/puppet/modules/apt/spec/defines/force_spec.rb deleted file mode 100644 index f5d6ac2..0000000 --- a/puppet/modules/apt/spec/defines/force_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -require 'spec_helper' -describe 'apt::force', :type => :define do - let :title do - 'my_package' - end - - let :default_params do - { - :release => 'testing', - :version => false - } - end - - [{}, - { - :release => 'stable', - :version => '1' - } - ].each do |param_set| - describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do - let :param_hash do - default_params.merge(param_set) - end - - let :params do - param_set - end - - let :unless_query do - base_command = "/usr/bin/dpkg -s #{title} | grep -q " - base_command + (params[:version] ? "'Version: #{params[:version]}'" : "'Status: install'") - end - - let :exec_title do - base_exec = "/usr/bin/apt-get -y -t #{param_hash[:release]} install #{title}" - base_exec + (params[:version] ? "=#{params[:version]}" : "") - end - it { should contain_exec(exec_title).with_unless(unless_query) } - end - end -end diff --git a/puppet/modules/apt/spec/defines/key_spec.rb b/puppet/modules/apt/spec/defines/key_spec.rb deleted file mode 100644 index aea197a..0000000 --- a/puppet/modules/apt/spec/defines/key_spec.rb +++ /dev/null @@ -1,123 +0,0 @@ -require 'spec_helper' -describe 'apt::key', :type => :define do - let :title do - '8347A27F' - end - - let :default_params do - { - :key => title, - :ensure => 'present', - :key_server => "keyserver.ubuntu.com", - :key_source => false, - :key_content => false - } - end - - [{}, - { - :ensure => 'absent' - }, - { - :ensure => 'random' - }, - { - :key_source => 'ftp://ftp.example.org/key', - }, - { - :key_content => 'deadbeef', - } - ].each do |param_set| - - let :param_hash do - param_hash = default_params.merge(param_set) - param_hash[:key].upcase! if param_hash[:key] - param_hash - end - - let :params do - param_set - end - - let :digest do - str = String.new - str << param_hash[:key].to_s << '/' - str << param_hash[:key_content].to_s << '/' - str << param_hash[:key_source].to_s << '/' - str << param_hash[:key_server].to_s << '/' - Digest::SHA1.hexdigest(str) - end - - describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do - - it { - if [:present, 'present', :absent, 'absent'].include? param_hash[:ensure] - should contain_apt__params - end - } - - it { - if [:present, 'present'].include? param_hash[:ensure] - should_not contain_exec("apt::key #{param_hash[:key]} absent") - should contain_anchor("apt::key #{param_hash[:key]} present") - should contain_exec(digest).with({ - "path" => "/bin:/usr/bin", - "unless" => "/usr/bin/apt-key list | /bin/grep '#{param_hash[:key]}'" - }) - elsif [:absent, 'absent'].include? param_hash[:ensure] - should_not contain_anchor("apt::key #{param_hash[:key]} present") - should contain_exec("apt::key #{param_hash[:key]} absent").with({ - "path" => "/bin:/usr/bin", - "onlyif" => "apt-key list | grep '#{param_hash[:key]}'", - "command" => "apt-key del '#{param_hash[:key]}'" - }) - else - expect { should raise_error(Puppet::Error) } - end - } - - it { - if [:present, 'present'].include? param_hash[:ensure] - if param_hash[:key_content] - should contain_exec(digest).with({ - "command" => "echo '#{param_hash[:key_content]}' | /usr/bin/apt-key add -" - }) - elsif param_hash[:key_source] - should contain_exec(digest).with({ - "command" => "wget -q '#{param_hash[:key_source]}' -O- | apt-key add -" - }) - elsif param_hash[:key_server] - should contain_exec(digest).with({ - "command" => "apt-key adv --keyserver '#{param_hash[:key_server]}' --recv-keys '#{param_hash[:key]}'" - }) - end - end - } - - end - end - - [{ :ensure => 'present' }, { :ensure => 'absent' }].each do |param_set| - describe "should correctly handle duplicate definitions" do - - let :pre_condition do - "apt::key { 'duplicate': key => '#{title}'; }" - end - - let(:params) { param_set } - - it { - if param_set[:ensure] == 'present' - should contain_anchor("apt::key #{title} present") - should contain_apt__key(title) - should contain_apt__key("duplicate") - elsif param_set[:ensure] == 'absent' - expect { should raise_error(Puppet::Error) } - end - } - - end - end - -end - diff --git a/puppet/modules/apt/spec/defines/pin_spec.rb b/puppet/modules/apt/spec/defines/pin_spec.rb deleted file mode 100644 index a4cb1e2..0000000 --- a/puppet/modules/apt/spec/defines/pin_spec.rb +++ /dev/null @@ -1,101 +0,0 @@ -require 'spec_helper' -describe 'apt::pin', :type => :define do - let(:title) { 'my_pin' } - - let :default_params do - { - :ensure => 'present', - :order => '', - :packages => '*', - :priority => '0', - :release => nil - } - end - - [ - { :params => {}, - :content => "# my_pin\nExplanation: : my_pin\nPackage: *\nPin: release a=my_pin\nPin-Priority: 0\n" - }, - { - :params => { - :packages => 'apache', - :priority => '1' - }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" - }, - { - :params => { - :order => 50, - :packages => 'apache', - :priority => '1' - }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" - }, - { - :params => { - :ensure => 'absent', - :packages => 'apache', - :priority => '1' - }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" - }, - { - :params => { - :packages => 'apache', - :priority => '1', - :release => 'my_newpin' - }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_newpin\nPin-Priority: 1\n" - }, - { - :params => { - :packages => 'apache', - :priority => '1', - :version => '2.2.16*' - }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: version 2.2.16*\nPin-Priority: 1\n" - }, - { - :params => { - :priority => '1', - :origin => 'ftp.de.debian.org' - }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: *\nPin: origin \"ftp.de.debian.org\"\nPin-Priority: 1\n" - }, - { - :params => { - :packages => 'apache', - :priority => '1', - :release => 'stable', - :codename => 'wheezy', - :release_version => '3.0', - :component => 'main', - :originator => 'Debian', - :label => 'Debian' - }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=stable, n=wheezy, v=3.0, c=main, o=Debian, l=Debian\nPin-Priority: 1\n" - }, - ].each do |param_set| - describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do - let :param_hash do - default_params.merge(param_set[:params]) - end - - let :params do - param_set[:params] - end - - it { should include_class("apt::params") } - - it { should contain_file("#{title}.pref").with({ - 'ensure' => param_hash[:ensure], - 'path' => "/etc/apt/preferences.d/#{param_hash[:order] == '' ? "" : "#{param_hash[:order]}-"}#{title}.pref", - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - 'content' => param_set[:content], - }) - } - end - end -end diff --git a/puppet/modules/apt/spec/defines/ppa_spec.rb b/puppet/modules/apt/spec/defines/ppa_spec.rb deleted file mode 100644 index 5b59f57..0000000 --- a/puppet/modules/apt/spec/defines/ppa_spec.rb +++ /dev/null @@ -1,143 +0,0 @@ -require 'spec_helper' -describe 'apt::ppa', :type => :define do - [ { :lsbdistrelease => '11.04', - :lsbdistcodename => 'natty', - :package => 'python-software-properties'}, - { :lsbdistrelease => '12.10', - :lsbdistcodename => 'quantal', - :package => 'software-properties-common'}, - ].each do |platform| - context "on #{platform[:lsbdistcodename]}" do - let :facts do - { - :lsbdistrelease => platform[:lsbdistrelease], - :lsbdistcodename => platform[:lsbdistcodename], - } - end - let :release do - "#{platform[:lsbdistcodename]}" - end - let :package do - "#{platform[:package]}" - end - let :options do - "-y" - end - ['ppa:dans_ppa', 'dans_ppa','ppa:dans-daily/ubuntu'].each do |t| - describe "with title #{t}" do - let :pre_condition do - 'class { "apt": }' - end - let :title do - t - end - let :filename do - t.sub(/^ppa:/,'').gsub('/','-') << "-" << "#{release}.list" - end - - it { should contain_package("#{package}") } - - it { should contain_exec("apt_update").with( - 'command' => '/usr/bin/apt-get update', - 'refreshonly' => true - ) - } - - it { should contain_exec("add-apt-repository-#{t}").with( - 'command' => "/usr/bin/add-apt-repository #{options} #{t}", - 'unless' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}", - 'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"], - 'notify' => "Exec[apt_update]" - ) - } - - it { should create_file("/etc/apt/sources.list.d/#{filename}").with( - 'ensure' => 'file', - 'require' => "Exec[add-apt-repository-#{t}]" - ) - } - end - end - describe 'without a proxy defined' do - let :title do - 'rspec_ppa' - end - let :pre_condition do - 'class { "apt": - proxy_host => false - }' - end - let :filename do - "#{title}-#{release}.list" - end - - it { should contain_exec("add-apt-repository-#{title}").with( - 'environment' => [], - 'command' => "/usr/bin/add-apt-repository #{options} #{title}", - 'unless' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}", - 'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"], - 'notify' => "Exec[apt_update]" - ) - } - end - - describe 'behind a proxy' do - let :title do - 'rspec_ppa' - end - let :pre_condition do - 'class { "apt": - proxy_host => "user:pass@proxy", - }' - end - let :filename do - "#{title}-#{release}.list" - end - - it { should contain_exec("add-apt-repository-#{title}").with( - 'environment' => [ - "http_proxy=http://user:pass@proxy:8080", - "https_proxy=http://user:pass@proxy:8080", - ], - 'command' => "/usr/bin/add-apt-repository #{options} #{title}", - 'unless' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}", - 'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"], - 'notify' => "Exec[apt_update]" - ) - } - end - end - end - - [ { :lsbdistcodename => 'natty', - :package => 'python-software-properties' }, - { :lsbdistcodename => 'quantal', - :package => 'software-properties-common'}, - ].each do |platform| - context "on #{platform[:lsbdistcodename]}" do - describe "it should not error if package['#{platform[:package]}'] is already defined" do - let :pre_condition do - 'class {"apt": }' + - 'package { "#{platform[:package]}": }->Apt::Ppa["ppa"]' - end - let :facts do - {:lsbdistcodename => '#{platform[:lsbdistcodename]}'} - end - let(:title) { "ppa" } - let(:release) { "#{platform[:lsbdistcodename]}" } - it { should contain_package('#{platform[:package]}') } - end - end - end - - describe "without Class[apt] should raise a Puppet::Error" do - let(:release) { "natty" } - let(:title) { "ppa" } - it { expect { should contain_apt__ppa(title) }.to raise_error(Puppet::Error) } - end - - describe "without release should raise a Puppet::Error" do - let(:title) { "ppa:" } - it { expect { should contain_apt__ppa(:release) }.to raise_error(Puppet::Error) } - end -end diff --git a/puppet/modules/apt/spec/defines/source_spec.rb b/puppet/modules/apt/spec/defines/source_spec.rb deleted file mode 100644 index 9ad4d46..0000000 --- a/puppet/modules/apt/spec/defines/source_spec.rb +++ /dev/null @@ -1,166 +0,0 @@ -require 'spec_helper' -describe 'apt::source', :type => :define do - let :title do - 'my_source' - end - - let :default_params do - { - :ensure => 'present', - :location => '', - :release => 'karmic', - :repos => 'main', - :include_src => true, - :required_packages => false, - :key => false, - :key_server => 'keyserver.ubuntu.com', - :key_content => false, - :key_source => false, - :pin => false - } - end - - [{}, - { - :location => 'http://example.com', - :release => 'precise', - :repos => 'security', - :include_src => false, - :required_packages => 'apache', - :key => 'key_name', - :key_server => 'keyserver.debian.com', - :pin => '600', - :key_content => 'ABCD1234' - }, - { - :key => 'key_name', - :key_server => 'keyserver.debian.com', - :key_content => false, - }, - { - :ensure => 'absent', - :location => 'http://example.com', - :release => 'precise', - :repos => 'security', - }, - { - :release => '', - }, - { - :release => 'custom', - }, - { - :architecture => 'amd64', - } - ].each do |param_set| - describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do - let :param_hash do - default_params.merge(param_set) - end - - let :facts do - {:lsbdistcodename => 'karmic'} - end - - let :params do - param_set - end - - let :filename do - "/etc/apt/sources.list.d/#{title}.list" - end - - let :content do - content = "# #{title}" - if param_hash[:architecture] - arch = "[arch=#{param_hash[:architecture]}]" - end - content << "\ndeb #{arch}#{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n" - - if param_hash[:include_src] - content << "deb-src #{arch}#{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n" - end - content - end - - it { should contain_apt__params } - - it { should contain_file("#{title}.list").with({ - 'ensure' => param_hash[:ensure], - 'path' => filename, - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - 'content' => content, - }) - } - - it { - if param_hash[:pin] - should contain_apt__pin(title).with({ - "priority" => param_hash[:pin], - "before" => "File[#{title}.list]" - }) - else - should_not contain_apt__pin(title).with({ - "priority" => param_hash[:pin], - "before" => "File[#{title}.list]" - }) - end - } - - it { - should contain_exec("apt_update").with({ - "command" => "/usr/bin/apt-get update", - "refreshonly" => true - }) - } - - it { - if param_hash[:required_packages] - should contain_exec("Required packages: '#{param_hash[:required_packages]}' for #{title}").with({ - "command" => "/usr/bin/apt-get -y install #{param_hash[:required_packages]}", - "subscribe" => "File[#{title}.list]", - "refreshonly" => true, - "before" => 'Exec[apt_update]', - }) - else - should_not contain_exec("Required packages: '#{param_hash[:required_packages]}' for #{title}").with({ - "command" => "/usr/bin/apt-get -y install #{param_hash[:required_packages]}", - "subscribe" => "File[#{title}.list]", - "refreshonly" => true - }) - end - } - - it { - if param_hash[:key] - should contain_apt__key("Add key: #{param_hash[:key]} from Apt::Source #{title}").with({ - "key" => param_hash[:key], - "ensure" => :present, - "key_server" => param_hash[:key_server], - "key_content" => param_hash[:key_content], - "key_source" => param_hash[:key_source], - "before" => "File[#{title}.list]" - }) - else - should_not contain_apt__key("Add key: #{param_hash[:key]} from Apt::Source #{title}").with({ - "key" => param_hash[:key], - "ensure" => :present, - "key_server" => param_hash[:key_server], - "key_content" => param_hash[:key_content], - "key_source" => param_hash[:key_source], - "before" => "File[#{title}.list]" - }) - end - } - end - end - describe "without release should raise a Puppet::Error" do - let(:default_params) { Hash.new } - let(:facts) { Hash.new } - it { expect { should raise_error(Puppet::Error) } } - let(:facts) { { :lsbdistcodename => 'lucid' } } - it { should contain_apt__source(title) } - end -end diff --git a/puppet/modules/apt/spec/spec_helper.rb b/puppet/modules/apt/spec/spec_helper.rb deleted file mode 100644 index 2c6f566..0000000 --- a/puppet/modules/apt/spec/spec_helper.rb +++ /dev/null @@ -1 +0,0 @@ -require 'puppetlabs_spec_helper/module_spec_helper' diff --git a/puppet/modules/apt/spec/spec_helper_system.rb b/puppet/modules/apt/spec/spec_helper_system.rb deleted file mode 100644 index 490a601..0000000 --- a/puppet/modules/apt/spec/spec_helper_system.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'rspec-system/spec_helper' -require 'rspec-system-puppet/helpers' -require 'rspec-system-serverspec/helpers' - -include RSpecSystemPuppet::Helpers - -include Serverspec::Helper::RSpecSystem -include Serverspec::Helper::DetectOS - -RSpec.configure do |c| - # Project root - proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) - - # Enable colour - c.tty = true - - c.include RSpecSystemPuppet::Helpers - - # This is where we 'setup' the nodes before running our tests - c.before :suite do - # May as well update here as this can only run on apt-get machines. - shell('apt-get update') - # Install puppet - puppet_install - - # Install modules and dependencies - puppet_module_install(:source => proj_root, :module_name => 'apt') - shell('puppet module install puppetlabs-stdlib') - end -end diff --git a/puppet/modules/apt/spec/system/apt_builddep_spec.rb b/puppet/modules/apt/spec/system/apt_builddep_spec.rb deleted file mode 100644 index fa16ab4..0000000 --- a/puppet/modules/apt/spec/system/apt_builddep_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -require 'spec_helper_system' - -describe 'apt::builddep' do - - context 'reset' do - it 'removes packages' do - shell('apt-get -y remove glusterfs-server') - shell('apt-get -y remove g++') - end - end - - context 'apt::builddep' do - it 'should work with no errors' do - pp = <<-EOS - include '::apt' - apt::builddep { 'glusterfs-server': } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - end - end - - describe 'should install g++ as a dependency' do - describe package('g++') do - it { should be_installed } - end - end - end - - context 'reset' do - it 'removes packages' do - shell('apt-get -y remove glusterfs-server') - shell('apt-get -y remove g++') - end - end - -end diff --git a/puppet/modules/apt/spec/system/apt_key_spec.rb b/puppet/modules/apt/spec/system/apt_key_spec.rb deleted file mode 100644 index 4842cb5..0000000 --- a/puppet/modules/apt/spec/system/apt_key_spec.rb +++ /dev/null @@ -1,53 +0,0 @@ -require 'spec_helper_system' - -describe 'apt::key' do - - context 'reset' do - it 'clean up keys' do - shell('apt-key del 4BD6EC30') - shell('apt-key del D50582E6') - end - end - - context 'apt::key' do - it 'should work with no errors' do - pp = <<-EOS - include '::apt' - apt::key { 'puppetlabs': - key => '4BD6EC30', - key_server => 'pgp.mit.edu', - } - - apt::key { 'jenkins': - key => 'D50582E6', - key_source => 'http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key', - } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - end - end - - describe 'keys should exist' do - it 'finds puppetlabs key' do - shell('apt-key list | grep 4BD6EC30') do |r| - r.exit_code.should be_zero - end - end - it 'finds jenkins key' do - shell('apt-key list | grep D50582E6') do |r| - r.exit_code.should be_zero - end - end - end - end - - context 'reset' do - it 'clean up keys' do - shell('apt-key del 4BD6EC30') - shell('apt-key del D50582E6') - end - end - -end diff --git a/puppet/modules/apt/spec/system/apt_ppa_spec.rb b/puppet/modules/apt/spec/system/apt_ppa_spec.rb deleted file mode 100644 index 2e2baf5..0000000 --- a/puppet/modules/apt/spec/system/apt_ppa_spec.rb +++ /dev/null @@ -1,59 +0,0 @@ -require 'spec_helper_system' - -describe 'apt::ppa' do - - context 'reset' do - it 'removes ppa' do - shell('rm /etc/apt/sources.list.d/drizzle-developers-ppa*') - shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*') - end - end - - context 'adding a ppa that doesnt exist' do - it 'should work with no errors' do - pp = <<-EOS - include '::apt' - apt::ppa { 'ppa:drizzle-developers/ppa': } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - end - end - - describe 'contains the source file' do - it 'contains a drizzle ppa source' do - shell('ls /etc/apt/sources.list.d/drizzle-developers-ppa-*.list') do |r| - r.exit_code.should be_zero - end - end - end - end - - context 'readding a removed ppa.' do - it 'setup' do - shell('add-apt-repository -y ppa:raravena80/collectd5') - # This leaves a blank file - shell('add-apt-repository --remove ppa:raravena80/collectd5') - end - - it 'should readd it successfully' do - pp = <<-EOS - include '::apt' - apt::ppa { 'ppa:raravena80/collectd5': } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - end - end - end - - context 'reset' do - it 'removes added ppas' do - shell('rm /etc/apt/sources.list.d/drizzle-developers-ppa*') - shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*') - end - end - -end diff --git a/puppet/modules/apt/spec/system/apt_source_spec.rb b/puppet/modules/apt/spec/system/apt_source_spec.rb deleted file mode 100644 index 6a445e1..0000000 --- a/puppet/modules/apt/spec/system/apt_source_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'spec_helper_system' - -describe 'apt::source' do - - context 'reset' do - it 'clean up puppetlabs repo' do - shell('apt-key del 4BD6EC30') - shell('rm /etc/apt/sources.list.d/puppetlabs.list') - end - end - - context 'apt::source' do - it 'should work with no errors' do - pp = <<-EOS - include '::apt' - apt::source { 'puppetlabs': - location => 'http://apt.puppetlabs.com', - repos => 'main', - key => '4BD6EC30', - key_server => 'pgp.mit.edu', - } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - end - end - - describe 'key should exist' do - it 'finds puppetlabs key' do - shell('apt-key list | grep 4BD6EC30') do |r| - r.exit_code.should be_zero - end - end - end - - describe 'source should exist' do - describe file('/etc/apt/sources.list.d/puppetlabs.list') do - it { should be_file } - end - end - end - - context 'reset' do - it 'clean up puppetlabs repo' do - shell('apt-key del 4BD6EC30') - shell('rm /etc/apt/sources.list.d/puppetlabs.list') - end - end - -end diff --git a/puppet/modules/apt/spec/system/basic_spec.rb b/puppet/modules/apt/spec/system/basic_spec.rb deleted file mode 100644 index 3008356..0000000 --- a/puppet/modules/apt/spec/system/basic_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'spec_helper_system' - -describe 'basic tests:' do - # Using puppet_apply as a subject - context puppet_apply 'notice("foo")' do - its(:stdout) { should =~ /foo/ } - its(:stderr) { should be_empty } - its(:exit_code) { should be_zero } - end -end diff --git a/puppet/modules/apt/spec/system/class_spec.rb b/puppet/modules/apt/spec/system/class_spec.rb deleted file mode 100644 index 7bb6b8d..0000000 --- a/puppet/modules/apt/spec/system/class_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'spec_helper_system' - -describe 'apt class' do - - context 'default parameters' do - # Using puppet_apply as a helper - it 'should work with no errors' do - pp = <<-EOS - class { 'apt': } - EOS - - # Run it twice and test for idempotency - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - r.refresh - r.exit_code.should be_zero - end - end - end -end diff --git a/puppet/modules/apt/templates/10periodic.erb b/puppet/modules/apt/templates/10periodic.erb deleted file mode 100644 index 5737c9a..0000000 --- a/puppet/modules/apt/templates/10periodic.erb +++ /dev/null @@ -1,12 +0,0 @@ -APT::Periodic::Enable "<%= @enable %>"; -APT::Periodic::BackUpArchiveInterval "<%= @backup_interval %>"; -APT::Periodic::BackUpLevel "<%= @backup_level %>"; -APT::Periodic::MaxAge "<%= @max_age %>"; -APT::Periodic::MinAge "<%= @min_age %>"; -APT::Periodic::MaxSize "<%= @max_size %>"; -APT::Periodic::Update-Package-Lists "<%= @update %>"; -APT::Periodic::Download-Upgradeable-Packages "<%= @download %>"; -APT::Periodic::Download-Upgradeable-Packages-Debdelta "<%= @download_delta %>"; -APT::Periodic::Unattended-Upgrade "<%= @upgrade %>"; -APT::Periodic::AutocleanInterval "<%= @autoclean %>"; -APT::Periodic::Verbose "<%= @verbose %>"; diff --git a/puppet/modules/apt/templates/50unattended-upgrades.erb b/puppet/modules/apt/templates/50unattended-upgrades.erb deleted file mode 100644 index 4df0f74..0000000 --- a/puppet/modules/apt/templates/50unattended-upgrades.erb +++ /dev/null @@ -1,53 +0,0 @@ -// Automatically upgrade packages from these (origin:archive) pairs -Unattended-Upgrade::Allowed-Origins { -<% @origins.each do |origin| -%> - "<%= origin %>"; -<% end -%> -}; - -// List of packages to not update -Unattended-Upgrade::Package-Blacklist { -<% @blacklist.each do |package| -%> - "<%= package %>"; -<% end -%> -}; - -// This option allows you to control if on a unclean dpkg exit -// unattended-upgrades will automatically run -// dpkg --force-confold --configure -a -// The default is true, to ensure updates keep getting installed -Unattended-Upgrade::AutoFixInterruptedDpkg "<%= @auto_fix %>"; - -// Split the upgrade into the smallest possible chunks so that -// they can be interrupted with SIGUSR1. This makes the upgrade -// a bit slower but it has the benefit that shutdown while a upgrade -// is running is possible (with a small delay) -Unattended-Upgrade::MinimalSteps "<%= @minimal_steps %>"; - -// Install all unattended-upgrades when the machine is shuting down -// instead of doing it in the background while the machine is running -// This will (obviously) make shutdown slower -Unattended-Upgrade::InstallOnShutdown "<%= @install_on_shutdown %>"; - -// Send email to this address for problems or packages upgrades -// If empty or unset then no email is sent, make sure that you -// have a working mail setup on your system. A package that provides -// 'mailx' must be installed. -<% if @mail_to != "NONE" %>Unattended-Upgrade::Mail "<%= @mail_to %>";<% end %> - -// Set this value to "true" to get emails only on errors. Default -// is to always send a mail if Unattended-Upgrade::Mail is set -<% if @mail_to != "NONE" %>Unattended-Upgrade::MailOnlyOnError "<%= @mail_only_on_error %>";<% end %> - -// Do automatic removal of new unused dependencies after the upgrade -// (equivalent to apt-get autoremove) -Unattended-Upgrade::Remove-Unused-Dependencies "<%= @remove_unused %>"; - -// Automatically reboot *WITHOUT CONFIRMATION* if a -// the file /var/run/reboot-required is found after the upgrade -Unattended-Upgrade::Automatic-Reboot "<%= @auto_reboot %>"; - - -// Use apt bandwidth limit feature, this example limits the download -// speed to 70kb/sec -<% if @dl_limit != "NONE" %>Acquire::http::Dl-Limit "<%= @dl_limit %>";<% end %> diff --git a/puppet/modules/apt/templates/pin.pref.erb b/puppet/modules/apt/templates/pin.pref.erb deleted file mode 100644 index 62c44c7..0000000 --- a/puppet/modules/apt/templates/pin.pref.erb +++ /dev/null @@ -1,22 +0,0 @@ -<%- -@pin = "release a=#{@name}" # default value -if @pin_release.length > 0 - options = [] - options.push("a=#{@release}") if @release.length > 0 - options.push("n=#{@codename}") if @codename.length > 0 - options.push("v=#{@release_version}") if @release_version.length > 0 - options.push("c=#{@component}") if @component.length > 0 - options.push("o=#{@originator}") if @originator.length > 0 - options.push("l=#{@label}") if @label.length > 0 - @pin = "release #{options.join(', ')}" -elsif @version.length > 0 - @pin = "version #{@version}" -elsif @origin.length > 0 - @pin = "origin \"#{@origin}\"" -end --%> -# <%= @name %> -Explanation: <%= @explanation %> -Package: <%= @packages %> -Pin: <%= @pin %> -Pin-Priority: <%= @priority %> diff --git a/puppet/modules/apt/templates/source.list.erb b/puppet/modules/apt/templates/source.list.erb deleted file mode 100644 index e8b6865..0000000 --- a/puppet/modules/apt/templates/source.list.erb +++ /dev/null @@ -1,5 +0,0 @@ -# <%= @name %> -deb <% if @architecture %>[arch=<%= @architecture %>]<% end %><%= @location %> <%= @release_real %> <%= @repos %> -<%- if @include_src then -%> -deb-src <% if @architecture %>[arch=<%= @architecture %>]<% end %><%= @location %> <%= @release_real %> <%= @repos %> -<%- end -%> diff --git a/puppet/modules/apt/tests/builddep.pp b/puppet/modules/apt/tests/builddep.pp deleted file mode 100644 index 8b4f796..0000000 --- a/puppet/modules/apt/tests/builddep.pp +++ /dev/null @@ -1,2 +0,0 @@ -class { 'apt': } -apt::builddep{ 'glusterfs-server': } diff --git a/puppet/modules/apt/tests/debian/testing.pp b/puppet/modules/apt/tests/debian/testing.pp deleted file mode 100644 index 8245b3a..0000000 --- a/puppet/modules/apt/tests/debian/testing.pp +++ /dev/null @@ -1,2 +0,0 @@ -class { 'apt': } -class { 'apt::debian::testing': } diff --git a/puppet/modules/apt/tests/debian/unstable.pp b/puppet/modules/apt/tests/debian/unstable.pp deleted file mode 100644 index 8605179..0000000 --- a/puppet/modules/apt/tests/debian/unstable.pp +++ /dev/null @@ -1,2 +0,0 @@ -class { 'apt': } -class { 'apt::debian::unstable': } diff --git a/puppet/modules/apt/tests/force.pp b/puppet/modules/apt/tests/force.pp deleted file mode 100644 index f331363..0000000 --- a/puppet/modules/apt/tests/force.pp +++ /dev/null @@ -1,7 +0,0 @@ -# force.pp -# force a package from a specific release - -apt::force { 'package': - release => 'testing', - version => false -} diff --git a/puppet/modules/apt/tests/init.pp b/puppet/modules/apt/tests/init.pp deleted file mode 100644 index abc75af..0000000 --- a/puppet/modules/apt/tests/init.pp +++ /dev/null @@ -1 +0,0 @@ -class { 'apt': } diff --git a/puppet/modules/apt/tests/key.pp b/puppet/modules/apt/tests/key.pp deleted file mode 100644 index 79e0e1b..0000000 --- a/puppet/modules/apt/tests/key.pp +++ /dev/null @@ -1,6 +0,0 @@ -# Declare Apt key for apt.puppetlabs.com source -apt::key { 'puppetlabs': - key => '4BD6EC30', - key_server => 'pgp.mit.edu', - key_options => 'http-proxy="http://proxyuser:proxypass@example.org:3128"', -} diff --git a/puppet/modules/apt/tests/params.pp b/puppet/modules/apt/tests/params.pp deleted file mode 100644 index 5ddf3c6..0000000 --- a/puppet/modules/apt/tests/params.pp +++ /dev/null @@ -1 +0,0 @@ -include apt::params diff --git a/puppet/modules/apt/tests/pin.pp b/puppet/modules/apt/tests/pin.pp deleted file mode 100644 index 6a9024c..0000000 --- a/puppet/modules/apt/tests/pin.pp +++ /dev/null @@ -1,5 +0,0 @@ -# pin a release in apt, useful for unstable repositories -apt::pin { 'foo': - packages => '*', - priority => 0, -} diff --git a/puppet/modules/apt/tests/ppa.pp b/puppet/modules/apt/tests/ppa.pp deleted file mode 100644 index e728f6f..0000000 --- a/puppet/modules/apt/tests/ppa.pp +++ /dev/null @@ -1,4 +0,0 @@ -class { 'apt': } - -# Example declaration of an Apt PPA -apt::ppa{ 'ppa:openstack-ppa/bleeding-edge': } diff --git a/puppet/modules/apt/tests/release.pp b/puppet/modules/apt/tests/release.pp deleted file mode 100644 index 823f586..0000000 --- a/puppet/modules/apt/tests/release.pp +++ /dev/null @@ -1,4 +0,0 @@ -class { 'apt': } -class { 'apt::release': - release_id => 'karmic' -} diff --git a/puppet/modules/apt/tests/source.pp b/puppet/modules/apt/tests/source.pp deleted file mode 100644 index d83cb97..0000000 --- a/puppet/modules/apt/tests/source.pp +++ /dev/null @@ -1,29 +0,0 @@ -# Declare the apt class to manage /etc/apt/sources.list and /etc/sources.list.d -class { 'apt': } - -# Install the puppetlabs apt source -# Release is automatically obtained from lsbdistcodename fact if available. -apt::source { 'puppetlabs': - location => 'http://apt.puppetlabs.com', - repos => 'main', - key => '4BD6EC30', - key_server => 'pgp.mit.edu', -} - -# test two sources with the same key -apt::source { 'debian_testing': - location => 'http://debian.mirror.iweb.ca/debian/', - release => 'testing', - repos => 'main contrib non-free', - key => '55BE302B', - key_server => 'subkeys.pgp.net', - pin => '-10', -} -apt::source { 'debian_unstable': - location => 'http://debian.mirror.iweb.ca/debian/', - release => 'unstable', - repos => 'main contrib non-free', - key => '55BE302B', - key_server => 'subkeys.pgp.net', - pin => '-10', -} diff --git a/puppet/modules/apt/tests/unattended-upgrades.pp b/puppet/modules/apt/tests/unattended-upgrades.pp deleted file mode 100644 index 7f65ab4..0000000 --- a/puppet/modules/apt/tests/unattended-upgrades.pp +++ /dev/null @@ -1 +0,0 @@ -include apt::unattended-upgrades diff --git a/puppet/modules/locale/README.md b/puppet/modules/locale/README.md deleted file mode 100644 index dd9cc77..0000000 --- a/puppet/modules/locale/README.md +++ /dev/null @@ -1,2 +0,0 @@ -puppet-locale -============= \ No newline at end of file diff --git a/puppet/modules/locale/TODO b/puppet/modules/locale/TODO deleted file mode 100644 index ecd7ab6..0000000 --- a/puppet/modules/locale/TODO +++ /dev/null @@ -1 +0,0 @@ -Add unless to check if necessary exec install_locales \ No newline at end of file diff --git a/puppet/modules/locale/manifests/init.pp b/puppet/modules/locale/manifests/init.pp deleted file mode 100644 index dfce7c3..0000000 --- a/puppet/modules/locale/manifests/init.pp +++ /dev/null @@ -1,56 +0,0 @@ -class locale ( - $locales = 'en_US.UTF-8 pt_BR', - $lang = 'en_US.UTF-8', - $language = 'en_US' -) { - - Exec { - path => ['/usr/bin', '/usr/sbin', '/bin'] - } - - file { '/var/cache/locale': - ensure => directory, - mode => '0755', - owner => 'root', - } - - file { '/var/cache/locale/installed': - ensure => present, - mode => '0644', - owner => 'root', - content => "${locales}-${lang}-${language}", - require => File['/var/cache/locale'], - } - - exec { 'install_locales': - command => "locale-gen ${locales}", - refreshonly => true, - subscribe => File['/var/cache/locale/installed'], - notify => Exec['reload_locales'] - } - - if $lang { - exec { 'update_default_lang': - command => "update-locale LANG='${lang}'", - notify => Exec['reload_locales'], - refreshonly => true, - subscribe => File['/var/cache/locale/installed'], - } - } - - if $language { - exec { 'update_default_language': - command => "update-locale LANGUAGE='${language}'", - notify => Exec['reload_locales'], - refreshonly => true, - subscribe => File['/var/cache/locale/installed'], - } - } - - exec { 'reload_locales': - command => "dpkg-reconfigure locales", - refreshonly => true - } - -} - diff --git a/puppet/modules/locale/test/init.pp b/puppet/modules/locale/test/init.pp deleted file mode 100644 index d29ba73..0000000 --- a/puppet/modules/locale/test/init.pp +++ /dev/null @@ -1 +0,0 @@ -include locale \ No newline at end of file diff --git a/puppet/modules/nginx/LICENSE b/puppet/modules/nginx/LICENSE deleted file mode 100644 index 4c6dc84..0000000 --- a/puppet/modules/nginx/LICENSE +++ /dev/null @@ -1,12 +0,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. diff --git a/puppet/modules/nginx/Modulefile b/puppet/modules/nginx/Modulefile deleted file mode 100644 index 038b4d8..0000000 --- a/puppet/modules/nginx/Modulefile +++ /dev/null @@ -1,8 +0,0 @@ -name 'BenoitCattie-nginx' -version '0.0.2' -source 'https://github.com/BenoitCattie/puppet-nginx.git' -author 'BenoitCattie' -license 'APACHE2' -summary 'Basic module for configuring nginx via puppet' -description 'Basic module for configuring nginx via puppet. You can easily create fcgi vhost with this module.' -project_page 'http://github.com/BenoitCattie/puppet-nginx' diff --git a/puppet/modules/nginx/README b/puppet/modules/nginx/README deleted file mode 100644 index a970323..0000000 --- a/puppet/modules/nginx/README +++ /dev/null @@ -1,116 +0,0 @@ -# Nginx Recipe # -Author : Benoit CATTIE -Version : 0.2 -Licence : Apache - -Basic module for configuring nginx via puppet. - -Based in part on apache2 module code by Sam Quigley , Tim Stoop and David Schmitt - -## Class: nginx ## - -Parameters (used in nginx.conf.erb) : - * $user. Defaults to 'www-data'. - * $worker_processes. Defaults to '1'. - * $worker_connections. Defaults to '1024'. - * $error_log. Default to undef - * $pid_file. Default to undef - * $access_log. Default to undef - -Install nginx. -Create config directories : - * /etc/nginx/conf.d for http config snippet - * /etc/nginx/includes for sites includes - * /etc/nginx/sites-enabled - * /etc/nginx/sites-available - * /etc/nginx/ssl - -Provide 4 definitions : - * nginx::config (http config snippet) - * nginx::site (http site) - * nginx::site_include (site includes) - * nginx::fcgi::site (fcgi php site) - -Templates: - - nginx.conf.erb => /etc/nginx/nginx.conf - - -### Define nginx::config ### - -Installs a config snippet in /etc/nginx/conf.d. - -Parameters : - * ensure: typically set to "present" or "absent". Defaults to "present" - * content: set the content of the config snipppet. Defaults to 'template("nginx/${name}.conf.erb")' - * order: specifies the load order for this config snippet. Defaults to "500" - - -### Define: nginx::site ### - -Install a nginx site in /etc/nginx/sites-available (and symlink in /etc/nginx/sites-enabled). - -Parameters : - * ensure: typically set to "present" or "absent". Defaults to "present" - * content: site definition (should be a template). - -### Define: nginx::site_include ### - -Define: site_include - -Define a site config include in /etc/nginx/includes - -Parameters : - * ensure: typically set to "present" or "absent". Defaults to "present" - * content: include definition (should be a template). - - -## Class nginx::fcgi ## - -Manage nginx fcgi configuration. -Provide nginx::fcgi::site - -Templates : - * nginx/includes/fastcgi_params.erb - -### Define: nginx::fcgi::site ### - -Create a fcgi site config from template using parameters. -You can use my php5-fpm class to manage fastcgi servers. - -Parameters : - * ensure: typically set to "present" or "absent". Defaults to "present" - * root: document root (Required) - * index: nginx index directive. Defaults to "index.php" - * fastcgi_pass : port or socket on which the FastCGI-server is listening (Required) - * server_name : server_name directive (could be an array) - * listen : address/port the server listen to. Defaults to 80. Auto enable ssl if 443 - * access_log : custom acces logs. Defaults to /var/log/nginx/$name_access.log - * include : custom include for the site (could be an array). Include files must exists - to avoid nginx reload errors. Use with nginx::site_include - * ssl_certificate : ssl_certificate path. If empty auto-generating ssl cert - * ssl_certificate_key : ssl_certificate_key path. If empty auto-generating ssl cert key - See http://wiki.nginx.org for details. - -Templates : - * nginx/fcgi_site.erb - -Sample Usage : - - include nginx - include nginx::fcgi - - nginx::fcgi::site {"default": - root => "/var/www/nginx-default", - fastcgi_pass => "127.0.0.1:9000", - server_name => ["localhost", "$hostname", "$fqdn"], - } - - nginx::fcgi::site {"default-ssl": - listen => "443", - root => "/var/www/nginx-default", - fastcgi_pass => "127.0.0.1:9000", - server_name => "$fqdn", - } - -## CHANGELOG ## -- v0.2 : * ssl support diff --git a/puppet/modules/nginx/manifests/config.pp b/puppet/modules/nginx/manifests/config.pp deleted file mode 100644 index d277353..0000000 --- a/puppet/modules/nginx/manifests/config.pp +++ /dev/null @@ -1,27 +0,0 @@ -# Define: nginx::config -# -# Define a nginx config snippet. Places all config snippets into -# /etc/nginx/conf.d, where they will be automatically loaded by http module -# -# -# Parameters : -# * ensure: typically set to "present" or "absent". Defaults to "present" -# * content: set the content of the config snipppet. Defaults to 'template("nginx/${name}.conf.erb")' -# * order: specifies the load order for this config snippet. Defaults to "500" -# -define nginx::config($ensure='present', $content=undef, $order='500') { - $real_content = $content ? { - undef => template("nginx/${name}.conf.erb"), - default => $content, - } - - file { "${nginx::nginx_conf}/${order}-${name}.conf": - ensure => $ensure, - content => $real_content, - mode => '0644', - owner => 'root', - group => 'root', - notify => Service['nginx'], - } -} - diff --git a/puppet/modules/nginx/manifests/fcgi.pp b/puppet/modules/nginx/manifests/fcgi.pp deleted file mode 100644 index 802a161..0000000 --- a/puppet/modules/nginx/manifests/fcgi.pp +++ /dev/null @@ -1,13 +0,0 @@ -# Class: nginx::fcgi -# -# Manage nginx fcgi configuration. -# Provide nginx::fcgi::site -# -# Templates : -# * nginx/includes/fastcgi_params.erb -# -class nginx::fcgi inherits nginx { - nginx::site_include { 'fastcgi_params': - content => template('nginx/includes/fastcgi_params.erb'), - } -} diff --git a/puppet/modules/nginx/manifests/fcgi/site.pp b/puppet/modules/nginx/manifests/fcgi/site.pp deleted file mode 100644 index 02f05e6..0000000 --- a/puppet/modules/nginx/manifests/fcgi/site.pp +++ /dev/null @@ -1,86 +0,0 @@ -# Define: nginx::fcgi::site -# -# Create a fcgi site config from template using parameters. -# You can use my php5-fpm class to manage fastcgi servers. -# -# Parameters : -# * ensure: typically set to "present" or "absent". Defaults to "present" -# * root: document root (Required) -# * fastcgi_pass : port or socket on which the FastCGI-server is listening (Required) -# * server_name : server_name directive (could be an array) -# * listen : address/port the server listen to. Defaults to 80. Auto enable ssl if 443 -# * access_log : custom acces logs. Defaults to /var/log/nginx/$name_access.log -# * include : custom include for the site (could be an array). Include files must exists -# to avoid nginx reload errors. Use with nginx::site_include -# * ssl_certificate : ssl_certificate path. If empty auto-generating ssl cert -# * ssl_certificate_key : ssl_certificate_key path. If empty auto-generating ssl cert key -# See http://wiki.nginx.org for details. -# -# Templates : -# * nginx/fcgi_site.erb -# -# Sample Usage : -# nginx::fcgi::site { 'default': -# root => '/var/www/nginx-default', -# fastcgi_pass => '127.0.0.1:9000', -# server_name => ['localhost', $hostname, $fqdn], -# } -# -# nginx::fcgi::site { 'default-ssl': -# listen => '443', -# root => '/var/www/nginx-default', -# fastcgi_pass => '127.0.0.1:9000', -# server_name => $fqdn, -# } -# -define nginx::fcgi::site( - $root, - $fastcgi_pass, - $ensure = 'present', - $index = 'index.php', - $include = '', - $listen = '80', - $server_name = undef, - $access_log = undef, - $ssl_certificate = undef, - $ssl_certificate_key = undef, - $ssl_session_timeout = '5m') { - - $real_server_name = $server_name ? { - undef => $name, - default => $server_name, - } - - $real_access_log = $access_log ? { - undef => "/var/log/nginx/${name}_access.log", - default => $access_log, - } - - # Autogenerating ssl certs - if $listen == '443' and $ensure == 'present' and ($ssl_certificate == undef or $ssl_certificate_key == undef) { - exec { "generate-${name}-certs": - command => "/usr/bin/openssl req -new -inform PEM -x509 -nodes -days 999 -subj \ - '/C=ZZ/ST=AutoSign/O=AutoSign/localityName=AutoSign/commonName=${real_server_name}/organizationalUnitName=AutoSign/emailAddress=AutoSign/' \ - -newkey rsa:2048 -out /etc/nginx/ssl/${name}.pem -keyout /etc/nginx/ssl/${name}.key", - unless => "/usr/bin/test -f /etc/nginx/ssl/${name}.pem", - require => File['/etc/nginx/ssl'], - notify => Service['nginx'], - } - } - - $real_ssl_certificate = $ssl_certificate ? { - undef => "/etc/nginx/ssl/${name}.pem", - default => $ssl_certificate, - } - - $real_ssl_certificate_key = $ssl_certificate_key ? { - undef => "/etc/nginx/ssl/${name}.key", - default => $ssl_certificate_key, - } - - nginx::site { $name: - ensure => $ensure, - content => template('nginx/fcgi_site.erb'), - } -} - diff --git a/puppet/modules/nginx/manifests/init.pp b/puppet/modules/nginx/manifests/init.pp deleted file mode 100644 index b3cf9f6..0000000 --- a/puppet/modules/nginx/manifests/init.pp +++ /dev/null @@ -1,102 +0,0 @@ -# Class: nginx -# -# Install nginx. -# -# Parameters: -# * $user. Defaults to 'www-data'. -# * $worker_processes. Defaults to '1'. -# * $worker_connections. Defaults to '1024'. -# * $error_log. Default to undef -# * $pid_file. Default to undef -# * $access_log. Default to undef -# -# Create config directories : -# * /etc/nginx/conf.d for http config snippet -# * /etc/nginx/includes for sites includes -# -# Provide 3 definitions : -# * nginx::config (http config snippet) -# * nginx::site (http site) -# * nginx::site_include (site includes) -# -# Templates: -# - nginx.conf.erb => /etc/nginx/nginx.conf -# -class nginx ( - $user = 'www-data', - $worker_processes = '1', - $worker_connections = '1024', - $error_log = undef, - $pid_file = undef, - $access_log = undef -){ - $nginx_includes = '/etc/nginx/includes' - $nginx_conf = '/etc/nginx/conf.d' - - case $::operatingsystem { - centos,fedora,rhel: { - $nginx_packages = ['nginx', 'GeoIP', 'gd', 'libXpm', 'libxslt'] - } - debian,ubuntu: { - $nginx_packages = 'nginx-extras' - } - } - if ! defined(Package[$nginx_packages]) { - package { $nginx_packages: - ensure => latest - } - } - - #restart-command is a quick-fix here, until http://projects.puppetlabs.com/issues/1014 is solved - service { 'nginx': - ensure => running, - enable => true, - hasrestart => true, - require => File['/etc/nginx/nginx.conf'], - restart => '/etc/init.d/nginx reload' - } - - file { '/etc/nginx/nginx.conf': - ensure => present, - mode => '0644', - owner => 'root', - group => 'root', - content => template('nginx/nginx.conf.erb'), - notify => Service['nginx'], - require => Package[$nginx_packages], - } - - file { $nginx_conf: - ensure => directory, - mode => '0644', - owner => 'root', - group => 'root', - require => Package[$nginx_packages], - } - - file { '/etc/nginx/ssl': - ensure => directory, - mode => '0644', - owner => 'root', - group => 'root', - require => Package[$nginx_packages], - } - - file { $nginx_includes: - ensure => directory, - mode => '0644', - owner => 'root', - group => 'root', - require => Package[$nginx_packages], - } - - # Nuke default files - file { '/etc/nginx/fastcgi_params': - ensure => absent, - require => Package[$nginx_packages], - } - - file { '/etc/nginx/sites-enabled/default': - ensure => absent, - } -} diff --git a/puppet/modules/nginx/manifests/install_site.pp b/puppet/modules/nginx/manifests/install_site.pp deleted file mode 100644 index 15fe8b9..0000000 --- a/puppet/modules/nginx/manifests/install_site.pp +++ /dev/null @@ -1,42 +0,0 @@ -# Define: install_site -# -# Install nginx vhost -# This definition is private, not intended to be called directly -# -define nginx::install_site($content=undef) { - # first, make sure the site config exists - case $content { - undef: { - file { "/etc/nginx/sites-available/${name}": - ensure => present, - mode => '0644', - owner => 'root', - group => 'root', - alias => "sites-${name}", - notify => Service['nginx'], - require => Package[$nginx::nginx_packages], - } - } - default: { - file { "/etc/nginx/sites-available/${name}": - ensure => present, - mode => '0644', - owner => 'root', - group => 'root', - alias => "sites-$name", - content => $content, - require => Package[$nginx::nginx_packages], - notify => Service['nginx'], - } - } - } - - # now, enable it. - exec { "ln -s /etc/nginx/sites-available/${name} /etc/nginx/sites-enabled/${name}": - unless => "/bin/sh -c '[ -L /etc/nginx/sites-enabled/${name} ] && \ - [ /etc/nginx/sites-enabled/${name} -ef /etc/nginx/sites-available/${name} ]'", - path => ['/usr/bin/', '/bin/'], - notify => Service['nginx'], - require => File["sites-${name}"], - } -} diff --git a/puppet/modules/nginx/manifests/site.pp b/puppet/modules/nginx/manifests/site.pp deleted file mode 100644 index 94abdb5..0000000 --- a/puppet/modules/nginx/manifests/site.pp +++ /dev/null @@ -1,27 +0,0 @@ -# Define: nginx::site -# -# Install a nginx site in /etc/nginx/sites-available (and symlink in /etc/nginx/sites-enabled). -# -# -# Parameters : -# * ensure: typically set to "present" or "absent". Defaults to "present" -# * content: site definition (should be a template). -# -define nginx::site($ensure='present', $content='') { - case $ensure { - 'present' : { - nginx::install_site { $name: - content => $content - } - } - 'absent' : { - exec { "/bin/rm -f /etc/nginx/sites-enabled/${name}": - onlyif => "/bin/sh -c '[ -L /etc/nginx/sites-enabled/${name} ] && \ - [ /etc/nginx/sites-enabled/$name -ef /etc/nginx/sites-available/${name} ]'", - notify => Service['nginx'], - require => Package[$nginx::nginx_packages], - } - } - default: { err ("Unknown ensure value: '$ensure'") } - } -} diff --git a/puppet/modules/nginx/manifests/site_include.pp b/puppet/modules/nginx/manifests/site_include.pp deleted file mode 100644 index 7e7181b..0000000 --- a/puppet/modules/nginx/manifests/site_include.pp +++ /dev/null @@ -1,20 +0,0 @@ -# Define: site_include -# -# Define a site config include in /etc/nginx/includes -# -# Parameters : -# * ensure: typically set to "present" or "absent". Defaults to "present" -# * content: include definition (should be a template). -# -define nginx::site_include($ensure='present', $content='') { - file { "${nginx::nginx_includes}/${name}.inc": - ensure => $ensure, - mode => '0644', - owner => 'root', - group => 'root', - content => $content, - require => File[$nginx::nginx_includes], - notify => Service['nginx'], - } -} - diff --git a/puppet/modules/nginx/templates/fcgi_site.erb b/puppet/modules/nginx/templates/fcgi_site.erb deleted file mode 100644 index 7cb13f1..0000000 --- a/puppet/modules/nginx/templates/fcgi_site.erb +++ /dev/null @@ -1,39 +0,0 @@ -server { - listen <%= listen %> ; - - server_name <% real_server_name.each do |s_n| -%><%= s_n %> <% end -%>; - - access_log <%= real_access_log %>; - - root <%= root %>; - -<% if listen == '443' %> - ssl on; - ssl_certificate <%= real_ssl_certificate %>; - ssl_certificate_key <%= real_ssl_certificate_key %>; - - ssl_session_timeout <%= ssl_session_timeout %>; - - ssl_protocols SSLv2 SSLv3 TLSv1; - ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; - ssl_prefer_server_ciphers on; -<% end -%> - location / { - index <%= index %>; - } - - location ~ \.php$ { - fastcgi_pass <%= fastcgi_pass %>; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include /etc/nginx/includes/fastcgi_params.inc; - } - - location ~ /\.ht { - deny all; - } - -<% if include != '' %> <%include.each do |inc| %>include <%= inc %>; - <% end -%><% end -%> -} - diff --git a/puppet/modules/nginx/templates/includes/fastcgi_params.erb b/puppet/modules/nginx/templates/includes/fastcgi_params.erb deleted file mode 100644 index 087e363..0000000 --- a/puppet/modules/nginx/templates/includes/fastcgi_params.erb +++ /dev/null @@ -1,23 +0,0 @@ -fastcgi_param QUERY_STRING $query_string; -fastcgi_param REQUEST_METHOD $request_method; -fastcgi_param CONTENT_TYPE $content_type; -fastcgi_param CONTENT_LENGTH $content_length; - -fastcgi_param SCRIPT_NAME $fastcgi_script_name; -fastcgi_param REQUEST_URI $request_uri; -fastcgi_param DOCUMENT_URI $document_uri; -fastcgi_param DOCUMENT_ROOT $document_root; -fastcgi_param SERVER_PROTOCOL $server_protocol; - -fastcgi_param GATEWAY_INTERFACE CGI/1.1; -fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; - -fastcgi_param REMOTE_ADDR $remote_addr; -fastcgi_param REMOTE_PORT $remote_port; -fastcgi_param SERVER_ADDR $server_addr; -fastcgi_param SERVER_PORT $server_port; -fastcgi_param SERVER_NAME $server_name; - -# PHP only, required if PHP was built with --enable-force-cgi-redirect -fastcgi_param REDIRECT_STATUS 200; - diff --git a/puppet/modules/nginx/templates/nginx.conf.erb b/puppet/modules/nginx/templates/nginx.conf.erb deleted file mode 100644 index 477481b..0000000 --- a/puppet/modules/nginx/templates/nginx.conf.erb +++ /dev/null @@ -1,37 +0,0 @@ -user <%= @user %>; -worker_processes <%= @worker_processes %>; - -<% if @error_log %> -error_log <%= @error_log %>; -<% end %> -<% if @pid_file %> -pid <%= @pid_file %>; -<% end %> - -events { - worker_connections <%= @worker_connections %>; -} - -http { - include /etc/nginx/mime.types; - - <% if @access_log %> - access_log <%= @access_log %>; - <% end %> - - sendfile on; - #tcp_nopush on; - - #keepalive_timeout 0; - keepalive_timeout 65; - tcp_nodelay on; - - gzip on; - gzip_disable "MSIE [1-6]\.(?!.*SV1)"; - - include /etc/nginx/conf.d/*.conf; - include /etc/nginx/sites-enabled/*; - - server_tokens off; - types_hash_bucket_size 64; -} diff --git a/puppet/modules/ntp/.gitignore b/puppet/modules/ntp/.gitignore deleted file mode 100644 index 560d1a6..0000000 --- a/puppet/modules/ntp/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -*.gem -*.rbc -.bundle -.config -coverage -InstalledFiles -lib/bundler/man -pkg -rdoc -spec/reports -test/tmp -test/version_tmp -tmp - -# YARD artifacts -.yardoc -_yardoc -doc/ diff --git a/puppet/modules/ntp/README.md b/puppet/modules/ntp/README.md deleted file mode 100644 index e4f6178..0000000 --- a/puppet/modules/ntp/README.md +++ /dev/null @@ -1,16 +0,0 @@ -Puppet ntp -========== -Start a cronjob to run every hour ntpdate - -Usage -========== - -```puppet -include ntp # Use default server (pool.ntp.org) or your hiera config (puppet 3+) -``` -or -```puppet -class { 'ntp': - server => 'your ntp server' -} -``` \ No newline at end of file diff --git a/puppet/modules/ntp/manifests/init.pp b/puppet/modules/ntp/manifests/init.pp deleted file mode 100644 index 01b3356..0000000 --- a/puppet/modules/ntp/manifests/init.pp +++ /dev/null @@ -1,15 +0,0 @@ - -class ntp ( - $server='pool.ntp.org', -){ - package { 'ntpdate': - ensure => installed, - } - - cron { 'ntpdate': - command => "/usr/sbin/ntpdate $server > /dev/null", - user => 'root', - minute => '0', - require => Package['ntpdate'], - } -} diff --git a/puppet/modules/ntp/tests/init.pp b/puppet/modules/ntp/tests/init.pp deleted file mode 100644 index 9f87de7..0000000 --- a/puppet/modules/ntp/tests/init.pp +++ /dev/null @@ -1 +0,0 @@ -include ntp diff --git a/puppet/modules/postfix/README.md b/puppet/modules/postfix/README.md deleted file mode 100644 index a40f79b..0000000 --- a/puppet/modules/postfix/README.md +++ /dev/null @@ -1,2 +0,0 @@ -puppet-postfix -============== \ No newline at end of file diff --git a/puppet/modules/postfix/manifests/init.pp b/puppet/modules/postfix/manifests/init.pp deleted file mode 100644 index 6b23887..0000000 --- a/puppet/modules/postfix/manifests/init.pp +++ /dev/null @@ -1,41 +0,0 @@ - -class postfix ( - $admin_email, - $server_name=$fqdn, - $mailbox_limit=0 # Zero means no limit -) { - - $postfix_preseed = '/var/cache/debconf/postfix.preseed' - $preseed_cmd = "debconf-set-selections $postfix_preseed" - - file { $postfix_preseed: - ensure => present, - content => template('postfix/postfix.preseed.erb'), - } - - exec { $preseed_cmd: - path => '/usr/bin/', - refreshonly => true, - subscribe => File[$postfix_preseed], - } - - package { 'postfix': - ensure => installed, - require => File[$postfix_preseed], - responsefile => $postfix_preseed, - } - - package { 'mailutils': - ensure => installed, - } - - service {'postfix': - ensure => running, - enable => true, - hasstatus => false, - stop => 'invoke-rc.d postfix stop', - start => 'invoke-rc.d postfix start', - restart => 'invoke-rc.d postfix restart', - require => Package['postfix'] - } -} diff --git a/puppet/modules/postfix/templates/postfix.preseed.erb b/puppet/modules/postfix/templates/postfix.preseed.erb deleted file mode 100644 index 4eac2e1..0000000 --- a/puppet/modules/postfix/templates/postfix.preseed.erb +++ /dev/null @@ -1,17 +0,0 @@ -postfix postfix/root_address string <%= @admin_email %> -postfix postfix/rfc1035_violation boolean false -postfix postfix/mydomain_warning boolean -postfix postfix/mynetworks string -postfix postfix/mailname string <%= @server_name %> -postfix postfix/tlsmgr_upgrade_warning boolean -postfix postfix/recipient_delim string -postfix postfix/main_mailer_type select Internet Site -postfix postfix/destinations string localhost, <%= @fqdn %>, <%= @hostname %> -postfix postfix/retry_upgrade_warning boolean -postfix postfix/kernel_version_warning boolean -postfix postfix/sqlite_warning boolean -postfix postfix/mailbox_limit string <%= @mailbox_limit %> -postfix postfix/relayhost string -postfix postfix/procmail boolean false -postfix postfix/protocols select all -postfix postfix/chattr boolean false diff --git a/puppet/modules/postfix/tests/init.pp b/puppet/modules/postfix/tests/init.pp deleted file mode 100644 index 5bffcc8..0000000 --- a/puppet/modules/postfix/tests/init.pp +++ /dev/null @@ -1,2 +0,0 @@ - -include postfix diff --git a/puppet/modules/ps1/README.md b/puppet/modules/ps1/README.md deleted file mode 100644 index a5f664f..0000000 --- a/puppet/modules/ps1/README.md +++ /dev/null @@ -1,18 +0,0 @@ -puppet-ps1 -============== - -Class to customize PS1 - -Usage: - class { 'ps1': - color => 'yellow' - } - or - include shell to use default color (red) - -Allowed Colors: - 'green' - 'red' - 'yellow' - - diff --git a/puppet/modules/ps1/manifests/init.pp b/puppet/modules/ps1/manifests/init.pp deleted file mode 100644 index 0b75b17..0000000 --- a/puppet/modules/ps1/manifests/init.pp +++ /dev/null @@ -1,37 +0,0 @@ -class ps1 ( - $color = 'red' -) { - $color_code = $color ? { - 'red' => '1', - 'green' => '2', - 'yellow' => '3', - default => '1' - } - - $force_color_prompt_cmd = "/bin/sed -i -re '/force_color_prompt=yes/ s/^#//'" - $force_color_prompt_condition = '/bin/grep "#force_color_prompt"' - - $ps1_color_cmd = "/bin/sed -i -re 's/01;3[1-3]m/01;3${color_code}m/'" - $ps1_color_condition = "/bin/grep '01;3${color_code}m'" - - $skel_path = '/etc/skel/.bashrc' - $root_path = '/root/.bashrc' - - # uncomment force_color_prompt in skel - exec { "$force_color_prompt_cmd $skel_path": - onlyif => "$force_color_prompt_condition $skel_path" - } - # uncomment force_color_prompt in root - exec { "$force_color_prompt_cmd $root_path": - onlyif => "$force_color_prompt_condition $root_path" - } - - # change prompt color in skel - exec { "$ps1_color_cmd $skel_path": - unless => "$ps1_color_condition $skel_path", - } - # change prompt color in root - exec { "$ps1_color_cmd $root_path": - unless => "$ps1_color_condition $root_path", - } -} diff --git a/puppet/modules/ps1/test/init.pp b/puppet/modules/ps1/test/init.pp deleted file mode 100644 index 2a46ba2..0000000 --- a/puppet/modules/ps1/test/init.pp +++ /dev/null @@ -1 +0,0 @@ -include ps1 \ No newline at end of file diff --git a/puppet/modules/stdlib/CHANGELOG b/puppet/modules/stdlib/CHANGELOG deleted file mode 100644 index e1a095f..0000000 --- a/puppet/modules/stdlib/CHANGELOG +++ /dev/null @@ -1,278 +0,0 @@ -2013-05-06 - Jeff McCune - 4.1.0 - * (#20582) Restore facter_dot_d to stdlib for PE users (3b887c8) - * (maint) Update Gemfile with GEM_FACTER_VERSION (f44d535) - -2013-05-06 - Alex Cline - 4.1.0 - * Terser method of string to array conversion courtesy of ethooz. (d38bce0) - -2013-05-06 - Alex Cline 4.1.0 - * Refactor ensure_resource expectations (b33cc24) - -2013-05-06 - Alex Cline 4.1.0 - * Changed str-to-array conversion and removed abbreviation. (de253db) - -2013-05-03 - Alex Cline 4.1.0 - * (#20548) Allow an array of resource titles to be passed into the ensure_resource function (e08734a) - -2013-05-02 - Raphaël Pinson - 4.1.0 - * Add a dirname function (2ba9e47) - -2013-04-29 - Mark Smith-Guerrero - 4.1.0 - * (maint) Fix a small typo in hash() description (928036a) - -2013-04-12 - Jeff McCune - 4.0.2 - * Update user information in gemspec to make the intent of the Gem clear. - -2013-04-11 - Jeff McCune - 4.0.1 - * Fix README function documentation (ab3e30c) - -2013-04-11 - Jeff McCune - 4.0.0 - * stdlib 4.0 drops support with Puppet 2.7 - * stdlib 4.0 preserves support with Puppet 3 - -2013-04-11 - Jeff McCune - 4.0.0 - * Add ability to use puppet from git via bundler (9c5805f) - -2013-04-10 - Jeff McCune - 4.0.0 - * (maint) Make stdlib usable as a Ruby GEM (e81a45e) - -2013-04-10 - Erik Dalén - 4.0.0 - * Add a count function (f28550e) - -2013-03-31 - Amos Shapira - 4.0.0 - * (#19998) Implement any2array (7a2fb80) - -2013-03-29 - Steve Huff - 4.0.0 - * (19864) num2bool match fix (8d217f0) - -2013-03-20 - Erik Dalén - 4.0.0 - * Allow comparisons of Numeric and number as String (ff5dd5d) - -2013-03-26 - Richard Soderberg - 4.0.0 - * add suffix function to accompany the prefix function (88a93ac) - -2013-03-19 - Kristof Willaert - 4.0.0 - * Add floor function implementation and unit tests (0527341) - -2012-04-03 - Eric Shamow - 4.0.0 - * (#13610) Add is_function_available to stdlib (961dcab) - -2012-12-17 - Justin Lambert - 4.0.0 - * str2bool should return a boolean if called with a boolean (5d5a4d4) - -2012-10-23 - Uwe Stuehler - 4.0.0 - * Fix number of arguments check in flatten() (e80207b) - -2013-03-11 - Jeff McCune - 4.0.0 - * Add contributing document (96e19d0) - -2013-03-04 - Raphaël Pinson - 4.0.0 - * Add missing documentation for validate_augeas and validate_cmd to README.markdown (a1510a1) - -2013-02-14 - Joshua Hoblitt - 4.0.0 - * (#19272) Add has_element() function (95cf3fe) - -2013-02-07 - Raphaël Pinson - 4.0.0 - * validate_cmd(): Use Puppet::Util::Execution.execute when available (69248df) - -2012-12-06 - Raphaël Pinson - 4.0.0 - * Add validate_augeas function (3a97c23) - -2012-12-06 - Raphaël Pinson - 4.0.0 - * Add validate_cmd function (6902cc5) - -2013-01-14 - David Schmitt - 4.0.0 - * Add geppetto project definition (b3fc0a3) - -2013-01-02 - Jaka Hudoklin - 4.0.0 - * Add getparam function to get defined resource parameters (20e0e07) - -2013-01-05 - Jeff McCune - 4.0.0 - * (maint) Add Travis CI Support (d082046) - -2012-12-04 - Jeff McCune - 4.0.0 - * Clarify that stdlib 3 supports Puppet 3 (3a6085f) - -2012-11-30 - Erik Dalén - 4.0.0 - * maint: style guideline fixes (7742e5f) - -2012-11-09 - James Fryman - 4.0.0 - * puppet-lint cleanup (88acc52) - -2012-11-06 - Joe Julian - 4.0.0 - * Add function, uriescape, to URI.escape strings. Redmine #17459 (fd52b8d) - -2012-09-18 - Chad Metcalf - 3.2.0 - * Add an ensure_packages function. (8a8c09e) - -2012-11-23 - Erik Dalén - 3.2.0 - * (#17797) min() and max() functions (9954133) - -2012-05-23 - Peter Meier - 3.2.0 - * (#14670) autorequire a file_line resource's path (dfcee63) - -2012-11-19 - Joshua Harlan Lifton - 3.2.0 - * Add join_keys_to_values function (ee0f2b3) - -2012-11-17 - Joshua Harlan Lifton - 3.2.0 - * Extend delete function for strings and hashes (7322e4d) - -2012-08-03 - Gary Larizza - 3.2.0 - * Add the pick() function (ba6dd13) - -2012-03-20 - Wil Cooley - 3.2.0 - * (#13974) Add predicate functions for interface facts (f819417) - -2012-11-06 - Joe Julian - 3.2.0 - * Add function, uriescape, to URI.escape strings. Redmine #17459 (70f4a0e) - -2012-10-25 - Jeff McCune - 3.1.1 - * (maint) Fix spec failures resulting from Facter API changes (97f836f) - -2012-10-23 - Matthaus Owens - 3.1.0 - * Add PE facts to stdlib (cdf3b05) - -2012-08-16 - Jeff McCune - 3.0.1 - * Fix accidental removal of facts_dot_d.rb in 3.0.0 release - -2012-08-16 - Jeff McCune - 3.0.0 - * stdlib 3.0 drops support with Puppet 2.6 - * stdlib 3.0 preserves support with Puppet 2.7 - -2012-08-07 - Dan Bode - 3.0.0 - * Add function ensure_resource and defined_with_params (ba789de) - -2012-07-10 - Hailee Kenney - 3.0.0 - * (#2157) Remove facter_dot_d for compatibility with external facts (f92574f) - -2012-04-10 - Chris Price - 3.0.0 - * (#13693) moving logic from local spec_helper to puppetlabs_spec_helper (85f96df) - -2012-10-25 - Jeff McCune - 2.5.1 - * (maint) Fix spec failures resulting from Facter API changes (97f836f) - -2012-10-23 - Matthaus Owens - 2.5.0 - * Add PE facts to stdlib (cdf3b05) - -2012-08-15 - Dan Bode - 2.5.0 - * Explicitly load functions used by ensure_resource (9fc3063) - -2012-08-13 - Dan Bode - 2.5.0 - * Add better docs about duplicate resource failures (97d327a) - -2012-08-13 - Dan Bode - 2.5.0 - * Handle undef for parameter argument (4f8b133) - -2012-08-07 - Dan Bode - 2.5.0 - * Add function ensure_resource and defined_with_params (a0cb8cd) - -2012-08-20 - Jeff McCune - 2.5.0 - * Disable tests that fail on 2.6.x due to #15912 (c81496e) - -2012-08-20 - Jeff McCune - 2.5.0 - * (Maint) Fix mis-use of rvalue functions as statements (4492913) - -2012-08-20 - Jeff McCune - 2.5.0 - * Add .rspec file to repo root (88789e8) - -2012-06-07 - Chris Price - 2.4.0 - * Add support for a 'match' parameter to file_line (a06c0d8) - -2012-08-07 - Erik Dalén - 2.4.0 - * (#15872) Add to_bytes function (247b69c) - -2012-07-19 - Jeff McCune - 2.4.0 - * (Maint) use PuppetlabsSpec::PuppetInternals.scope (master) (deafe88) - -2012-07-10 - Hailee Kenney - 2.4.0 - * (#2157) Make facts_dot_d compatible with external facts (5fb0ddc) - -2012-03-16 - Steve Traylen - 2.4.0 - * (#13205) Rotate array/string randomley based on fqdn, fqdn_rotate() (fef247b) - -2012-05-22 - Peter Meier - 2.3.3 - * fix regression in #11017 properly (f0a62c7) - -2012-05-10 - Jeff McCune - 2.3.3 - * Fix spec tests using the new spec_helper (7d34333) - -2012-05-10 - Puppet Labs - 2.3.2 - * Make file_line default to ensure => present (1373e70) - * Memoize file_line spec instance variables (20aacc5) - * Fix spec tests using the new spec_helper (1ebfa5d) - * (#13595) initialize_everything_for_tests couples modules Puppet ver (3222f35) - * (#13439) Fix MRI 1.9 issue with spec_helper (15c5fd1) - * (#13439) Fix test failures with Puppet 2.6.x (665610b) - * (#13439) refactor spec helper for compatibility with both puppet 2.7 and master (82194ca) - * (#13494) Specify the behavior of zero padded strings (61891bb) - -2012-03-29 Puppet Labs - 2.1.3 -* (#11607) Add Rakefile to enable spec testing -* (#12377) Avoid infinite loop when retrying require json - -2012-03-13 Puppet Labs - 2.3.1 -* (#13091) Fix LoadError bug with puppet apply and puppet_vardir fact - -2012-03-12 Puppet Labs - 2.3.0 -* Add a large number of new Puppet functions -* Backwards compatibility preserved with 2.2.x - -2011-12-30 Puppet Labs - 2.2.1 -* Documentation only release for the Forge - -2011-12-30 Puppet Labs - 2.1.2 -* Documentation only release for PE 2.0.x - -2011-11-08 Puppet Labs - 2.2.0 -* #10285 - Refactor json to use pson instead. -* Maint - Add watchr autotest script -* Maint - Make rspec tests work with Puppet 2.6.4 -* #9859 - Add root_home fact and tests - -2011-08-18 Puppet Labs - 2.1.1 -* Change facts.d paths to match Facter 2.0 paths. -* /etc/facter/facts.d -* /etc/puppetlabs/facter/facts.d - -2011-08-17 Puppet Labs - 2.1.0 -* Add R.I. Pienaar's facts.d custom facter fact -* facts defined in /etc/facts.d and /etc/puppetlabs/facts.d are - automatically loaded now. - -2011-08-04 Puppet Labs - 2.0.0 -* Rename whole_line to file_line -* This is an API change and as such motivating a 2.0.0 release according to semver.org. - -2011-08-04 Puppet Labs - 1.1.0 -* Rename append_line to whole_line -* This is an API change and as such motivating a 1.1.0 release. - -2011-08-04 Puppet Labs - 1.0.0 -* Initial stable release -* Add validate_array and validate_string functions -* Make merge() function work with Ruby 1.8.5 -* Add hash merging function -* Add has_key function -* Add loadyaml() function -* Add append_line native - -2011-06-21 Jeff McCune - 0.1.7 -* Add validate_hash() and getvar() functions - -2011-06-15 Jeff McCune - 0.1.6 -* Add anchor resource type to provide containment for composite classes - -2011-06-03 Jeff McCune - 0.1.5 -* Add validate_bool() function to stdlib - -0.1.4 2011-05-26 Jeff McCune -* Move most stages after main - -0.1.3 2011-05-25 Jeff McCune -* Add validate_re() function - -0.1.2 2011-05-24 Jeff McCune -* Update to add annotated tag - -0.1.1 2011-05-24 Jeff McCune -* Add stdlib::stages class with a standard set of stages diff --git a/puppet/modules/stdlib/CONTRIBUTING.md b/puppet/modules/stdlib/CONTRIBUTING.md deleted file mode 100644 index bd11f63..0000000 --- a/puppet/modules/stdlib/CONTRIBUTING.md +++ /dev/null @@ -1,65 +0,0 @@ -# How to contribute - -Third-party patches are essential for keeping stdlib great. We simply can't -access the huge number of platforms and myriad configurations for running -stdlib. We want to keep it as easy as possible to contribute changes that -get things working in your environment. There are a few guidelines that we -need contributors to follow so that we can have a chance of keeping on -top of things. - -## Getting Started - -* Make sure you have a [Redmine account](http://projects.puppetlabs.com) -* Make sure you have a [GitHub account](https://github.com/signup/free) -* Submit a ticket for your issue, assuming one does not already exist. - * Clearly describe the issue including steps to reproduce when it is a bug. - * Make sure you fill in the earliest version that you know has the issue. -* Fork the repository on GitHub - -## Making Changes - -* Create a topic branch from where you want to base your work. - * This is usually the master branch. - * Only target release branches if you are certain your fix must be on that - branch. - * To quickly create a topic branch based on master; `git branch - fix/master/my_contribution master` then checkout the new branch with `git - checkout fix/master/my_contribution`. Please avoid working directly on the - `master` branch. -* Make commits of logical units. -* Check for unnecessary whitespace with `git diff --check` before committing. -* Make sure your commit messages are in the proper format. - -```` - (#99999) Make the example in CONTRIBUTING imperative and concrete - - Without this patch applied the example commit message in the CONTRIBUTING - document is not a concrete example. This is a problem because the - contributor is left to imagine what the commit message should look like - based on a description rather than an example. This patch fixes the - problem by making the example concrete and imperative. - - The first line is a real life imperative statement with a ticket number - from our issue tracker. The body describes the behavior without the patch, - why this is a problem, and how the patch fixes the problem when applied. -```` - -* Make sure you have added the necessary tests for your changes. -* Run _all_ the tests to assure nothing else was accidentally broken. - -## Submitting Changes - -* Sign the [Contributor License Agreement](http://links.puppetlabs.com/cla). -* Push your changes to a topic branch in your fork of the repository. -* Submit a pull request to the repository in the puppetlabs organization. -* Update your Redmine ticket to mark that you have submitted code and are ready for it to be reviewed. - * Include a link to the pull request in the ticket - -# Additional Resources - -* [More information on contributing](http://links.puppetlabs.com/contribute-to-puppet) -* [Bug tracker (Redmine)](http://projects.puppetlabs.com) -* [Contributor License Agreement](http://links.puppetlabs.com/cla) -* [General GitHub documentation](http://help.github.com/) -* [GitHub pull request documentation](http://help.github.com/send-pull-requests/) -* #puppet-dev IRC channel on freenode.org diff --git a/puppet/modules/stdlib/Gemfile b/puppet/modules/stdlib/Gemfile deleted file mode 100644 index 197cc6b..0000000 --- a/puppet/modules/stdlib/Gemfile +++ /dev/null @@ -1,42 +0,0 @@ -source "https://rubygems.org" - -def location_for(place, fake_version = nil) - mdata = /^(git:[^#]*)#(.*)/.match(place) - if mdata - [fake_version, { :git => mdata[1], :branch => mdata[2], :require => false }].compact - elsif place =~ /^file:\/\/(.*)/ - ['>= 0', { :path => File.expand_path(mdata[1]), :require => false }] - else - [place, { :require => false }] - end -end - -group :development do - gem 'watchr' -end - -group :development, :test do - gem 'rake' - gem 'puppetmodule-stdlib', ">= 1.0.0", :path => File.expand_path("..", __FILE__) - gem 'rspec', "~> 2.11.0", :require => false - gem 'mocha', "~> 0.10.5", :require => false - gem 'puppetlabs_spec_helper', :require => false - gem 'rspec-puppet', :require => false -end - -facterversion = ENV['GEM_FACTER_VERSION'] -if facterversion - gem 'facter', *location_for(facterversion) -else - gem 'facter', :require => false -end - -ENV['GEM_PUPPET_VERSION'] ||= ENV['PUPPET_GEM_VERSION'] -puppetversion = ENV['GEM_PUPPET_VERSION'] -if puppetversion - gem 'puppet', *location_for(puppetversion) -else - gem 'puppet', :require => false -end - -# vim:ft=ruby diff --git a/puppet/modules/stdlib/LICENSE b/puppet/modules/stdlib/LICENSE deleted file mode 100644 index ec0587c..0000000 --- a/puppet/modules/stdlib/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2011 Puppet Labs Inc - -and some parts: - -Copyright (C) 2011 Krzysztof Wilczynski - -Puppet Labs can be contacted at: info@puppetlabs.com - -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. diff --git a/puppet/modules/stdlib/Modulefile b/puppet/modules/stdlib/Modulefile deleted file mode 100644 index 9d2e8c2..0000000 --- a/puppet/modules/stdlib/Modulefile +++ /dev/null @@ -1,11 +0,0 @@ -name 'puppetlabs-stdlib' -version '4.1.0' -source 'git://github.com/puppetlabs/puppetlabs-stdlib.git' -author 'puppetlabs' -license 'Apache 2.0' -summary 'Puppet Module Standard Library' -description 'Standard Library for Puppet Modules' -project_page 'https://github.com/puppetlabs/puppetlabs-stdlib' - -## Add dependencies, if any: -# dependency 'username/name', '>= 1.2.0' diff --git a/puppet/modules/stdlib/README.markdown b/puppet/modules/stdlib/README.markdown deleted file mode 100644 index 7b45b17..0000000 --- a/puppet/modules/stdlib/README.markdown +++ /dev/null @@ -1,1194 +0,0 @@ -# Puppet Labs Standard Library # - -[![Build Status](https://travis-ci.org/puppetlabs/puppetlabs-stdlib.png?branch=master)](https://travis-ci.org/puppetlabs/puppetlabs-stdlib) - -This module provides a "standard library" of resources for developing Puppet -Modules. This modules will include the following additions to Puppet - - * Stages - * Facts - * Functions - * Defined resource types - * Types - * Providers - -This module is officially curated and provided by Puppet Labs. The modules -Puppet Labs writes and distributes will make heavy use of this standard -library. - -To report or research a bug with any part of this module, please go to -[http://projects.puppetlabs.com/projects/stdlib](http://projects.puppetlabs.com/projects/stdlib) - -# Versions # - -This module follows semver.org (v1.0.0) versioning guidelines. The standard -library module is released as part of [Puppet -Enterprise](http://puppetlabs.com/puppet/puppet-enterprise/) and as a result -older versions of Puppet Enterprise that Puppet Labs still supports will have -bugfix maintenance branches periodically "merged up" into master. The current -list of integration branches are: - - * v2.1.x (v2.1.1 released in PE 1) - * v2.2.x (Never released as part of PE, only to the Forge) - * v2.3.x (Released in PE 2) - * v3.0.x (Never released as part of PE, only to the Forge) - * v4.0.x (Drops support for Puppet 2.7) - * master (mainline development branch) - -The first Puppet Enterprise version including the stdlib module is Puppet -Enterprise 1.2. - -# Compatibility # - -Puppet Versions | < 2.6 | 2.6 | 2.7 | 3.x | -:---------------|:-----:|:---:|:---:|:----: -**stdlib 2.x** | no | **yes** | **yes** | no -**stdlib 3.x** | no | no | **yes** | **yes** -**stdlib 4.x** | no | no | no | **yes** - -The stdlib module does not work with Puppet versions released prior to Puppet -2.6.0. - -## stdlib 2.x ## - -All stdlib releases in the 2.0 major version support Puppet 2.6 and Puppet 2.7. - -## stdlib 3.x ## - -The 3.0 major release of stdlib drops support for Puppet 2.6. Stdlib 3.x -supports Puppet 2 and Puppet 3. - -## stdlib 4.x ## - -The 4.0 major release of stdlib drops support for Puppet 2.7. Stdlib 4.x -supports Puppet 3. Notably, ruby 1.8.5 is no longer supported though ruby -1.8.7, 1.9.3, and 2.0.0 are fully supported. - -# Functions # - -abs ---- -Returns the absolute value of a number, for example -34.56 becomes -34.56. Takes a single integer and float value as an argument. - - -- *Type*: rvalue - -any2array ---------- -This converts any object to an array containing that object. Empty argument -lists are converted to an empty array. Arrays are left untouched. Hashes are -converted to arrays of alternating keys and values. - - -- *Type*: rvalue - -bool2num --------- -Converts a boolean to a number. Converts the values: -false, f, 0, n, and no to 0 -true, t, 1, y, and yes to 1 - Requires a single boolean or string as an input. - - -- *Type*: rvalue - -capitalize ----------- -Capitalizes the first letter of a string or array of strings. -Requires either a single string or an array as an input. - - -- *Type*: rvalue - -chomp ------ -Removes the record separator from the end of a string or an array of -strings, for example `hello\n` becomes `hello`. -Requires a single string or array as an input. - - -- *Type*: rvalue - -chop ----- -Returns a new string with the last character removed. If the string ends -with `\r\n`, both characters are removed. Applying chop to an empty -string returns an empty string. If you wish to merely remove record -separators then you should use the `chomp` function. -Requires a string or array of strings as input. - - -- *Type*: rvalue - -concat ------- -Appends the contents of array 2 onto array 1. - -*Example:* - - concat(['1','2','3'],['4','5','6']) - -Would result in: - - ['1','2','3','4','5','6'] - - -- *Type*: rvalue - -count ------ -Takes an array as first argument and an optional second argument. -Count the number of elements in array that matches second argument. -If called with only an array it counts the number of elements that are not nil/undef. - - -- *Type*: rvalue - -defined_with_params -------------------- -Takes a resource reference and an optional hash of attributes. - -Returns true if a resource with the specified attributes has already been added -to the catalog, and false otherwise. - - user { 'dan': - ensure => present, - } - - if ! defined_with_params(User[dan], {'ensure' => 'present' }) { - user { 'dan': ensure => present, } - } - - -- *Type*: rvalue - -delete ------- -Deletes all instances of a given element from an array, substring from a -string, or key from a hash. - -*Examples:* - - delete(['a','b','c','b'], 'b') - Would return: ['a','c'] - - delete({'a'=>1,'b'=>2,'c'=>3}, 'b') - Would return: {'a'=>1,'c'=>3} - - delete('abracadabra', 'bra') - Would return: 'acada' - - -- *Type*: rvalue - -delete_at ---------- -Deletes a determined indexed value from an array. - -*Examples:* - - delete_at(['a','b','c'], 1) - -Would return: ['a','c'] - - -- *Type*: rvalue - -dirname -------- -Returns the `dirname` of a path. - -*Examples:* - - dirname('/path/to/a/file.ext') - -Would return: '/path/to/a' - -downcase --------- -Converts the case of a string or all strings in an array to lower case. - - -- *Type*: rvalue - -empty ------ -Returns true if the variable is empty. - - -- *Type*: rvalue - -ensure_packages ---------------- -Takes a list of packages and only installs them if they don't already exist. - - -- *Type*: statement - -ensure_resource ---------------- -Takes a resource type, title, and a list of attributes that describe a -resource. - - user { 'dan': - ensure => present, - } - -This example only creates the resource if it does not already exist: - - ensure_resource('user, 'dan', {'ensure' => 'present' }) - -If the resource already exists but does not match the specified parameters, -this function will attempt to recreate the resource leading to a duplicate -resource definition error. - -An array of resources can also be passed in and each will be created with -the type and parameters specified if it doesn't already exist. - - ensure_resource('user', ['dan','alex'], {'ensure' => 'present'}) - - - -- *Type*: statement - -flatten -------- -This function flattens any deeply nested arrays and returns a single flat array -as a result. - -*Examples:* - - flatten(['a', ['b', ['c']]]) - -Would return: ['a','b','c'] - - -- *Type*: rvalue - -floor ------ -Returns the largest integer less or equal to the argument. -Takes a single numeric value as an argument. - - -- *Type*: rvalue - -fqdn_rotate ------------ -Rotates an array a random number of times based on a nodes fqdn. - - -- *Type*: rvalue - -get_module_path ---------------- -Returns the absolute path of the specified module for the current -environment. - -Example: - $module_path = get_module_path('stdlib') - - -- *Type*: rvalue - -getparam --------- -Takes a resource reference and name of the parameter and -returns value of resource's parameter. - -*Examples:* - - define example_resource($param) { - } - - example_resource { "example_resource_instance": - param => "param_value" - } - - getparam(Example_resource["example_resource_instance"], "param") - -Would return: param_value - - -- *Type*: rvalue - -getvar ------- -Lookup a variable in a remote namespace. - -For example: - - $foo = getvar('site::data::foo') - # Equivalent to $foo = $site::data::foo - -This is useful if the namespace itself is stored in a string: - - $datalocation = 'site::data' - $bar = getvar("${datalocation}::bar") - # Equivalent to $bar = $site::data::bar - - -- *Type*: rvalue - -grep ----- -This function searches through an array and returns any elements that match -the provided regular expression. - -*Examples:* - - grep(['aaa','bbb','ccc','aaaddd'], 'aaa') - -Would return: - - ['aaa','aaaddd'] - - -- *Type*: rvalue - -has_interface_with ------------------- -Returns boolean based on kind and value: -* macaddress -* netmask -* ipaddress -* network - -has_interface_with("macaddress", "x:x:x:x:x:x") -has_interface_with("ipaddress", "127.0.0.1") => true -etc. - -If no "kind" is given, then the presence of the interface is checked: -has_interface_with("lo") => true - - -- *Type*: rvalue - -has_ip_address --------------- -Returns true if the client has the requested IP address on some interface. - -This function iterates through the 'interfaces' fact and checks the -'ipaddress_IFACE' facts, performing a simple string comparison. - - -- *Type*: rvalue - -has_ip_network --------------- -Returns true if the client has an IP address within the requested network. - -This function iterates through the 'interfaces' fact and checks the -'network_IFACE' facts, performing a simple string comparision. - - -- *Type*: rvalue - -has_key -------- -Determine if a hash has a certain key value. - -Example: - - $my_hash = {'key_one' => 'value_one'} - if has_key($my_hash, 'key_two') { - notice('we will not reach here') - } - if has_key($my_hash, 'key_one') { - notice('this will be printed') - } - - - -- *Type*: rvalue - -hash ----- -This function converts an array into a hash. - -*Examples:* - - hash(['a',1,'b',2,'c',3]) - -Would return: {'a'=>1,'b'=>2,'c'=>3} - - -- *Type*: rvalue - -is_array --------- -Returns true if the variable passed to this function is an array. - -- *Type*: rvalue - -is_domain_name --------------- -Returns true if the string passed to this function is a syntactically correct domain name. - -- *Type*: rvalue - -is_float --------- -Returns true if the variable passed to this function is a float. - -- *Type*: rvalue - -is_function_available ---------------------- -This function accepts a string as an argument, determines whether the -Puppet runtime has access to a function by that name. It returns a -true if the function exists, false if not. - -- *Type*: rvalue - -is_hash -------- -Returns true if the variable passed to this function is a hash. - -- *Type*: rvalue - -is_integer ----------- -Returns true if the variable returned to this string is an integer. - -- *Type*: rvalue - -is_ip_address -------------- -Returns true if the string passed to this function is a valid IP address. - -- *Type*: rvalue - -is_mac_address --------------- -Returns true if the string passed to this function is a valid mac address. - -- *Type*: rvalue - -is_numeric ----------- -Returns true if the variable passed to this function is a number. - -- *Type*: rvalue - -is_string ---------- -Returns true if the variable passed to this function is a string. - -- *Type*: rvalue - -join ----- -This function joins an array into a string using a seperator. - -*Examples:* - - join(['a','b','c'], ",") - -Would result in: "a,b,c" - -- *Type*: rvalue - -join_keys_to_values -------------------- -This function joins each key of a hash to that key's corresponding value with a -separator. Keys and values are cast to strings. The return value is an array in -which each element is one joined key/value pair. - -*Examples:* - - join_keys_to_values({'a'=>1,'b'=>2}, " is ") - -Would result in: ["a is 1","b is 2"] - -- *Type*: rvalue - -keys ----- -Returns the keys of a hash as an array. - -- *Type*: rvalue - -loadyaml --------- -Load a YAML file containing an array, string, or hash, and return the data -in the corresponding native data type. - -For example: - - $myhash = loadyaml('/etc/puppet/data/myhash.yaml') - - -- *Type*: rvalue - -lstrip ------- -Strips leading spaces to the left of a string. - -- *Type*: rvalue - -max ---- -Returns the highest value of all arguments. -Requires at least one argument. - -- *Type*: rvalue - -member ------- -This function determines if a variable is a member of an array. - -*Examples:* - - member(['a','b'], 'b') - -Would return: true - - member(['a','b'], 'c') - -Would return: false - -- *Type*: rvalue - -merge ------ -Merges two or more hashes together and returns the resulting hash. - -For example: - - $hash1 = {'one' => 1, 'two', => 2} - $hash2 = {'two' => 'dos', 'three', => 'tres'} - $merged_hash = merge($hash1, $hash2) - # The resulting hash is equivalent to: - # $merged_hash = {'one' => 1, 'two' => 'dos', 'three' => 'tres'} - -When there is a duplicate key, the key in the rightmost hash will "win." - -- *Type*: rvalue - -min ---- -Returns the lowest value of all arguments. -Requires at least one argument. - -- *Type*: rvalue - -num2bool --------- -This function converts a number or a string representation of a number into a -true boolean. Zero or anything non-numeric becomes false. Numbers higher then 0 -become true. - -- *Type*: rvalue - -parsejson ---------- -This function accepts JSON as a string and converts into the correct Puppet -structure. - -- *Type*: rvalue - -parseyaml ---------- -This function accepts YAML as a string and converts it into the correct -Puppet structure. - -- *Type*: rvalue - -pick ----- -This function is similar to a coalesce function in SQL in that it will return -the first value in a list of values that is not undefined or an empty string -(two things in Puppet that will return a boolean false value). Typically, -this function is used to check for a value in the Puppet Dashboard/Enterprise -Console, and failover to a default value like the following: - - $real_jenkins_version = pick($::jenkins_version, '1.449') - -The value of $real_jenkins_version will first look for a top-scope variable -called 'jenkins_version' (note that parameters set in the Puppet Dashboard/ -Enterprise Console are brought into Puppet as top-scope variables), and, -failing that, will use a default value of 1.449. - -- *Type*: rvalue - -prefix ------- -This function applies a prefix to all elements in an array. - -*Examples:* - - prefix(['a','b','c'], 'p') - -Will return: ['pa','pb','pc'] - -- *Type*: rvalue - -range ------ -When given range in the form of (start, stop) it will extrapolate a range as -an array. - -*Examples:* - - range("0", "9") - -Will return: [0,1,2,3,4,5,6,7,8,9] - - range("00", "09") - -Will return: [0,1,2,3,4,5,6,7,8,9] (Zero padded strings are converted to -integers automatically) - - range("a", "c") - -Will return: ["a","b","c"] - - range("host01", "host10") - -Will return: ["host01", "host02", ..., "host09", "host10"] - -- *Type*: rvalue - -reject ------- -This function searches through an array and rejects all elements that match -the provided regular expression. - -*Examples:* - - reject(['aaa','bbb','ccc','aaaddd'], 'aaa') - -Would return: - - ['bbb','ccc'] - - -- *Type*: rvalue - -reverse -------- -Reverses the order of a string or array. - -- *Type*: rvalue - -rstrip ------- -Strips leading spaces to the right of the string. - -- *Type*: rvalue - -shuffle -------- -Randomizes the order of a string or array elements. - -- *Type*: rvalue - -size ----- -Returns the number of elements in a string or array. - -- *Type*: rvalue - -sort ----- -Sorts strings and arrays lexically. - -- *Type*: rvalue - -squeeze -------- -Returns a new string where runs of the same character that occur in this set -are replaced by a single character. - -- *Type*: rvalue - -str2bool --------- -This converts a string to a boolean. This attempt to convert strings that -contain things like: y, 1, t, true to 'true' and strings that contain things -like: 0, f, n, false, no to 'false'. - - -- *Type*: rvalue - -str2saltedsha512 ----------------- -This converts a string to a salted-SHA512 password hash (which is used for -OS X versions >= 10.7). Given any simple string, you will get a hex version -of a salted-SHA512 password hash that can be inserted into your Puppet -manifests as a valid password attribute. - - -- *Type*: rvalue - -strftime --------- -This function returns formatted time. - -*Examples:* - -To return the time since epoch: - - strftime("%s") - -To return the date: - - strftime("%Y-%m-%d") - -*Format meaning:* - - %a - The abbreviated weekday name (``Sun'') - %A - The full weekday name (``Sunday'') - %b - The abbreviated month name (``Jan'') - %B - The full month name (``January'') - %c - The preferred local date and time representation - %C - Century (20 in 2009) - %d - Day of the month (01..31) - %D - Date (%m/%d/%y) - %e - Day of the month, blank-padded ( 1..31) - %F - Equivalent to %Y-%m-%d (the ISO 8601 date format) - %h - Equivalent to %b - %H - Hour of the day, 24-hour clock (00..23) - %I - Hour of the day, 12-hour clock (01..12) - %j - Day of the year (001..366) - %k - hour, 24-hour clock, blank-padded ( 0..23) - %l - hour, 12-hour clock, blank-padded ( 0..12) - %L - Millisecond of the second (000..999) - %m - Month of the year (01..12) - %M - Minute of the hour (00..59) - %n - Newline ( -) - %N - Fractional seconds digits, default is 9 digits (nanosecond) - %3N millisecond (3 digits) - %6N microsecond (6 digits) - %9N nanosecond (9 digits) - %p - Meridian indicator (``AM'' or ``PM'') - %P - Meridian indicator (``am'' or ``pm'') - %r - time, 12-hour (same as %I:%M:%S %p) - %R - time, 24-hour (%H:%M) - %s - Number of seconds since 1970-01-01 00:00:00 UTC. - %S - Second of the minute (00..60) - %t - Tab character ( ) - %T - time, 24-hour (%H:%M:%S) - %u - Day of the week as a decimal, Monday being 1. (1..7) - %U - Week number of the current year, - starting with the first Sunday as the first - day of the first week (00..53) - %v - VMS date (%e-%b-%Y) - %V - Week number of year according to ISO 8601 (01..53) - %W - Week number of the current year, - starting with the first Monday as the first - day of the first week (00..53) - %w - Day of the week (Sunday is 0, 0..6) - %x - Preferred representation for the date alone, no time - %X - Preferred representation for the time alone, no date - %y - Year without a century (00..99) - %Y - Year with century - %z - Time zone as hour offset from UTC (e.g. +0900) - %Z - Time zone name - %% - Literal ``%'' character - - -- *Type*: rvalue - -strip ------ -This function removes leading and trailing whitespace from a string or from -every string inside an array. - -*Examples:* - - strip(" aaa ") - -Would result in: "aaa" - - -- *Type*: rvalue - -suffix ------- -This function applies a suffix to all elements in an array. - -*Examples:* - - suffix(['a','b','c'], 'p') - -Will return: ['ap','bp','cp'] - - -- *Type*: rvalue - -swapcase --------- -This function will swap the existing case of a string. - -*Examples:* - - swapcase("aBcD") - -Would result in: "AbCd" - - -- *Type*: rvalue - -time ----- -This function will return the current time since epoch as an integer. - -*Examples:* - - time() - -Will return something like: 1311972653 - - -- *Type*: rvalue - -to_bytes --------- -Converts the argument into bytes, for example 4 kB becomes 4096. -Takes a single string value as an argument. - - -- *Type*: rvalue - -type ----- -Returns the type when passed a variable. Type can be one of: - -* string -* array -* hash -* float -* integer -* boolean - - -- *Type*: rvalue - -unique ------- -This function will remove duplicates from strings and arrays. - -*Examples:* - - unique("aabbcc") - -Will return: - - abc - -You can also use this with arrays: - - unique(["a","a","b","b","c","c"]) - -This returns: - - ["a","b","c"] - - -- *Type*: rvalue - -upcase ------- -Converts a string or an array of strings to uppercase. - -*Examples:* - - upcase("abcd") - -Will return: - - ASDF - - -- *Type*: rvalue - -uriescape ---------- -Urlencodes a string or array of strings. -Requires either a single string or an array as an input. - - -- *Type*: rvalue - -validate_absolute_path ----------------------- -Validate the string represents an absolute path in the filesystem. This function works -for windows and unix style paths. - -The following values will pass: - - $my_path = "C:/Program Files (x86)/Puppet Labs/Puppet" - validate_absolute_path($my_path) - $my_path2 = "/var/lib/puppet" - validate_absolute_path($my_path2) - - -The following values will fail, causing compilation to abort: - - validate_absolute_path(true) - validate_absolute_path([ 'var/lib/puppet', '/var/foo' ]) - validate_absolute_path([ '/var/lib/puppet', 'var/foo' ]) - $undefined = undef - validate_absolute_path($undefined) - - - -- *Type*: statement - -validate_array --------------- -Validate that all passed values are array data structures. Abort catalog -compilation if any value fails this check. - -The following values will pass: - - $my_array = [ 'one', 'two' ] - validate_array($my_array) - -The following values will fail, causing compilation to abort: - - validate_array(true) - validate_array('some_string') - $undefined = undef - validate_array($undefined) - - - -- *Type*: statement - -validate_augeas ---------------- -Perform validation of a string using an Augeas lens -The first argument of this function should be a string to -test, and the second argument should be the name of the Augeas lens to use. -If Augeas fails to parse the string with the lens, the compilation will -abort with a parse error. - -A third argument can be specified, listing paths which should -not be found in the file. The `$file` variable points to the location -of the temporary file being tested in the Augeas tree. - -For example, if you want to make sure your passwd content never contains -a user `foo`, you could write: - - validate_augeas($passwdcontent, 'Passwd.lns', ['$file/foo']) - -Or if you wanted to ensure that no users used the '/bin/barsh' shell, -you could use: - - validate_augeas($passwdcontent, 'Passwd.lns', ['$file/*[shell="/bin/barsh"]'] - -If a fourth argument is specified, this will be the error message raised and -seen by the user. - -A helpful error message can be returned like this: - - validate_augeas($sudoerscontent, 'Sudoers.lns', [], 'Failed to validate sudoers content with Augeas') - - - -- *Type*: statement - -validate_bool -------------- -Validate that all passed values are either true or false. Abort catalog -compilation if any value fails this check. - -The following values will pass: - - $iamtrue = true - validate_bool(true) - validate_bool(true, true, false, $iamtrue) - -The following values will fail, causing compilation to abort: - - $some_array = [ true ] - validate_bool("false") - validate_bool("true") - validate_bool($some_array) - - - -- *Type*: statement - -validate_cmd ------------- -Perform validation of a string with an external command. -The first argument of this function should be a string to -test, and the second argument should be a path to a test command -taking a file as last argument. If the command, launched against -a tempfile containing the passed string, returns a non-null value, -compilation will abort with a parse error. - -If a third argument is specified, this will be the error message raised and -seen by the user. - -A helpful error message can be returned like this: - -Example: - - validate_cmd($sudoerscontent, '/usr/sbin/visudo -c -f', 'Visudo failed to validate sudoers content') - - - -- *Type*: statement - -validate_hash -------------- -Validate that all passed values are hash data structures. Abort catalog -compilation if any value fails this check. - -The following values will pass: - - $my_hash = { 'one' => 'two' } - validate_hash($my_hash) - -The following values will fail, causing compilation to abort: - - validate_hash(true) - validate_hash('some_string') - $undefined = undef - validate_hash($undefined) - - - -- *Type*: statement - -validate_re ------------ -Perform simple validation of a string against one or more regular -expressions. The first argument of this function should be a string to -test, and the second argument should be a stringified regular expression -(without the // delimiters) or an array of regular expressions. If none -of the regular expressions match the string passed in, compilation will -abort with a parse error. - -If a third argument is specified, this will be the error message raised and -seen by the user. - -The following strings will validate against the regular expressions: - - validate_re('one', '^one$') - validate_re('one', [ '^one', '^two' ]) - -The following strings will fail to validate, causing compilation to abort: - - validate_re('one', [ '^two', '^three' ]) - -A helpful error message can be returned like this: - - validate_re($::puppetversion, '^2.7', 'The $puppetversion fact value does not match 2.7') - - - -- *Type*: statement - -validate_slength ----------------- -Validate that the first argument is a string (or an array of strings), and -less/equal to than the length of the second argument. It fails if the first -argument is not a string or array of strings, and if arg 2 is not convertable -to a number. - -The following values will pass: - - validate_slength("discombobulate",17) - validate_slength(["discombobulate","moo"],17) - -The following valueis will not: - - validate_slength("discombobulate",1) - validate_slength(["discombobulate","thermometer"],5) - - - -- *Type*: statement - -validate_string ---------------- -Validate that all passed values are string data structures. Abort catalog -compilation if any value fails this check. - -The following values will pass: - - $my_string = "one two" - validate_string($my_string, 'three') - -The following values will fail, causing compilation to abort: - - validate_string(true) - validate_string([ 'some', 'array' ]) - $undefined = undef - validate_string($undefined) - - -- *Type*: statement - -values ------- -When given a hash this function will return the values of that hash. - -*Examples:* - - $hash = { - 'a' => 1, - 'b' => 2, - 'c' => 3, - } - values($hash) - -This example would return: - - [1,2,3] - - -- *Type*: rvalue - -values_at ---------- -Finds value inside an array based on location. - -The first argument is the array you want to analyze, and the second element can -be a combination of: - -* A single numeric index -* A range in the form of 'start-stop' (eg. 4-9) -* An array combining the above - -*Examples*: - - values_at(['a','b','c'], 2) - -Would return ['c']. - - values_at(['a','b','c'], ["0-1"]) - -Would return ['a','b']. - - values_at(['a','b','c','d','e'], [0, "2-3"]) - -Would return ['a','c','d']. - - -- *Type*: rvalue - -zip ---- -Takes one element from first array and merges corresponding elements from second array. This generates a sequence of n-element arrays, where n is one more than the count of arguments. - -*Example:* - - zip(['1','2','3'],['4','5','6']) - -Would result in: - - ["1", "4"], ["2", "5"], ["3", "6"] - - -- *Type*: rvalue - -*This page autogenerated on 2013-04-11 13:54:25 -0700* diff --git a/puppet/modules/stdlib/README_DEVELOPER.markdown b/puppet/modules/stdlib/README_DEVELOPER.markdown deleted file mode 100644 index 04349ed..0000000 --- a/puppet/modules/stdlib/README_DEVELOPER.markdown +++ /dev/null @@ -1,35 +0,0 @@ -Puppet Specific Facts -===================== - -Facter is meant to stand alone and apart from Puppet. However, Facter often -runs inside Puppet and all custom facts included in the stdlib module will -almost always be evaluated in the context of Puppet and Facter working -together. - -Still, we don't want to write custom facts that blow up in the users face if -Puppet is not loaded in memory. This is often the case if the user runs -`facter` without also supplying the `--puppet` flag. - -Ah! But Jeff, the custom fact won't be in the `$LOAD_PATH` unless the user -supplies `--facter`! You might say... - -Not (always) true I say! If the user happens to have a CWD of -`/stdlib/lib` then the facts will automatically be evaluated and -blow up. - -In any event, it's pretty easy to write a fact that has no value if Puppet is -not loaded. Simply do it like this: - - Facter.add(:node_vardir) do - setcode do - # This will be nil if Puppet is not available. - Facter::Util::PuppetSettings.with_puppet do - Puppet[:vardir] - end - end - end - -The `Facter::Util::PuppetSettings.with_puppet` method accepts a block and -yields to it only if the Puppet library is loaded. If the Puppet library is -not loaded, then the method silently returns `nil` which Facter interprets as -an undefined fact value. The net effect is that the fact won't be set. diff --git a/puppet/modules/stdlib/README_SPECS.markdown b/puppet/modules/stdlib/README_SPECS.markdown deleted file mode 100644 index 917b631..0000000 --- a/puppet/modules/stdlib/README_SPECS.markdown +++ /dev/null @@ -1,7 +0,0 @@ -NOTE -==== - -This project's specs depend on puppet core, and thus they require the -`puppetlabs_spec_helper` project. For more information please see the README -in that project, which can be found here: [puppetlabs spec -helper](https://github.com/puppetlabs/puppetlabs_spec_helper) diff --git a/puppet/modules/stdlib/RELEASE_PROCESS.markdown b/puppet/modules/stdlib/RELEASE_PROCESS.markdown deleted file mode 100644 index 0f9328e..0000000 --- a/puppet/modules/stdlib/RELEASE_PROCESS.markdown +++ /dev/null @@ -1,24 +0,0 @@ -# Contributing to this module # - - * Work in a topic branch - * Submit a github pull request - * Address any comments / feeback - * Merge into master using --no-ff - -# Releasing this module # - - * This module adheres to http://semver.org/ - * Look for API breaking changes using git diff vX.Y.Z..master - * If no API breaking changes, the minor version may be bumped. - * If there are API breaking changes, the major version must be bumped. - * If there are only small minor changes, the patch version may be bumped. - * Update the CHANGELOG - * Update the Modulefile - * Commit these changes with a message along the lines of "Update CHANGELOG and - Modulefile for release" - * Create an annotated tag with git tag -a vX.Y.Z -m 'version X.Y.Z' (NOTE the - leading v as per semver.org) - * Push the tag with git push origin --tags - * Build a new package with puppet-module or the rake build task if it exists - * Publish the new package to the forge - * Bonus points for an announcement to puppet-users. diff --git a/puppet/modules/stdlib/Rakefile b/puppet/modules/stdlib/Rakefile deleted file mode 100644 index 14f1c24..0000000 --- a/puppet/modules/stdlib/Rakefile +++ /dev/null @@ -1,2 +0,0 @@ -require 'rubygems' -require 'puppetlabs_spec_helper/rake_tasks' diff --git a/puppet/modules/stdlib/lib/facter/facter_dot_d.rb b/puppet/modules/stdlib/lib/facter/facter_dot_d.rb deleted file mode 100644 index e414b20..0000000 --- a/puppet/modules/stdlib/lib/facter/facter_dot_d.rb +++ /dev/null @@ -1,202 +0,0 @@ -# A Facter plugin that loads facts from /etc/facter/facts.d -# and /etc/puppetlabs/facter/facts.d. -# -# Facts can be in the form of JSON, YAML or Text files -# and any executable that returns key=value pairs. -# -# In the case of scripts you can also create a file that -# contains a cache TTL. For foo.sh store the ttl as just -# a number in foo.sh.ttl -# -# The cache is stored in /tmp/facts_cache.yaml as a mode -# 600 file and will have the end result of not calling your -# fact scripts more often than is needed - -class Facter::Util::DotD - require 'yaml' - - def initialize(dir="/etc/facts.d", cache_file="/tmp/facts_cache.yml") - @dir = dir - @cache_file = cache_file - @cache = nil - @types = {".txt" => :txt, ".json" => :json, ".yaml" => :yaml} - end - - def entries - Dir.entries(@dir).reject{|f| f =~ /^\.|\.ttl$/}.sort.map {|f| File.join(@dir, f) } - rescue - [] - end - - def fact_type(file) - extension = File.extname(file) - - type = @types[extension] || :unknown - - type = :script if type == :unknown && File.executable?(file) - - return type - end - - def txt_parser(file) - File.readlines(file).each do |line| - if line =~ /^(.+)=(.+)$/ - var = $1; val = $2 - - Facter.add(var) do - setcode { val } - end - end - end - rescue Exception => e - Facter.warn("Failed to handle #{file} as text facts: #{e.class}: #{e}") - end - - def json_parser(file) - begin - require 'json' - rescue LoadError - retry if require 'rubygems' - raise - end - - JSON.load(File.read(file)).each_pair do |f, v| - Facter.add(f) do - setcode { v } - end - end - rescue Exception => e - Facter.warn("Failed to handle #{file} as json facts: #{e.class}: #{e}") - end - - def yaml_parser(file) - require 'yaml' - - YAML.load_file(file).each_pair do |f, v| - Facter.add(f) do - setcode { v } - end - end - rescue Exception => e - Facter.warn("Failed to handle #{file} as yaml facts: #{e.class}: #{e}") - end - - def script_parser(file) - result = cache_lookup(file) - ttl = cache_time(file) - - unless result - result = Facter::Util::Resolution.exec(file) - - if ttl > 0 - Facter.debug("Updating cache for #{file}") - cache_store(file, result) - cache_save! - end - else - Facter.debug("Using cached data for #{file}") - end - - result.split("\n").each do |line| - if line =~ /^(.+)=(.+)$/ - var = $1; val = $2 - - Facter.add(var) do - setcode { val } - end - end - end - rescue Exception => e - Facter.warn("Failed to handle #{file} as script facts: #{e.class}: #{e}") - Facter.debug(e.backtrace.join("\n\t")) - end - - def cache_save! - cache = load_cache - File.open(@cache_file, "w", 0600) {|f| f.write(YAML.dump(cache)) } - rescue - end - - def cache_store(file, data) - load_cache - - @cache[file] = {:data => data, :stored => Time.now.to_i} - rescue - end - - def cache_lookup(file) - cache = load_cache - - return nil if cache.empty? - - ttl = cache_time(file) - - if cache[file] - now = Time.now.to_i - - return cache[file][:data] if ttl == -1 - return cache[file][:data] if (now - cache[file][:stored]) <= ttl - return nil - else - return nil - end - rescue - return nil - end - - def cache_time(file) - meta = file + ".ttl" - - return File.read(meta).chomp.to_i - rescue - return 0 - end - - def load_cache - unless @cache - if File.exist?(@cache_file) - @cache = YAML.load_file(@cache_file) - else - @cache = {} - end - end - - return @cache - rescue - @cache = {} - return @cache - end - - def create - entries.each do |fact| - type = fact_type(fact) - parser = "#{type}_parser" - - if respond_to?("#{type}_parser") - Facter.debug("Parsing #{fact} using #{parser}") - - send(parser, fact) - end - end - end -end - - -mdata = Facter.version.match(/(\d+)\.(\d+)\.(\d+)/) -if mdata - (major, minor, patch) = mdata.captures.map { |v| v.to_i } - if major < 2 - # Facter 1.7 introduced external facts support directly - unless major == 1 and minor > 6 - Facter::Util::DotD.new("/etc/facter/facts.d").create - Facter::Util::DotD.new("/etc/puppetlabs/facter/facts.d").create - - # Windows has a different configuration directory that defaults to a vendor - # specific sub directory of the %COMMON_APPDATA% directory. - if Dir.const_defined? 'COMMON_APPDATA' then - windows_facts_dot_d = File.join(Dir::COMMON_APPDATA, 'PuppetLabs', 'facter', 'facts.d') - Facter::Util::DotD.new(windows_facts_dot_d).create - end - end - end -end diff --git a/puppet/modules/stdlib/lib/facter/pe_version.rb b/puppet/modules/stdlib/lib/facter/pe_version.rb deleted file mode 100644 index 0cc0f64..0000000 --- a/puppet/modules/stdlib/lib/facter/pe_version.rb +++ /dev/null @@ -1,53 +0,0 @@ -# Fact: is_pe, pe_version, pe_major_version, pe_minor_version, pe_patch_version -# -# Purpose: Return various facts about the PE state of the system -# -# Resolution: Uses a regex match against puppetversion to determine whether the -# machine has Puppet Enterprise installed, and what version (overall, major, -# minor, patch) is installed. -# -# Caveats: -# -Facter.add("pe_version") do - setcode do - pe_ver = Facter.value("puppetversion").match(/Puppet Enterprise (\d+\.\d+\.\d+)/) - pe_ver[1] if pe_ver - end -end - -Facter.add("is_pe") do - setcode do - if Facter.value(:pe_version).to_s.empty? then - false - else - true - end - end -end - -Facter.add("pe_major_version") do - confine :is_pe => true - setcode do - if pe_version = Facter.value(:pe_version) - pe_version.to_s.split('.')[0] - end - end -end - -Facter.add("pe_minor_version") do - confine :is_pe => true - setcode do - if pe_version = Facter.value(:pe_version) - pe_version.to_s.split('.')[1] - end - end -end - -Facter.add("pe_patch_version") do - confine :is_pe => true - setcode do - if pe_version = Facter.value(:pe_version) - pe_version.to_s.split('.')[2] - end - end -end diff --git a/puppet/modules/stdlib/lib/facter/puppet_vardir.rb b/puppet/modules/stdlib/lib/facter/puppet_vardir.rb deleted file mode 100644 index 0e6af40..0000000 --- a/puppet/modules/stdlib/lib/facter/puppet_vardir.rb +++ /dev/null @@ -1,26 +0,0 @@ -# This facter fact returns the value of the Puppet vardir setting for the node -# running puppet or puppet agent. The intent is to enable Puppet modules to -# automatically have insight into a place where they can place variable data, -# regardless of the node's platform. -# -# The value should be directly usable in a File resource path attribute. - - -begin - require 'facter/util/puppet_settings' -rescue LoadError => e - # puppet apply does not add module lib directories to the $LOAD_PATH (See - # #4248). It should (in the future) but for the time being we need to be - # defensive which is what this rescue block is doing. - rb_file = File.join(File.dirname(__FILE__), 'util', 'puppet_settings.rb') - load rb_file if File.exists?(rb_file) or raise e -end - -Facter.add(:puppet_vardir) do - setcode do - # This will be nil if Puppet is not available. - Facter::Util::PuppetSettings.with_puppet do - Puppet[:vardir] - end - end -end diff --git a/puppet/modules/stdlib/lib/facter/root_home.rb b/puppet/modules/stdlib/lib/facter/root_home.rb deleted file mode 100644 index 8249f7d..0000000 --- a/puppet/modules/stdlib/lib/facter/root_home.rb +++ /dev/null @@ -1,19 +0,0 @@ -# A facter fact to determine the root home directory. -# This varies on PE supported platforms and may be -# reconfigured by the end user. - -module Facter::Util::RootHome - class << self - def get_root_home - root_ent = Facter::Util::Resolution.exec("getent passwd root") - # The home directory is the sixth element in the passwd entry - # If the platform doesn't have getent, root_ent will be nil and we should - # return it straight away. - root_ent && root_ent.split(":")[5] - end - end -end - -Facter.add(:root_home) do - setcode { Facter::Util::RootHome.get_root_home } -end diff --git a/puppet/modules/stdlib/lib/facter/util/puppet_settings.rb b/puppet/modules/stdlib/lib/facter/util/puppet_settings.rb deleted file mode 100644 index 1ad9452..0000000 --- a/puppet/modules/stdlib/lib/facter/util/puppet_settings.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Facter - module Util - module PuppetSettings - # This method is intended to provide a convenient way to evaluate a - # Facter code block only if Puppet is loaded. This is to account for the - # situation where the fact happens to be in the load path, but Puppet is - # not loaded for whatever reason. Perhaps the user is simply running - # facter without the --puppet flag and they happen to be working in a lib - # directory of a module. - def self.with_puppet - begin - Module.const_get("Puppet") - rescue NameError - nil - else - yield - end - end - end - end -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/abs.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/abs.rb deleted file mode 100644 index 11d2d7f..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/abs.rb +++ /dev/null @@ -1,36 +0,0 @@ -# -# abs.rb -# - -module Puppet::Parser::Functions - newfunction(:abs, :type => :rvalue, :doc => <<-EOS - Returns the absolute value of a number, for example -34.56 becomes - 34.56. Takes a single integer and float value as an argument. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "abs(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - - # Numbers in Puppet are often string-encoded which is troublesome ... - if value.is_a?(String) - if value.match(/^-?(?:\d+)(?:\.\d+){1}$/) - value = value.to_f - elsif value.match(/^-?\d+$/) - value = value.to_i - else - raise(Puppet::ParseError, 'abs(): Requires float or ' + - 'integer to work with') - end - end - - # We have numeric value to handle ... - result = value.abs - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/any2array.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/any2array.rb deleted file mode 100644 index e71407e..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/any2array.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# any2array.rb -# - -module Puppet::Parser::Functions - newfunction(:any2array, :type => :rvalue, :doc => <<-EOS -This converts any object to an array containing that object. Empty argument -lists are converted to an empty array. Arrays are left untouched. Hashes are -converted to arrays of alternating keys and values. - EOS - ) do |arguments| - - if arguments.empty? - return [] - end - - if arguments.length == 1 - if arguments[0].kind_of?(Array) - return arguments[0] - elsif arguments[0].kind_of?(Hash) - result = [] - arguments[0].each do |key, value| - result << key << value - end - return result - end - end - - return arguments - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/bool2num.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/bool2num.rb deleted file mode 100644 index 9a07a8a..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/bool2num.rb +++ /dev/null @@ -1,49 +0,0 @@ -# -# bool2num.rb -# - -module Puppet::Parser::Functions - newfunction(:bool2num, :type => :rvalue, :doc => <<-EOS - Converts a boolean to a number. Converts the values: - false, f, 0, n, and no to 0 - true, t, 1, y, and yes to 1 - Requires a single boolean or string as an input. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "bool2num(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - # We can have either true or false, or string which resembles boolean ... - unless [FalseClass, TrueClass, String].include?(klass) - raise(Puppet::ParseError, 'bool2num(): Requires either ' + - 'boolean or string to work with') - end - - if value.is_a?(String) - # We consider all the yes, no, y, n and so on too ... - value = case value - # - # This is how undef looks like in Puppet ... - # We yield 0 (or false if you wish) in this case. - # - when /^$/, '' then false # Empty string will be false ... - when /^(1|t|y|true|yes)$/ then true - when /^(0|f|n|false|no)$/ then false - when /^(undef|undefined)$/ then false # This is not likely to happen ... - else - raise(Puppet::ParseError, 'bool2num(): Unknown type of boolean given') - end - end - - # We have real boolean values as well ... - result = value ? 1 : 0 - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/capitalize.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/capitalize.rb deleted file mode 100644 index 640d00b..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/capitalize.rb +++ /dev/null @@ -1,34 +0,0 @@ -# -# capitalize.rb -# - -module Puppet::Parser::Functions - newfunction(:capitalize, :type => :rvalue, :doc => <<-EOS - Capitalizes the first letter of a string or array of strings. - Requires either a single string or an array as an input. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "capitalize(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'capitalize(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? i.capitalize : i } - else - result = value.capitalize - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/chomp.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/chomp.rb deleted file mode 100644 index 4564a00..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/chomp.rb +++ /dev/null @@ -1,35 +0,0 @@ -# -# chomp.rb -# - -module Puppet::Parser::Functions - newfunction(:chomp, :type => :rvalue, :doc => <<-'EOS' - Removes the record separator from the end of a string or an array of - strings, for example `hello\n` becomes `hello`. - Requires a single string or array as an input. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "chomp(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'chomp(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? i.chomp : i } - else - result = value.chomp - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/chop.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/chop.rb deleted file mode 100644 index f242af3..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/chop.rb +++ /dev/null @@ -1,37 +0,0 @@ -# -# chop.rb -# - -module Puppet::Parser::Functions - newfunction(:chop, :type => :rvalue, :doc => <<-'EOS' - Returns a new string with the last character removed. If the string ends - with `\r\n`, both characters are removed. Applying chop to an empty - string returns an empty string. If you wish to merely remove record - separators then you should use the `chomp` function. - Requires a string or array of strings as input. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "chop(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'chop(): Requires either an ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? i.chop : i } - else - result = value.chop - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/concat.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/concat.rb deleted file mode 100644 index c86aa00..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/concat.rb +++ /dev/null @@ -1,37 +0,0 @@ -# -# concat.rb -# - -module Puppet::Parser::Functions - newfunction(:concat, :type => :rvalue, :doc => <<-EOS -Appends the contents of array 2 onto array 1. - -*Example:* - - concat(['1','2','3'],['4','5','6']) - -Would result in: - - ['1','2','3','4','5','6'] - EOS - ) do |arguments| - - # Check that 2 arguments have been given ... - raise(Puppet::ParseError, "concat(): Wrong number of arguments " + - "given (#{arguments.size} for 2)") if arguments.size != 2 - - a = arguments[0] - b = arguments[1] - - # Check that both args are arrays. - unless a.is_a?(Array) and b.is_a?(Array) - raise(Puppet::ParseError, 'concat(): Requires array to work with') - end - - result = a.concat(b) - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/count.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/count.rb deleted file mode 100644 index 52de1b8..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/count.rb +++ /dev/null @@ -1,22 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:count, :type => :rvalue, :arity => -2, :doc => <<-EOS -Takes an array as first argument and an optional second argument. -Count the number of elements in array that matches second argument. -If called with only an array it counts the number of elements that are not nil/undef. - EOS - ) do |args| - - if (args.size > 2) then - raise(ArgumentError, "count(): Wrong number of arguments "+ - "given #{args.size} for 1 or 2.") - end - - collection, item = args - - if item then - collection.count item - else - collection.count { |obj| obj != nil && obj != :undef && obj != '' } - end - end -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb deleted file mode 100644 index d7df306..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb +++ /dev/null @@ -1,35 +0,0 @@ -# Test whether a given class or definition is defined -require 'puppet/parser/functions' - -Puppet::Parser::Functions.newfunction(:defined_with_params, - :type => :rvalue, - :doc => <<-'ENDOFDOC' -Takes a resource reference and an optional hash of attributes. - -Returns true if a resource with the specified attributes has already been added -to the catalog, and false otherwise. - - user { 'dan': - ensure => present, - } - - if ! defined_with_params(User[dan], {'ensure' => 'present' }) { - user { 'dan': ensure => present, } - } -ENDOFDOC -) do |vals| - reference, params = vals - raise(ArgumentError, 'Must specify a reference') unless reference - if (! params) || params == '' - params = {} - end - ret = false - if resource = findresource(reference.to_s) - matches = params.collect do |key, value| - resource[key] == value - end - ret = params.empty? || !matches.include?(false) - end - Puppet.debug("Resource #{reference} was not determined to be defined") - ret -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/delete.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/delete.rb deleted file mode 100644 index f814344..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/delete.rb +++ /dev/null @@ -1,46 +0,0 @@ -# -# delete.rb -# - -# TODO(Krzysztof Wilczynski): We need to add support for regular expression ... - -module Puppet::Parser::Functions - newfunction(:delete, :type => :rvalue, :doc => <<-EOS -Deletes all instances of a given element from an array, substring from a -string, or key from a hash. - -*Examples:* - - delete(['a','b','c','b'], 'b') - Would return: ['a','c'] - - delete({'a'=>1,'b'=>2,'c'=>3}, 'b') - Would return: {'a'=>1,'c'=>3} - - delete('abracadabra', 'bra') - Would return: 'acada' - EOS - ) do |arguments| - - if (arguments.size != 2) then - raise(Puppet::ParseError, "delete(): Wrong number of arguments "+ - "given #{arguments.size} for 2.") - end - - collection = arguments[0] - item = arguments[1] - - case collection - when Array, Hash - collection.delete item - when String - collection.gsub! item, '' - else - raise(TypeError, "delete(): First argument must be an Array, " + - "String, or Hash. Given an argument of class #{collection.class}.") - end - collection - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/delete_at.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/delete_at.rb deleted file mode 100644 index 3eb4b53..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/delete_at.rb +++ /dev/null @@ -1,49 +0,0 @@ -# -# delete_at.rb -# - -module Puppet::Parser::Functions - newfunction(:delete_at, :type => :rvalue, :doc => <<-EOS -Deletes a determined indexed value from an array. - -*Examples:* - - delete_at(['a','b','c'], 1) - -Would return: ['a','c'] - EOS - ) do |arguments| - - raise(Puppet::ParseError, "delete_at(): Wrong number of arguments " + - "given (#{arguments.size} for 2)") if arguments.size < 2 - - array = arguments[0] - - unless array.is_a?(Array) - raise(Puppet::ParseError, 'delete_at(): Requires array to work with') - end - - index = arguments[1] - - if index.is_a?(String) and not index.match(/^\d+$/) - raise(Puppet::ParseError, 'delete_at(): You must provide ' + - 'non-negative numeric index') - end - - result = array.clone - - # Numbers in Puppet are often string-encoded which is troublesome ... - index = index.to_i - - if index > result.size - 1 # First element is at index 0 is it not? - raise(Puppet::ParseError, 'delete_at(): Given index ' + - 'exceeds size of array given') - end - - result.delete_at(index) # We ignore the element that got deleted ... - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/dirname.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/dirname.rb deleted file mode 100644 index ea8cc1e..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/dirname.rb +++ /dev/null @@ -1,15 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:dirname, :type => :rvalue, :doc => <<-EOS - Returns the dirname of a path. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "dirname(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - path = arguments[0] - return File.dirname(path) - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/downcase.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/downcase.rb deleted file mode 100644 index 4066d21..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/downcase.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# downcase.rb -# - -module Puppet::Parser::Functions - newfunction(:downcase, :type => :rvalue, :doc => <<-EOS -Converts the case of a string or all strings in an array to lower case. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "downcase(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'downcase(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? i.downcase : i } - else - result = value.downcase - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/empty.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/empty.rb deleted file mode 100644 index 80ebb86..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/empty.rb +++ /dev/null @@ -1,28 +0,0 @@ -# -# empty.rb -# - -module Puppet::Parser::Functions - newfunction(:empty, :type => :rvalue, :doc => <<-EOS -Returns true if the variable is empty. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "empty(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, Hash, String].include?(klass) - raise(Puppet::ParseError, 'empty(): Requires either ' + - 'array, hash or string to work with') - end - - result = value.empty? - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb deleted file mode 100644 index 450ea02..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb +++ /dev/null @@ -1,24 +0,0 @@ -# -# ensure_packages.rb -# -require 'puppet/parser/functions' - -module Puppet::Parser::Functions - newfunction(:ensure_packages, :type => :statement, :doc => <<-EOS -Takes a list of packages and only installs them if they don't already exist. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "ensure_packages(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size != 1 - raise(Puppet::ParseError, "ensure_packages(): Requires array " + - "given (#{arguments[0].class})") if !arguments[0].kind_of?(Array) - - Puppet::Parser::Functions.function(:ensure_resource) - arguments[0].each { |package_name| - function_ensure_resource(['package', package_name, {'ensure' => 'present' } ]) - } - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb deleted file mode 100644 index a9a1733..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb +++ /dev/null @@ -1,45 +0,0 @@ -# Test whether a given class or definition is defined -require 'puppet/parser/functions' - -Puppet::Parser::Functions.newfunction(:ensure_resource, - :type => :statement, - :doc => <<-'ENDOFDOC' -Takes a resource type, title, and a list of attributes that describe a -resource. - - user { 'dan': - ensure => present, - } - -This example only creates the resource if it does not already exist: - - ensure_resource('user, 'dan', {'ensure' => 'present' }) - -If the resource already exists but does not match the specified parameters, -this function will attempt to recreate the resource leading to a duplicate -resource definition error. - -An array of resources can also be passed in and each will be created with -the type and parameters specified if it doesn't already exist. - - ensure_resource('user', ['dan','alex'], {'ensure' => 'present'}) - -ENDOFDOC -) do |vals| - type, title, params = vals - raise(ArgumentError, 'Must specify a type') unless type - raise(ArgumentError, 'Must specify a title') unless title - params ||= {} - - items = [title].flatten - - items.each do |item| - Puppet::Parser::Functions.function(:defined_with_params) - if function_defined_with_params(["#{type}[#{item}]", params]) - Puppet.debug("Resource #{type}[#{item}] not created because it already exists") - else - Puppet::Parser::Functions.function(:create_resources) - function_create_resources([type.capitalize, { item => params }]) - end - end -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/flatten.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/flatten.rb deleted file mode 100644 index a1ed183..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/flatten.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# flatten.rb -# - -module Puppet::Parser::Functions - newfunction(:flatten, :type => :rvalue, :doc => <<-EOS -This function flattens any deeply nested arrays and returns a single flat array -as a result. - -*Examples:* - - flatten(['a', ['b', ['c']]]) - -Would return: ['a','b','c'] - EOS - ) do |arguments| - - raise(Puppet::ParseError, "flatten(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size != 1 - - array = arguments[0] - - unless array.is_a?(Array) - raise(Puppet::ParseError, 'flatten(): Requires array to work with') - end - - result = array.flatten - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/floor.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/floor.rb deleted file mode 100644 index a401923..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/floor.rb +++ /dev/null @@ -1,20 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:floor, :type => :rvalue, :doc => <<-EOS - Returns the largest integer less or equal to the argument. - Takes a single numeric value as an argument. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "floor(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size != 1 - - arg = arguments[0] - - raise(Puppet::ParseError, "floor(): Wrong argument type " + - "given (#{arg.class} for Numeric)") if arg.is_a?(Numeric) == false - - arg.floor - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb deleted file mode 100644 index 6558206..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb +++ /dev/null @@ -1,46 +0,0 @@ -# -# fqdn_rotate.rb -# - -module Puppet::Parser::Functions - newfunction(:fqdn_rotate, :type => :rvalue, :doc => <<-EOS -Rotates an array a random number of times based on a nodes fqdn. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "fqdn_rotate(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - require 'digest/md5' - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'fqdn_rotate(): Requires either ' + - 'array or string to work with') - end - - result = value.clone - - string = value.is_a?(String) ? true : false - - # Check whether it makes sense to rotate ... - return result if result.size <= 1 - - # We turn any string value into an array to be able to rotate ... - result = string ? result.split('') : result - - elements = result.size - - srand(Digest::MD5.hexdigest([lookupvar('::fqdn'),arguments].join(':')).hex) - rand(elements).times { - result.push result.shift - } - - result = string ? result.join : result - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb deleted file mode 100644 index 1421b91..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:get_module_path, :type =>:rvalue, :doc => <<-EOT - Returns the absolute path of the specified module for the current - environment. - - Example: - $module_path = get_module_path('stdlib') - EOT - ) do |args| - raise(Puppet::ParseError, "get_module_path(): Wrong number of arguments, expects one") unless args.size == 1 - if module_path = Puppet::Module.find(args[0], compiler.environment.to_s) - module_path.path - else - raise(Puppet::ParseError, "Could not find module #{args[0]} in environment #{compiler.environment}") - end - end -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/getparam.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/getparam.rb deleted file mode 100644 index 6d51006..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/getparam.rb +++ /dev/null @@ -1,35 +0,0 @@ -# Test whether a given class or definition is defined -require 'puppet/parser/functions' - -Puppet::Parser::Functions.newfunction(:getparam, - :type => :rvalue, - :doc => <<-'ENDOFDOC' -Takes a resource reference and name of the parameter and -returns value of resource's parameter. - -*Examples:* - - define example_resource($param) { - } - - example_resource { "example_resource_instance": - param => "param_value" - } - - getparam(Example_resource["example_resource_instance"], "param") - -Would return: param_value -ENDOFDOC -) do |vals| - reference, param = vals - raise(ArgumentError, 'Must specify a reference') unless reference - raise(ArgumentError, 'Must specify name of a parameter') unless param and param.instance_of? String - - return '' if param.empty? - - if resource = findresource(reference.to_s) - return resource[param] if resource[param] - end - - return '' -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/getvar.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/getvar.rb deleted file mode 100644 index 1621149..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/getvar.rb +++ /dev/null @@ -1,26 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:getvar, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args| - Lookup a variable in a remote namespace. - - For example: - - $foo = getvar('site::data::foo') - # Equivalent to $foo = $site::data::foo - - This is useful if the namespace itself is stored in a string: - - $datalocation = 'site::data' - $bar = getvar("${datalocation}::bar") - # Equivalent to $bar = $site::data::bar - ENDHEREDOC - - unless args.length == 1 - raise Puppet::ParseError, ("getvar(): wrong number of arguments (#{args.length}; must be 1)") - end - - self.lookupvar("#{args[0]}") - - end - -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/grep.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/grep.rb deleted file mode 100644 index ceba9ec..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/grep.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# grep.rb -# - -module Puppet::Parser::Functions - newfunction(:grep, :type => :rvalue, :doc => <<-EOS -This function searches through an array and returns any elements that match -the provided regular expression. - -*Examples:* - - grep(['aaa','bbb','ccc','aaaddd'], 'aaa') - -Would return: - - ['aaa','aaaddd'] - EOS - ) do |arguments| - - if (arguments.size != 2) then - raise(Puppet::ParseError, "grep(): Wrong number of arguments "+ - "given #{arguments.size} for 2") - end - - a = arguments[0] - pattern = Regexp.new(arguments[1]) - - a.grep(pattern) - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb deleted file mode 100644 index 7f150a7..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb +++ /dev/null @@ -1,52 +0,0 @@ -# -# has_interface_with -# - -module Puppet::Parser::Functions - newfunction(:has_interface_with, :type => :rvalue, :doc => <<-EOS -Returns boolean based on kind and value: - * macaddress - * netmask - * ipaddress - * network - -has_interface_with("macaddress", "x:x:x:x:x:x") -has_interface_with("ipaddress", "127.0.0.1") => true -etc. - -If no "kind" is given, then the presence of the interface is checked: -has_interface_with("lo") => true - EOS - ) do |args| - - raise(Puppet::ParseError, "has_interface_with(): Wrong number of arguments " + - "given (#{args.size} for 1 or 2)") if args.size < 1 or args.size > 2 - - interfaces = lookupvar('interfaces') - - # If we do not have any interfaces, then there are no requested attributes - return false if (interfaces == :undefined) - - interfaces = interfaces.split(',') - - if args.size == 1 - return interfaces.member?(args[0]) - end - - kind, value = args - - if lookupvar(kind) == value - return true - end - - result = false - interfaces.each do |iface| - if value == lookupvar("#{kind}_#{iface}") - result = true - break - end - end - - result - end -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb deleted file mode 100644 index 842c8ec..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# has_ip_address -# - -module Puppet::Parser::Functions - newfunction(:has_ip_address, :type => :rvalue, :doc => <<-EOS -Returns true if the client has the requested IP address on some interface. - -This function iterates through the 'interfaces' fact and checks the -'ipaddress_IFACE' facts, performing a simple string comparison. - EOS - ) do |args| - - raise(Puppet::ParseError, "has_ip_address(): Wrong number of arguments " + - "given (#{args.size} for 1)") if args.size != 1 - - Puppet::Parser::Functions.autoloader.load(:has_interface_with) \ - unless Puppet::Parser::Functions.autoloader.loaded?(:has_interface_with) - - function_has_interface_with(['ipaddress', args[0]]) - - end -end - -# vim:sts=2 sw=2 diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb deleted file mode 100644 index 9ccf902..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# has_ip_network -# - -module Puppet::Parser::Functions - newfunction(:has_ip_network, :type => :rvalue, :doc => <<-EOS -Returns true if the client has an IP address within the requested network. - -This function iterates through the 'interfaces' fact and checks the -'network_IFACE' facts, performing a simple string comparision. - EOS - ) do |args| - - raise(Puppet::ParseError, "has_ip_network(): Wrong number of arguments " + - "given (#{args.size} for 1)") if args.size != 1 - - Puppet::Parser::Functions.autoloader.load(:has_interface_with) \ - unless Puppet::Parser::Functions.autoloader.loaded?(:has_interface_with) - - function_has_interface_with(['network', args[0]]) - - end -end - -# vim:sts=2 sw=2 diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/has_key.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/has_key.rb deleted file mode 100644 index 4657cc2..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/has_key.rb +++ /dev/null @@ -1,28 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:has_key, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args| - Determine if a hash has a certain key value. - - Example: - - $my_hash = {'key_one' => 'value_one'} - if has_key($my_hash, 'key_two') { - notice('we will not reach here') - } - if has_key($my_hash, 'key_one') { - notice('this will be printed') - } - - ENDHEREDOC - - unless args.length == 2 - raise Puppet::ParseError, ("has_key(): wrong number of arguments (#{args.length}; must be 2)") - end - unless args[0].is_a?(Hash) - raise Puppet::ParseError, "has_key(): expects the first argument to be a hash, got #{args[0].inspect} which is of type #{args[0].class}" - end - args[0].has_key?(args[1]) - - end - -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/hash.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/hash.rb deleted file mode 100644 index 8cc4823..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/hash.rb +++ /dev/null @@ -1,41 +0,0 @@ -# -# hash.rb -# - -module Puppet::Parser::Functions - newfunction(:hash, :type => :rvalue, :doc => <<-EOS -This function converts an array into a hash. - -*Examples:* - - hash(['a',1,'b',2,'c',3]) - -Would return: {'a'=>1,'b'=>2,'c'=>3} - EOS - ) do |arguments| - - raise(Puppet::ParseError, "hash(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - array = arguments[0] - - unless array.is_a?(Array) - raise(Puppet::ParseError, 'hash(): Requires array to work with') - end - - result = {} - - begin - # This is to make it compatible with older version of Ruby ... - array = array.flatten - result = Hash[*array] - rescue Exception - raise(Puppet::ParseError, 'hash(): Unable to compute ' + - 'hash from array given') - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/is_array.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/is_array.rb deleted file mode 100644 index b39e184..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/is_array.rb +++ /dev/null @@ -1,22 +0,0 @@ -# -# is_array.rb -# - -module Puppet::Parser::Functions - newfunction(:is_array, :type => :rvalue, :doc => <<-EOS -Returns true if the variable passed to this function is an array. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "is_array(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - type = arguments[0] - - result = type.is_a?(Array) - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb deleted file mode 100644 index 5826dc0..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb +++ /dev/null @@ -1,47 +0,0 @@ -# -# is_domain_name.rb -# - -module Puppet::Parser::Functions - newfunction(:is_domain_name, :type => :rvalue, :doc => <<-EOS -Returns true if the string passed to this function is a syntactically correct domain name. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "is_domain_name(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - domain = arguments[0] - - # Limits (rfc1035, 3.1) - domain_max_length=255 - label_min_length=1 - label_max_length=63 - - # Allow ".", it is the top level domain - return true if domain == '.' - - # Remove the final dot, if present. - domain.chomp!('.') - - # Check the whole domain - return false if domain.empty? - return false if domain.length > domain_max_length - - # Check each label in the domain - labels = domain.split('.') - vlabels = labels.each do |label| - break if label.length < label_min_length - break if label.length > label_max_length - break if label[-1..-1] == '-' - break if label[0..0] == '-' - break unless /^[a-z\d-]+$/i.match(label) - end - return vlabels == labels - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/is_float.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/is_float.rb deleted file mode 100644 index 911f3c2..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/is_float.rb +++ /dev/null @@ -1,27 +0,0 @@ -# -# is_float.rb -# - -module Puppet::Parser::Functions - newfunction(:is_float, :type => :rvalue, :doc => <<-EOS -Returns true if the variable passed to this function is a float. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "is_float(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - value = arguments[0] - - if value != value.to_f.to_s and !value.is_a? Float then - return false - else - return true - end - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb deleted file mode 100644 index 6cbd35c..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb +++ /dev/null @@ -1,23 +0,0 @@ -# -# is_function_available.rb -# - -module Puppet::Parser::Functions - newfunction(:is_function_available, :type => :rvalue, :doc => <<-EOS -This function accepts a string as an argument, determines whether the -Puppet runtime has access to a function by that name. It returns a -true if the function exists, false if not. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "is_function_available?(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - function = Puppet::Parser::Functions.function(arguments[0].to_sym) - function.is_a?(String) and not function.empty? - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/is_hash.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/is_hash.rb deleted file mode 100644 index ad907f0..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/is_hash.rb +++ /dev/null @@ -1,22 +0,0 @@ -# -# is_hash.rb -# - -module Puppet::Parser::Functions - newfunction(:is_hash, :type => :rvalue, :doc => <<-EOS -Returns true if the variable passed to this function is a hash. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "is_hash(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size != 1 - - type = arguments[0] - - result = type.is_a?(Hash) - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/is_integer.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/is_integer.rb deleted file mode 100644 index 6b29e98..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/is_integer.rb +++ /dev/null @@ -1,27 +0,0 @@ -# -# is_integer.rb -# - -module Puppet::Parser::Functions - newfunction(:is_integer, :type => :rvalue, :doc => <<-EOS -Returns true if the variable returned to this string is an integer. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "is_integer(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - value = arguments[0] - - if value != value.to_i.to_s and !value.is_a? Fixnum then - return false - else - return true - end - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb deleted file mode 100644 index a90adab..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb +++ /dev/null @@ -1,32 +0,0 @@ -# -# is_ip_address.rb -# - -module Puppet::Parser::Functions - newfunction(:is_ip_address, :type => :rvalue, :doc => <<-EOS -Returns true if the string passed to this function is a valid IP address. - EOS - ) do |arguments| - - require 'ipaddr' - - if (arguments.size != 1) then - raise(Puppet::ParseError, "is_ip_address(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - begin - ip = IPAddr.new(arguments[0]) - rescue ArgumentError - return false - end - - if ip.ipv4? or ip.ipv6? then - return true - else - return false - end - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb deleted file mode 100644 index 1b3088a..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb +++ /dev/null @@ -1,27 +0,0 @@ -# -# is_mac_address.rb -# - -module Puppet::Parser::Functions - newfunction(:is_mac_address, :type => :rvalue, :doc => <<-EOS -Returns true if the string passed to this function is a valid mac address. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "is_mac_address(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - mac = arguments[0] - - if /^[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}$/.match(mac) then - return true - else - return false - end - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb deleted file mode 100644 index abf0321..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb +++ /dev/null @@ -1,27 +0,0 @@ -# -# is_numeric.rb -# - -module Puppet::Parser::Functions - newfunction(:is_numeric, :type => :rvalue, :doc => <<-EOS -Returns true if the variable passed to this function is a number. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "is_numeric(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - value = arguments[0] - - if value == value.to_f.to_s or value == value.to_i.to_s or value.is_a? Numeric then - return true - else - return false - end - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/is_string.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/is_string.rb deleted file mode 100644 index f5bef04..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/is_string.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# is_string.rb -# - -module Puppet::Parser::Functions - newfunction(:is_string, :type => :rvalue, :doc => <<-EOS -Returns true if the variable passed to this function is a string. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "is_string(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - type = arguments[0] - - result = type.is_a?(String) - - if result and (type == type.to_f.to_s or type == type.to_i.to_s) then - return false - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/join.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/join.rb deleted file mode 100644 index 005a46e..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/join.rb +++ /dev/null @@ -1,41 +0,0 @@ -# -# join.rb -# - -module Puppet::Parser::Functions - newfunction(:join, :type => :rvalue, :doc => <<-EOS -This function joins an array into a string using a seperator. - -*Examples:* - - join(['a','b','c'], ",") - -Would result in: "a,b,c" - EOS - ) do |arguments| - - # Technically we support two arguments but only first is mandatory ... - raise(Puppet::ParseError, "join(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - array = arguments[0] - - unless array.is_a?(Array) - raise(Puppet::ParseError, 'join(): Requires array to work with') - end - - suffix = arguments[1] if arguments[1] - - if suffix - unless suffix.is_a?(String) - raise(Puppet::ParseError, 'join(): Requires string to work with') - end - end - - result = suffix ? array.join(suffix) : array.join - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb deleted file mode 100644 index e9924fe..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb +++ /dev/null @@ -1,47 +0,0 @@ -# -# join.rb -# - -module Puppet::Parser::Functions - newfunction(:join_keys_to_values, :type => :rvalue, :doc => <<-EOS -This function joins each key of a hash to that key's corresponding value with a -separator. Keys and values are cast to strings. The return value is an array in -which each element is one joined key/value pair. - -*Examples:* - - join_keys_to_values({'a'=>1,'b'=>2}, " is ") - -Would result in: ["a is 1","b is 2"] - EOS - ) do |arguments| - - # Validate the number of arguments. - if arguments.size != 2 - raise(Puppet::ParseError, "join_keys_to_values(): Takes exactly two " + - "arguments, but #{arguments.size} given.") - end - - # Validate the first argument. - hash = arguments[0] - if not hash.is_a?(Hash) - raise(TypeError, "join_keys_to_values(): The first argument must be a " + - "hash, but a #{hash.class} was given.") - end - - # Validate the second argument. - separator = arguments[1] - if not separator.is_a?(String) - raise(TypeError, "join_keys_to_values(): The second argument must be a " + - "string, but a #{separator.class} was given.") - end - - # Join the keys to their values. - hash.map do |k,v| - String(k) + separator + String(v) - end - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/keys.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/keys.rb deleted file mode 100644 index f0d13b6..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/keys.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# keys.rb -# - -module Puppet::Parser::Functions - newfunction(:keys, :type => :rvalue, :doc => <<-EOS -Returns the keys of a hash as an array. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "keys(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - hash = arguments[0] - - unless hash.is_a?(Hash) - raise(Puppet::ParseError, 'keys(): Requires hash to work with') - end - - result = hash.keys - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb deleted file mode 100644 index 10c4005..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb +++ /dev/null @@ -1,20 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:loadyaml, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args| - Load a YAML file containing an array, string, or hash, and return the data - in the corresponding native data type. - - For example: - - $myhash = loadyaml('/etc/puppet/data/myhash.yaml') - ENDHEREDOC - - unless args.length == 1 - raise Puppet::ParseError, ("loadyaml(): wrong number of arguments (#{args.length}; must be 1)") - end - - YAML.load_file(args[0]) - - end - -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/lstrip.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/lstrip.rb deleted file mode 100644 index 3a64de3..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/lstrip.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# lstrip.rb -# - -module Puppet::Parser::Functions - newfunction(:lstrip, :type => :rvalue, :doc => <<-EOS -Strips leading spaces to the left of a string. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "lstrip(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'lstrip(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? i.lstrip : i } - else - result = value.lstrip - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/max.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/max.rb deleted file mode 100644 index 60fb94a..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/max.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:max, :type => :rvalue, :doc => <<-EOS - Returns the highest value of all arguments. - Requires at least one argument. - EOS - ) do |args| - - raise(Puppet::ParseError, "max(): Wrong number of arguments " + - "need at least one") if args.size == 0 - - # Sometimes we get numbers as numerics and sometimes as strings. - # We try to compare them as numbers when possible - return args.max do |a,b| - if a.to_s =~ /\A-?\d+(.\d+)?\z/ and b.to_s =~ /\A-?\d+(.\d+)?\z/ then - a.to_f <=> b.to_f - else - a.to_s <=> b.to_s - end - end - end -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/member.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/member.rb deleted file mode 100644 index 43d76af..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/member.rb +++ /dev/null @@ -1,44 +0,0 @@ -# -# member.rb -# - -# TODO(Krzysztof Wilczynski): We need to add support for regular expression ... -# TODO(Krzysztof Wilczynski): Support for strings and hashes too ... - -module Puppet::Parser::Functions - newfunction(:member, :type => :rvalue, :doc => <<-EOS -This function determines if a variable is a member of an array. - -*Examples:* - - member(['a','b'], 'b') - -Would return: true - - member(['a','b'], 'c') - -Would return: false - EOS - ) do |arguments| - - raise(Puppet::ParseError, "member(): Wrong number of arguments " + - "given (#{arguments.size} for 2)") if arguments.size < 2 - - array = arguments[0] - - unless array.is_a?(Array) - raise(Puppet::ParseError, 'member(): Requires array to work with') - end - - item = arguments[1] - - raise(Puppet::ParseError, 'member(): You must provide item ' + - 'to search for within array given') if item.empty? - - result = array.include?(item) - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/merge.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/merge.rb deleted file mode 100644 index 6ec085e..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/merge.rb +++ /dev/null @@ -1,33 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:merge, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args| - Merges two or more hashes together and returns the resulting hash. - - For example: - - $hash1 = {'one' => 1, 'two', => 2} - $hash2 = {'two' => 'dos', 'three', => 'tres'} - $merged_hash = merge($hash1, $hash2) - # The resulting hash is equivalent to: - # $merged_hash = {'one' => 1, 'two' => 'dos', 'three' => 'tres'} - - When there is a duplicate key, the key in the rightmost hash will "win." - - ENDHEREDOC - - if args.length < 2 - raise Puppet::ParseError, ("merge(): wrong number of arguments (#{args.length}; must be at least 2)") - end - - # The hash we accumulate into - accumulator = Hash.new - # Merge into the accumulator hash - args.each do |arg| - unless arg.is_a?(Hash) - raise Puppet::ParseError, "merge: unexpected argument type #{arg.class}, only expects hash arguments" - end - accumulator.merge!(arg) - end - # Return the fully merged hash - accumulator - end -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/min.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/min.rb deleted file mode 100644 index 6bd6ebf..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/min.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:min, :type => :rvalue, :doc => <<-EOS - Returns the lowest value of all arguments. - Requires at least one argument. - EOS - ) do |args| - - raise(Puppet::ParseError, "min(): Wrong number of arguments " + - "need at least one") if args.size == 0 - - # Sometimes we get numbers as numerics and sometimes as strings. - # We try to compare them as numbers when possible - return args.min do |a,b| - if a.to_s =~ /\A^-?\d+(.\d+)?\z/ and b.to_s =~ /\A-?\d+(.\d+)?\z/ then - a.to_f <=> b.to_f - else - a.to_s <=> b.to_s - end - end - end -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/num2bool.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/num2bool.rb deleted file mode 100644 index af0e6ed..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/num2bool.rb +++ /dev/null @@ -1,43 +0,0 @@ -# -# num2bool.rb -# - -module Puppet::Parser::Functions - newfunction(:num2bool, :type => :rvalue, :doc => <<-EOS -This function converts a number or a string representation of a number into a -true boolean. Zero or anything non-numeric becomes false. Numbers higher then 0 -become true. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "num2bool(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size != 1 - - number = arguments[0] - - case number - when Numeric - # Yay, it's a number - when String - begin - number = Float(number) - rescue ArgumentError => ex - raise(Puppet::ParseError, "num2bool(): '#{number}' does not look like a number: #{ex.message}") - end - else - begin - number = number.to_s - rescue NoMethodError => ex - raise(Puppet::ParseError, "num2bool(): Unable to parse argument: #{ex.message}") - end - end - - # Truncate Floats - number = number.to_i - - # Return true for any positive number and false otherwise - return number > 0 - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/parsejson.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/parsejson.rb deleted file mode 100644 index a9a16a4..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/parsejson.rb +++ /dev/null @@ -1,24 +0,0 @@ -# -# parsejson.rb -# - -module Puppet::Parser::Functions - newfunction(:parsejson, :type => :rvalue, :doc => <<-EOS -This function accepts JSON as a string and converts into the correct Puppet -structure. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "parsejson(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - json = arguments[0] - - # PSON is natively available in puppet - PSON.load(json) - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb deleted file mode 100644 index 53d54fa..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb +++ /dev/null @@ -1,24 +0,0 @@ -# -# parseyaml.rb -# - -module Puppet::Parser::Functions - newfunction(:parseyaml, :type => :rvalue, :doc => <<-EOS -This function accepts YAML as a string and converts it into the correct -Puppet structure. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "parseyaml(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - require 'yaml' - - YAML::load(arguments[0]) - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/pick.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/pick.rb deleted file mode 100644 index cbc0300..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/pick.rb +++ /dev/null @@ -1,29 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:pick, :type => :rvalue, :doc => <<-EOS - -This function is similar to a coalesce function in SQL in that it will return -the first value in a list of values that is not undefined or an empty string -(two things in Puppet that will return a boolean false value). Typically, -this function is used to check for a value in the Puppet Dashboard/Enterprise -Console, and failover to a default value like the following: - - $real_jenkins_version = pick($::jenkins_version, '1.449') - -The value of $real_jenkins_version will first look for a top-scope variable -called 'jenkins_version' (note that parameters set in the Puppet Dashboard/ -Enterprise Console are brought into Puppet as top-scope variables), and, -failing that, will use a default value of 1.449. - -EOS -) do |args| - args = args.compact - args.delete(:undef) - args.delete(:undefined) - args.delete("") - if args[0].to_s.empty? then - fail "Must provide non empty value." - else - return args[0] - end - end -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/prefix.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/prefix.rb deleted file mode 100644 index 62211ae..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/prefix.rb +++ /dev/null @@ -1,45 +0,0 @@ -# -# prefix.rb -# - -module Puppet::Parser::Functions - newfunction(:prefix, :type => :rvalue, :doc => <<-EOS -This function applies a prefix to all elements in an array. - -*Examples:* - - prefix(['a','b','c'], 'p') - -Will return: ['pa','pb','pc'] - EOS - ) do |arguments| - - # Technically we support two arguments but only first is mandatory ... - raise(Puppet::ParseError, "prefix(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - array = arguments[0] - - unless array.is_a?(Array) - raise Puppet::ParseError, "prefix(): expected first argument to be an Array, got #{array.inspect}" - end - - prefix = arguments[1] if arguments[1] - - if prefix - unless prefix.is_a?(String) - raise Puppet::ParseError, "prefix(): expected second argument to be a String, got #{suffix.inspect}" - end - end - - # Turn everything into string same as join would do ... - result = array.collect do |i| - i = i.to_s - prefix ? prefix + i : i - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/range.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/range.rb deleted file mode 100644 index 825617b..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/range.rb +++ /dev/null @@ -1,80 +0,0 @@ -# -# range.rb -# - -# TODO(Krzysztof Wilczynski): We probably need to approach numeric values differently ... - -module Puppet::Parser::Functions - newfunction(:range, :type => :rvalue, :doc => <<-EOS -When given range in the form of (start, stop) it will extrapolate a range as -an array. - -*Examples:* - - range("0", "9") - -Will return: [0,1,2,3,4,5,6,7,8,9] - - range("00", "09") - -Will return: [0,1,2,3,4,5,6,7,8,9] (Zero padded strings are converted to -integers automatically) - - range("a", "c") - -Will return: ["a","b","c"] - - range("host01", "host10") - -Will return: ["host01", "host02", ..., "host09", "host10"] - EOS - ) do |arguments| - - # We support more than one argument but at least one is mandatory ... - raise(Puppet::ParseError, "range(): Wrong number of " + - "arguments given (#{arguments.size} for 1)") if arguments.size < 1 - - if arguments.size > 1 - start = arguments[0] - stop = arguments[1] - - type = '..' # We select simplest type for Range available in Ruby ... - - elsif arguments.size > 0 - value = arguments[0] - - if m = value.match(/^(\w+)(\.\.\.?|\-)(\w+)$/) - start = m[1] - stop = m[3] - - type = m[2] - - elsif value.match(/^.+$/) - raise(Puppet::ParseError, 'range(): Unable to compute range ' + - 'from the value given') - else - raise(Puppet::ParseError, 'range(): Unknown format of range given') - end - end - - # Check whether we have integer value if so then make it so ... - if start.match(/^\d+$/) - start = start.to_i - stop = stop.to_i - else - start = start.to_s - stop = stop.to_s - end - - range = case type - when /^(\.\.|\-)$/ then (start .. stop) - when /^(\.\.\.)$/ then (start ... stop) # Exclusive of last element ... - end - - result = range.collect { |i| i } # Get them all ... Pokemon ... - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/reject.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/reject.rb deleted file mode 100644 index 1953ffc..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/reject.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# reject.rb -# - -module Puppet::Parser::Functions - newfunction(:reject, :type => :rvalue, :doc => <<-EOS) do |args| -This function searches through an array and rejects all elements that match -the provided regular expression. - -*Examples:* - - reject(['aaa','bbb','ccc','aaaddd'], 'aaa') - -Would return: - - ['bbb','ccc'] -EOS - - if (args.size != 2) - raise Puppet::ParseError, - "reject(): Wrong number of arguments given #{args.size} for 2" - end - - ary = args[0] - pattern = Regexp.new(args[1]) - - ary.reject { |e| e =~ pattern } - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/reverse.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/reverse.rb deleted file mode 100644 index fe04869..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/reverse.rb +++ /dev/null @@ -1,28 +0,0 @@ -# -# reverse.rb -# - -module Puppet::Parser::Functions - newfunction(:reverse, :type => :rvalue, :doc => <<-EOS -Reverses the order of a string or array. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "reverse(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'reverse(): Requires either ' + - 'array or string to work with') - end - - result = value.reverse - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/rstrip.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/rstrip.rb deleted file mode 100644 index 29b0998..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/rstrip.rb +++ /dev/null @@ -1,32 +0,0 @@ -# -# rstrip.rb -# - -module Puppet::Parser::Functions - newfunction(:rstrip, :type => :rvalue, :doc => <<-EOS -Strips leading spaces to the right of the string. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "rstrip(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'rstrip(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - result = value.collect { |i| i.is_a?(String) ? i.rstrip : i } - else - result = value.rstrip - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/shuffle.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/shuffle.rb deleted file mode 100644 index 18134ab..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/shuffle.rb +++ /dev/null @@ -1,46 +0,0 @@ -# -# shuffle.rb -# - -module Puppet::Parser::Functions - newfunction(:shuffle, :type => :rvalue, :doc => <<-EOS -Randomizes the order of a string or array elements. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "shuffle(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'shuffle(): Requires either ' + - 'array or string to work with') - end - - result = value.clone - - string = value.is_a?(String) ? true : false - - # Check whether it makes sense to shuffle ... - return result if result.size <= 1 - - # We turn any string value into an array to be able to shuffle ... - result = string ? result.split('') : result - - elements = result.size - - # Simple implementation of Fisher–Yates in-place shuffle ... - elements.times do |i| - j = rand(elements - i) + i - result[j], result[i] = result[i], result[j] - end - - result = string ? result.join : result - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/size.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/size.rb deleted file mode 100644 index cc207e3..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/size.rb +++ /dev/null @@ -1,48 +0,0 @@ -# -# size.rb -# - -# TODO(Krzysztof Wilczynski): Support for hashes would be nice too ... - -module Puppet::Parser::Functions - newfunction(:size, :type => :rvalue, :doc => <<-EOS -Returns the number of elements in a string or array. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "size(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - item = arguments[0] - - if item.is_a?(String) - - begin - # - # Check whether your item is a numeric value or not ... - # This will take care about positive and/or negative numbers - # for both integer and floating-point values ... - # - # Please note that Puppet has no notion of hexadecimal - # nor octal numbers for its DSL at this point in time ... - # - Float(item) - - raise(Puppet::ParseError, 'size(): Requires either ' + - 'string or array to work with') - - rescue ArgumentError - result = item.size - end - - elsif item.is_a?(Array) - result = item.size - else - raise(Puppet::ParseError, 'size(): Unknown type given') - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/sort.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/sort.rb deleted file mode 100644 index cefbe54..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/sort.rb +++ /dev/null @@ -1,27 +0,0 @@ -# -# sort.rb -# - -module Puppet::Parser::Functions - newfunction(:sort, :type => :rvalue, :doc => <<-EOS -Sorts strings and arrays lexically. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "sort(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end - - value = arguments[0] - - if value.is_a?(Array) then - value.sort - elsif value.is_a?(String) then - value.split("").sort.join("") - end - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/squeeze.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/squeeze.rb deleted file mode 100644 index 81fadfd..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/squeeze.rb +++ /dev/null @@ -1,36 +0,0 @@ -# -# squeeze.rb -# - -module Puppet::Parser::Functions - newfunction(:squeeze, :type => :rvalue, :doc => <<-EOS -Returns a new string where runs of the same character that occur in this set are replaced by a single character. - EOS - ) do |arguments| - - if ((arguments.size != 2) and (arguments.size != 1)) then - raise(Puppet::ParseError, "squeeze(): Wrong number of arguments "+ - "given #{arguments.size} for 2 or 1") - end - - item = arguments[0] - squeezeval = arguments[1] - - if item.is_a?(Array) then - if squeezeval then - item.collect { |i| i.squeeze(squeezeval) } - else - item.collect { |i| i.squeeze } - end - else - if squeezeval then - item.squeeze(squeezeval) - else - item.squeeze - end - end - - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/str2bool.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/str2bool.rb deleted file mode 100644 index fece7a6..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/str2bool.rb +++ /dev/null @@ -1,46 +0,0 @@ -# -# str2bool.rb -# - -module Puppet::Parser::Functions - newfunction(:str2bool, :type => :rvalue, :doc => <<-EOS -This converts a string to a boolean. This attempt to convert strings that -contain things like: y, 1, t, true to 'true' and strings that contain things -like: 0, f, n, false, no to 'false'. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "str2bool(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - string = arguments[0] - - # If string is already Boolean, return it - if !!string == string - return string - end - - unless string.is_a?(String) - raise(Puppet::ParseError, 'str2bool(): Requires either ' + - 'string to work with') - end - - # We consider all the yes, no, y, n and so on too ... - result = case string - # - # This is how undef looks like in Puppet ... - # We yield false in this case. - # - when /^$/, '' then false # Empty string will be false ... - when /^(1|t|y|true|yes)$/ then true - when /^(0|f|n|false|no)$/ then false - when /^(undef|undefined)$/ then false # This is not likely to happen ... - else - raise(Puppet::ParseError, 'str2bool(): Unknown type of boolean given') - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb deleted file mode 100644 index 7fe7b01..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb +++ /dev/null @@ -1,32 +0,0 @@ -# -# str2saltedsha512.rb -# - -module Puppet::Parser::Functions - newfunction(:str2saltedsha512, :type => :rvalue, :doc => <<-EOS -This converts a string to a salted-SHA512 password hash (which is used for -OS X versions >= 10.7). Given any simple string, you will get a hex version -of a salted-SHA512 password hash that can be inserted into your Puppet -manifests as a valid password attribute. - EOS - ) do |arguments| - require 'digest/sha2' - - raise(Puppet::ParseError, "str2saltedsha512(): Wrong number of arguments " + - "passed (#{arguments.size} but we require 1)") if arguments.size != 1 - - password = arguments[0] - - unless password.is_a?(String) - raise(Puppet::ParseError, 'str2saltedsha512(): Requires a ' + - "String argument, you passed: #{password.class}") - end - - seedint = rand(2**31 - 1) - seedstring = Array(seedint).pack("L") - saltedpass = Digest::SHA512.digest(seedstring + password) - (seedstring + saltedpass).unpack('H*')[0] - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/strftime.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/strftime.rb deleted file mode 100644 index 0b52ade..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/strftime.rb +++ /dev/null @@ -1,107 +0,0 @@ -# -# strftime.rb -# - -module Puppet::Parser::Functions - newfunction(:strftime, :type => :rvalue, :doc => <<-EOS -This function returns formatted time. - -*Examples:* - -To return the time since epoch: - - strftime("%s") - -To return the date: - - strftime("%Y-%m-%d") - -*Format meaning:* - - %a - The abbreviated weekday name (``Sun'') - %A - The full weekday name (``Sunday'') - %b - The abbreviated month name (``Jan'') - %B - The full month name (``January'') - %c - The preferred local date and time representation - %C - Century (20 in 2009) - %d - Day of the month (01..31) - %D - Date (%m/%d/%y) - %e - Day of the month, blank-padded ( 1..31) - %F - Equivalent to %Y-%m-%d (the ISO 8601 date format) - %h - Equivalent to %b - %H - Hour of the day, 24-hour clock (00..23) - %I - Hour of the day, 12-hour clock (01..12) - %j - Day of the year (001..366) - %k - hour, 24-hour clock, blank-padded ( 0..23) - %l - hour, 12-hour clock, blank-padded ( 0..12) - %L - Millisecond of the second (000..999) - %m - Month of the year (01..12) - %M - Minute of the hour (00..59) - %n - Newline (\n) - %N - Fractional seconds digits, default is 9 digits (nanosecond) - %3N millisecond (3 digits) - %6N microsecond (6 digits) - %9N nanosecond (9 digits) - %p - Meridian indicator (``AM'' or ``PM'') - %P - Meridian indicator (``am'' or ``pm'') - %r - time, 12-hour (same as %I:%M:%S %p) - %R - time, 24-hour (%H:%M) - %s - Number of seconds since 1970-01-01 00:00:00 UTC. - %S - Second of the minute (00..60) - %t - Tab character (\t) - %T - time, 24-hour (%H:%M:%S) - %u - Day of the week as a decimal, Monday being 1. (1..7) - %U - Week number of the current year, - starting with the first Sunday as the first - day of the first week (00..53) - %v - VMS date (%e-%b-%Y) - %V - Week number of year according to ISO 8601 (01..53) - %W - Week number of the current year, - starting with the first Monday as the first - day of the first week (00..53) - %w - Day of the week (Sunday is 0, 0..6) - %x - Preferred representation for the date alone, no time - %X - Preferred representation for the time alone, no date - %y - Year without a century (00..99) - %Y - Year with century - %z - Time zone as hour offset from UTC (e.g. +0900) - %Z - Time zone name - %% - Literal ``%'' character - EOS - ) do |arguments| - - # Technically we support two arguments but only first is mandatory ... - raise(Puppet::ParseError, "strftime(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - format = arguments[0] - - raise(Puppet::ParseError, 'strftime(): You must provide ' + - 'format for evaluation') if format.empty? - - # The Time Zone argument is optional ... - time_zone = arguments[1] if arguments[1] - - time = Time.new - - # There is probably a better way to handle Time Zone ... - if time_zone and not time_zone.empty? - original_zone = ENV['TZ'] - - local_time = time.clone - local_time = local_time.utc - - ENV['TZ'] = time_zone - - time = local_time.localtime - - ENV['TZ'] = original_zone - end - - result = time.strftime(format) - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/strip.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/strip.rb deleted file mode 100644 index 5f4630d..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/strip.rb +++ /dev/null @@ -1,39 +0,0 @@ -# -# strip.rb -# - -module Puppet::Parser::Functions - newfunction(:strip, :type => :rvalue, :doc => <<-EOS -This function removes leading and trailing whitespace from a string or from -every string inside an array. - -*Examples:* - - strip(" aaa ") - -Would result in: "aaa" - EOS - ) do |arguments| - - raise(Puppet::ParseError, "strip(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'strip(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - result = value.collect { |i| i.is_a?(String) ? i.strip : i } - else - result = value.strip - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/suffix.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/suffix.rb deleted file mode 100644 index f7792d6..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/suffix.rb +++ /dev/null @@ -1,45 +0,0 @@ -# -# suffix.rb -# - -module Puppet::Parser::Functions - newfunction(:suffix, :type => :rvalue, :doc => <<-EOS -This function applies a suffix to all elements in an array. - -*Examples:* - - suffix(['a','b','c'], 'p') - -Will return: ['ap','bp','cp'] - EOS - ) do |arguments| - - # Technically we support two arguments but only first is mandatory ... - raise(Puppet::ParseError, "suffix(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - array = arguments[0] - - unless array.is_a?(Array) - raise Puppet::ParseError, "suffix(): expected first argument to be an Array, got #{array.inspect}" - end - - suffix = arguments[1] if arguments[1] - - if suffix - unless suffix.is_a? String - raise Puppet::ParseError, "suffix(): expected second argument to be a String, got #{suffix.inspect}" - end - end - - # Turn everything into string same as join would do ... - result = array.collect do |i| - i = i.to_s - suffix ? i + suffix : i - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/swapcase.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/swapcase.rb deleted file mode 100644 index b9e6632..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/swapcase.rb +++ /dev/null @@ -1,39 +0,0 @@ -# -# swapcase.rb -# - -module Puppet::Parser::Functions - newfunction(:swapcase, :type => :rvalue, :doc => <<-EOS -This function will swap the existing case of a string. - -*Examples:* - - swapcase("aBcD") - -Would result in: "AbCd" - EOS - ) do |arguments| - - raise(Puppet::ParseError, "swapcase(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'swapcase(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? i.swapcase : i } - else - result = value.swapcase - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/time.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/time.rb deleted file mode 100644 index 0cddaf8..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/time.rb +++ /dev/null @@ -1,49 +0,0 @@ -# -# time.rb -# - -module Puppet::Parser::Functions - newfunction(:time, :type => :rvalue, :doc => <<-EOS -This function will return the current time since epoch as an integer. - -*Examples:* - - time() - -Will return something like: 1311972653 - EOS - ) do |arguments| - - # The Time Zone argument is optional ... - time_zone = arguments[0] if arguments[0] - - if (arguments.size != 0) and (arguments.size != 1) then - raise(Puppet::ParseError, "time(): Wrong number of arguments "+ - "given #{arguments.size} for 0 or 1") - end - - time = Time.new - - # There is probably a better way to handle Time Zone ... - if time_zone and not time_zone.empty? - original_zone = ENV['TZ'] - - local_time = time.clone - local_time = local_time.utc - - ENV['TZ'] = time_zone - - time = local_time.localtime - - ENV['TZ'] = original_zone - end - - # Calling Time#to_i on a receiver changes it. Trust me I am the Doctor. - result = time.strftime('%s') - result = result.to_i - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb deleted file mode 100644 index 8ff73d1..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb +++ /dev/null @@ -1,28 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:to_bytes, :type => :rvalue, :doc => <<-EOS - Converts the argument into bytes, for example 4 kB becomes 4096. - Takes a single string value as an argument. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "to_bytes(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size != 1 - - arg = arguments[0] - - return arg if arg.is_a? Numeric - - value,prefix = */([0-9.e+-]*)\s*([^bB]?)/.match(arg)[1,2] - - value = value.to_f - case prefix - when '' then return value.to_i - when 'k' then return (value*(1<<10)).to_i - when 'M' then return (value*(1<<20)).to_i - when 'G' then return (value*(1<<30)).to_i - when 'T' then return (value*(1<<40)).to_i - when 'E' then return (value*(1<<50)).to_i - else raise Puppet::ParseError, "to_bytes(): Unknown prefix #{prefix}" - end - end -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/type.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/type.rb deleted file mode 100644 index 8d85f11..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/type.rb +++ /dev/null @@ -1,50 +0,0 @@ -# -# type.rb -# - -module Puppet::Parser::Functions - newfunction(:type, :type => :rvalue, :doc => <<-EOS -Returns the type when passed a variable. Type can be one of: - -* string -* array -* hash -* float -* integer -* boolean - EOS - ) do |arguments| - - raise(Puppet::ParseError, "type(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - - klass = value.class - - if not [TrueClass, FalseClass, Array, Bignum, Fixnum, Float, Hash, String].include?(klass) - raise(Puppet::ParseError, 'type(): Unknown type') - end - - klass = klass.to_s # Ugly ... - - # We note that Integer is the parent to Bignum and Fixnum ... - result = case klass - when /^(?:Big|Fix)num$/ then 'integer' - when /^(?:True|False)Class$/ then 'boolean' - else klass - end - - if result == "String" then - if value == value.to_i.to_s then - result = "Integer" - elsif value == value.to_f.to_s then - result = "Float" - end - end - - return result.downcase - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/unique.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/unique.rb deleted file mode 100644 index 8844a74..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/unique.rb +++ /dev/null @@ -1,51 +0,0 @@ -# -# unique.rb -# - -module Puppet::Parser::Functions - newfunction(:unique, :type => :rvalue, :doc => <<-EOS -This function will remove duplicates from strings and arrays. - -*Examples:* - - unique("aabbcc") - -Will return: - - abc - -You can also use this with arrays: - - unique(["a","a","b","b","c","c"]) - -This returns: - - ["a","b","c"] - EOS - ) do |arguments| - - raise(Puppet::ParseError, "unique(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'unique(): Requires either ' + - 'array or string to work with') - end - - result = value.clone - - string = value.is_a?(String) ? true : false - - # We turn any string value into an array to be able to shuffle ... - result = string ? result.split('') : result - result = result.uniq # Remove duplicates ... - result = string ? result.join : result - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/upcase.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/upcase.rb deleted file mode 100644 index fe6cadc..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/upcase.rb +++ /dev/null @@ -1,41 +0,0 @@ -# -# upcase.rb -# - -module Puppet::Parser::Functions - newfunction(:upcase, :type => :rvalue, :doc => <<-EOS -Converts a string or an array of strings to uppercase. - -*Examples:* - - upcase("abcd") - -Will return: - - ASDF - EOS - ) do |arguments| - - raise(Puppet::ParseError, "upcase(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'upcase(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? i.upcase : i } - else - result = value.upcase - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/uriescape.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/uriescape.rb deleted file mode 100644 index 67b93a6..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/uriescape.rb +++ /dev/null @@ -1,36 +0,0 @@ -# -# uriescape.rb -# -require 'uri' - -module Puppet::Parser::Functions - newfunction(:uriescape, :type => :rvalue, :doc => <<-EOS - Urlencodes a string or array of strings. - Requires either a single string or an array as an input. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "uriescape(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - value = arguments[0] - klass = value.class - unsafe = ":/?#[]@!$&'()*+,;= " - - unless [Array, String].include?(klass) - raise(Puppet::ParseError, 'uriescape(): Requires either ' + - 'array or string to work with') - end - - if value.is_a?(Array) - # Numbers in Puppet are often string-encoded which is troublesome ... - result = value.collect { |i| i.is_a?(String) ? URI.escape(i,unsafe) : i } - else - result = URI.escape(value,unsafe) - end - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb deleted file mode 100644 index fe27974..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb +++ /dev/null @@ -1,56 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:validate_absolute_path, :doc => <<-'ENDHEREDOC') do |args| - Validate the string represents an absolute path in the filesystem. This function works - for windows and unix style paths. - - The following values will pass: - - $my_path = "C:/Program Files (x86)/Puppet Labs/Puppet" - validate_absolute_path($my_path) - $my_path2 = "/var/lib/puppet" - validate_absolute_path($my_path2) - - - The following values will fail, causing compilation to abort: - - validate_absolute_path(true) - validate_absolute_path([ 'var/lib/puppet', '/var/foo' ]) - validate_absolute_path([ '/var/lib/puppet', 'var/foo' ]) - $undefined = undef - validate_absolute_path($undefined) - - ENDHEREDOC - - require 'puppet/util' - - unless args.length > 0 then - raise Puppet::ParseError, ("validate_absolute_path(): wrong number of arguments (#{args.length}; must be > 0)") - end - - args.each do |arg| - # This logic was borrowed from - # [lib/puppet/file_serving/base.rb](https://github.com/puppetlabs/puppet/blob/master/lib/puppet/file_serving/base.rb) - - # Puppet 2.7 and beyond will have Puppet::Util.absolute_path? Fall back to a back-ported implementation otherwise. - if Puppet::Util.respond_to?(:absolute_path?) then - unless Puppet::Util.absolute_path?(arg, :posix) or Puppet::Util.absolute_path?(arg, :windows) - raise Puppet::ParseError, ("#{arg.inspect} is not an absolute path.") - end - else - # This code back-ported from 2.7.x's lib/puppet/util.rb Puppet::Util.absolute_path? - # Determine in a platform-specific way whether a path is absolute. This - # defaults to the local platform if none is specified. - # Escape once for the string literal, and once for the regex. - slash = '[\\\\/]' - name = '[^\\\\/]+' - regexes = { - :windows => %r!^(([A-Z]:#{slash})|(#{slash}#{slash}#{name}#{slash}#{name})|(#{slash}#{slash}\?#{slash}#{name}))!i, - :posix => %r!^/!, - } - - rval = (!!(arg =~ regexes[:posix])) || (!!(arg =~ regexes[:windows])) - rval or raise Puppet::ParseError, ("#{arg.inspect} is not an absolute path.") - end - end - end -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_array.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/validate_array.rb deleted file mode 100644 index 34b5118..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_array.rb +++ /dev/null @@ -1,33 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:validate_array, :doc => <<-'ENDHEREDOC') do |args| - Validate that all passed values are array data structures. Abort catalog - compilation if any value fails this check. - - The following values will pass: - - $my_array = [ 'one', 'two' ] - validate_array($my_array) - - The following values will fail, causing compilation to abort: - - validate_array(true) - validate_array('some_string') - $undefined = undef - validate_array($undefined) - - ENDHEREDOC - - unless args.length > 0 then - raise Puppet::ParseError, ("validate_array(): wrong number of arguments (#{args.length}; must be > 0)") - end - - args.each do |arg| - unless arg.is_a?(Array) - raise Puppet::ParseError, ("#{arg.inspect} is not an Array. It looks to be a #{arg.class}") - end - end - - end - -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb deleted file mode 100644 index 154d660..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb +++ /dev/null @@ -1,81 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:validate_augeas, :doc => <<-'ENDHEREDOC') do |args| - Perform validation of a string using an Augeas lens - The first argument of this function should be a string to - test, and the second argument should be the name of the Augeas lens to use. - If Augeas fails to parse the string with the lens, the compilation will - abort with a parse error. - - A third argument can be specified, listing paths which should - not be found in the file. The `$file` variable points to the location - of the temporary file being tested in the Augeas tree. - - For example, if you want to make sure your passwd content never contains - a user `foo`, you could write: - - validate_augeas($passwdcontent, 'Passwd.lns', ['$file/foo']) - - Or if you wanted to ensure that no users used the '/bin/barsh' shell, - you could use: - - validate_augeas($passwdcontent, 'Passwd.lns', ['$file/*[shell="/bin/barsh"]'] - - If a fourth argument is specified, this will be the error message raised and - seen by the user. - - A helpful error message can be returned like this: - - validate_augeas($sudoerscontent, 'Sudoers.lns', [], 'Failed to validate sudoers content with Augeas') - - ENDHEREDOC - unless Puppet.features.augeas? - raise Puppet::ParseError, ("validate_augeas(): this function requires the augeas feature. See http://projects.puppetlabs.com/projects/puppet/wiki/Puppet_Augeas#Pre-requisites for how to activate it.") - end - - if (args.length < 2) or (args.length > 4) then - raise Puppet::ParseError, ("validate_augeas(): wrong number of arguments (#{args.length}; must be 2, 3, or 4)") - end - - msg = args[3] || "validate_augeas(): Failed to validate content against #{args[1].inspect}" - - require 'augeas' - aug = Augeas::open(nil, nil, Augeas::NO_MODL_AUTOLOAD) - begin - content = args[0] - - # Test content in a temporary file - tmpfile = Tempfile.new("validate_augeas") - begin - tmpfile.write(content) - ensure - tmpfile.close - end - - # Check for syntax - lens = args[1] - aug.transform( - :lens => lens, - :name => 'Validate_augeas', - :incl => tmpfile.path - ) - aug.load! - - unless aug.match("/augeas/files#{tmpfile.path}//error").empty? - error = aug.get("/augeas/files#{tmpfile.path}//error/message") - msg += " with error: #{error}" - raise Puppet::ParseError, (msg) - end - - # Launch unit tests - tests = args[2] || [] - aug.defvar('file', "/files#{tmpfile.path}") - tests.each do |t| - msg += " testing path #{t}" - raise Puppet::ParseError, (msg) unless aug.match(t).empty? - end - ensure - aug.close - tmpfile.unlink - end - end -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb deleted file mode 100644 index 62c1d88..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb +++ /dev/null @@ -1,34 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:validate_bool, :doc => <<-'ENDHEREDOC') do |args| - Validate that all passed values are either true or false. Abort catalog - compilation if any value fails this check. - - The following values will pass: - - $iamtrue = true - validate_bool(true) - validate_bool(true, true, false, $iamtrue) - - The following values will fail, causing compilation to abort: - - $some_array = [ true ] - validate_bool("false") - validate_bool("true") - validate_bool($some_array) - - ENDHEREDOC - - unless args.length > 0 then - raise Puppet::ParseError, ("validate_bool(): wrong number of arguments (#{args.length}; must be > 0)") - end - - args.each do |arg| - unless (arg.is_a?(TrueClass) || arg.is_a?(FalseClass)) - raise Puppet::ParseError, ("#{arg.inspect} is not a boolean. It looks to be a #{arg.class}") - end - end - - end - -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb deleted file mode 100644 index 344a80c..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'puppet/util/execution' - -module Puppet::Parser::Functions - newfunction(:validate_cmd, :doc => <<-'ENDHEREDOC') do |args| - Perform validation of a string with an external command. - The first argument of this function should be a string to - test, and the second argument should be a path to a test command - taking a file as last argument. If the command, launched against - a tempfile containing the passed string, returns a non-null value, - compilation will abort with a parse error. - - If a third argument is specified, this will be the error message raised and - seen by the user. - - A helpful error message can be returned like this: - - Example: - - validate_cmd($sudoerscontent, '/usr/sbin/visudo -c -f', 'Visudo failed to validate sudoers content') - - ENDHEREDOC - if (args.length < 2) or (args.length > 3) then - raise Puppet::ParseError, ("validate_cmd(): wrong number of arguments (#{args.length}; must be 2 or 3)") - end - - msg = args[2] || "validate_cmd(): failed to validate content with command #{args[1].inspect}" - - content = args[0] - checkscript = args[1] - - # Test content in a temporary file - tmpfile = Tempfile.new("validate_cmd") - begin - tmpfile.write(content) - if Puppet::Util::Execution.respond_to?('execute') - Puppet::Util::Execution.execute("#{checkscript} #{tmpfile.path}") - else - Puppet::Util.execute("#{checkscript} #{tmpfile.path}") - end - rescue Puppet::ExecutionFailure => detail - msg += "\n#{detail}" - raise Puppet::ParseError, msg - ensure - tmpfile.unlink - end - end -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb deleted file mode 100644 index 9bdd543..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb +++ /dev/null @@ -1,33 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:validate_hash, :doc => <<-'ENDHEREDOC') do |args| - Validate that all passed values are hash data structures. Abort catalog - compilation if any value fails this check. - - The following values will pass: - - $my_hash = { 'one' => 'two' } - validate_hash($my_hash) - - The following values will fail, causing compilation to abort: - - validate_hash(true) - validate_hash('some_string') - $undefined = undef - validate_hash($undefined) - - ENDHEREDOC - - unless args.length > 0 then - raise Puppet::ParseError, ("validate_hash(): wrong number of arguments (#{args.length}; must be > 0)") - end - - args.each do |arg| - unless arg.is_a?(Hash) - raise Puppet::ParseError, ("#{arg.inspect} is not a Hash. It looks to be a #{arg.class}") - end - end - - end - -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_re.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/validate_re.rb deleted file mode 100644 index ca25a70..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_re.rb +++ /dev/null @@ -1,40 +0,0 @@ -module Puppet::Parser::Functions - newfunction(:validate_re, :doc => <<-'ENDHEREDOC') do |args| - Perform simple validation of a string against one or more regular - expressions. The first argument of this function should be a string to - test, and the second argument should be a stringified regular expression - (without the // delimiters) or an array of regular expressions. If none - of the regular expressions match the string passed in, compilation will - abort with a parse error. - - If a third argument is specified, this will be the error message raised and - seen by the user. - - The following strings will validate against the regular expressions: - - validate_re('one', '^one$') - validate_re('one', [ '^one', '^two' ]) - - The following strings will fail to validate, causing compilation to abort: - - validate_re('one', [ '^two', '^three' ]) - - A helpful error message can be returned like this: - - validate_re($::puppetversion, '^2.7', 'The $puppetversion fact value does not match 2.7') - - ENDHEREDOC - if (args.length < 2) or (args.length > 3) then - raise Puppet::ParseError, ("validate_re(): wrong number of arguments (#{args.length}; must be 2 or 3)") - end - - msg = args[2] || "validate_re(): #{args[0].inspect} does not match #{args[1].inspect}" - - # We're using a flattened array here because we can't call String#any? in - # Ruby 1.9 like we can in Ruby 1.8 - raise Puppet::ParseError, (msg) unless [args[1]].flatten.any? do |re_str| - args[0] =~ Regexp.compile(re_str) - end - - end -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb deleted file mode 100644 index fdcc0a2..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb +++ /dev/null @@ -1,52 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:validate_slength, :doc => <<-'ENDHEREDOC') do |args| - Validate that the first argument is a string (or an array of strings), and - less/equal to than the length of the second argument. It fails if the first - argument is not a string or array of strings, and if arg 2 is not convertable - to a number. - - The following values will pass: - - validate_slength("discombobulate",17) - validate_slength(["discombobulate","moo"],17) - - The following valueis will not: - - validate_slength("discombobulate",1) - validate_slength(["discombobulate","thermometer"],5) - - ENDHEREDOC - - raise Puppet::ParseError, ("validate_slength(): Wrong number of arguments (#{args.length}; must be = 2)") unless args.length == 2 - - unless (args[0].is_a?(String) or args[0].is_a?(Array)) - raise Puppet::ParseError, ("validate_slength(): please pass a string, or an array of strings - what you passed didn't work for me at all - #{args[0].class}") - end - - begin - max_length = args[1].to_i - rescue NoMethodError => e - raise Puppet::ParseError, ("validate_slength(): Couldn't convert whatever you passed as the length parameter to an integer - sorry: " + e.message ) - end - - raise Puppet::ParseError, ("validate_slength(): please pass a positive number as max_length") unless max_length > 0 - - case args[0] - when String - raise Puppet::ParseError, ("validate_slength(): #{args[0].inspect} is #{args[0].length} characters. It should have been less than or equal to #{max_length} characters") unless args[0].length <= max_length - when Array - args[0].each do |arg| - if arg.is_a?(String) - unless ( arg.is_a?(String) and arg.length <= max_length ) - raise Puppet::ParseError, ("validate_slength(): #{arg.inspect} is #{arg.length} characters. It should have been less than or equal to #{max_length} characters") - end - else - raise Puppet::ParseError, ("validate_slength(): #{arg.inspect} is not a string, it's a #{arg.class}") - end - end - else - raise Puppet::ParseError, ("validate_slength(): please pass a string, or an array of strings - what you passed didn't work for me at all - #{args[0].class}") - end - end -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_string.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/validate_string.rb deleted file mode 100644 index e667794..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/validate_string.rb +++ /dev/null @@ -1,33 +0,0 @@ -module Puppet::Parser::Functions - - newfunction(:validate_string, :doc => <<-'ENDHEREDOC') do |args| - Validate that all passed values are string data structures. Abort catalog - compilation if any value fails this check. - - The following values will pass: - - $my_string = "one two" - validate_string($my_string, 'three') - - The following values will fail, causing compilation to abort: - - validate_string(true) - validate_string([ 'some', 'array' ]) - $undefined = undef - validate_string($undefined) - - ENDHEREDOC - - unless args.length > 0 then - raise Puppet::ParseError, ("validate_string(): wrong number of arguments (#{args.length}; must be > 0)") - end - - args.each do |arg| - unless arg.is_a?(String) - raise Puppet::ParseError, ("#{arg.inspect} is not a string. It looks to be a #{arg.class}") - end - end - - end - -end diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/values.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/values.rb deleted file mode 100644 index 1606756..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/values.rb +++ /dev/null @@ -1,39 +0,0 @@ -# -# values.rb -# - -module Puppet::Parser::Functions - newfunction(:values, :type => :rvalue, :doc => <<-EOS -When given a hash this function will return the values of that hash. - -*Examples:* - - $hash = { - 'a' => 1, - 'b' => 2, - 'c' => 3, - } - values($hash) - -This example would return: - - [1,2,3] - EOS - ) do |arguments| - - raise(Puppet::ParseError, "values(): Wrong number of arguments " + - "given (#{arguments.size} for 1)") if arguments.size < 1 - - hash = arguments[0] - - unless hash.is_a?(Hash) - raise(Puppet::ParseError, 'values(): Requires hash to work with') - end - - result = hash.values - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/values_at.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/values_at.rb deleted file mode 100644 index d3e69d9..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/values_at.rb +++ /dev/null @@ -1,98 +0,0 @@ -# -# values_at.rb -# - -module Puppet::Parser::Functions - newfunction(:values_at, :type => :rvalue, :doc => <<-EOS -Finds value inside an array based on location. - -The first argument is the array you want to analyze, and the second element can -be a combination of: - -* A single numeric index -* A range in the form of 'start-stop' (eg. 4-9) -* An array combining the above - -*Examples*: - - values_at(['a','b','c'], 2) - -Would return ['c']. - - values_at(['a','b','c'], ["0-1"]) - -Would return ['a','b']. - - values_at(['a','b','c','d','e'], [0, "2-3"]) - -Would return ['a','c','d']. - EOS - ) do |arguments| - - raise(Puppet::ParseError, "values_at(): Wrong number of " + - "arguments given (#{arguments.size} for 2)") if arguments.size < 2 - - array = arguments.shift - - unless array.is_a?(Array) - raise(Puppet::ParseError, 'values_at(): Requires array to work with') - end - - indices = [arguments.shift].flatten() # Get them all ... Pokemon ... - - if not indices or indices.empty? - raise(Puppet::ParseError, 'values_at(): You must provide ' + - 'at least one positive index to collect') - end - - result = [] - indices_list = [] - - indices.each do |i| - if m = i.match(/^(\d+)(\.\.\.?|\-)(\d+)$/) - start = m[1].to_i - stop = m[3].to_i - - type = m[2] - - if start > stop - raise(Puppet::ParseError, 'values_at(): Stop index in ' + - 'given indices range is smaller than the start index') - elsif stop > array.size - 1 # First element is at index 0 is it not? - raise(Puppet::ParseError, 'values_at(): Stop index in ' + - 'given indices range exceeds array size') - end - - range = case type - when /^(\.\.|\-)$/ then (start .. stop) - when /^(\.\.\.)$/ then (start ... stop) # Exclusive of last element ... - end - - range.each { |i| indices_list << i.to_i } - else - # Only positive numbers allowed in this case ... - if not i.match(/^\d+$/) - raise(Puppet::ParseError, 'values_at(): Unknown format ' + - 'of given index') - end - - # In Puppet numbers are often string-encoded ... - i = i.to_i - - if i > array.size - 1 # Same story. First element is at index 0 ... - raise(Puppet::ParseError, 'values_at(): Given index ' + - 'exceeds array size') - end - - indices_list << i - end - end - - # We remove nil values as they make no sense in Puppet DSL ... - result = indices_list.collect { |i| array[i] }.compact - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/parser/functions/zip.rb b/puppet/modules/stdlib/lib/puppet/parser/functions/zip.rb deleted file mode 100644 index 2b56e9c..0000000 --- a/puppet/modules/stdlib/lib/puppet/parser/functions/zip.rb +++ /dev/null @@ -1,65 +0,0 @@ -# -# zip.rb -# - -module Puppet::Parser::Functions - newfunction(:zip, :type => :rvalue, :doc => <<-EOS -Takes one element from first array and merges corresponding elements from second array. This generates a sequence of n-element arrays, where n is one more than the count of arguments. - -*Example:* - - zip(['1','2','3'],['4','5','6']) - -Would result in: - - ["1", "4"], ["2", "5"], ["3", "6"] - EOS - ) do |arguments| - - # Technically we support three arguments but only first is mandatory ... - raise(Puppet::ParseError, "zip(): Wrong number of arguments " + - "given (#{arguments.size} for 2)") if arguments.size < 2 - - a = arguments[0] - b = arguments[1] - - unless a.is_a?(Array) and b.is_a?(Array) - raise(Puppet::ParseError, 'zip(): Requires array to work with') - end - - flatten = arguments[2] if arguments[2] - - if flatten - klass = flatten.class - - # We can have either true or false, or string which resembles boolean ... - unless [FalseClass, TrueClass, String].include?(klass) - raise(Puppet::ParseError, 'zip(): Requires either ' + - 'boolean or string to work with') - end - - if flatten.is_a?(String) - # We consider all the yes, no, y, n and so on too ... - flatten = case flatten - # - # This is how undef looks like in Puppet ... - # We yield false in this case. - # - when /^$/, '' then false # Empty string will be false ... - when /^(1|t|y|true|yes)$/ then true - when /^(0|f|n|false|no)$/ then false - when /^(undef|undefined)$/ then false # This is not likely to happen ... - else - raise(Puppet::ParseError, 'zip(): Unknown type of boolean given') - end - end - end - - result = a.zip(b) - result = flatten ? result.flatten : result - - return result - end -end - -# vim: set ts=2 sw=2 et : diff --git a/puppet/modules/stdlib/lib/puppet/provider/file_line/ruby.rb b/puppet/modules/stdlib/lib/puppet/provider/file_line/ruby.rb deleted file mode 100644 index a3219d3..0000000 --- a/puppet/modules/stdlib/lib/puppet/provider/file_line/ruby.rb +++ /dev/null @@ -1,59 +0,0 @@ - -Puppet::Type.type(:file_line).provide(:ruby) do - - def exists? - lines.find do |line| - line.chomp == resource[:line].chomp - end - end - - def create - if resource[:match] - handle_create_with_match() - else - handle_create_without_match() - end - end - - def destroy - local_lines = lines - File.open(resource[:path],'w') do |fh| - fh.write(local_lines.reject{|l| l.chomp == resource[:line] }.join('')) - end - end - - private - def lines - # If this type is ever used with very large files, we should - # write this in a different way, using a temp - # file; for now assuming that this type is only used on - # small-ish config files that can fit into memory without - # too much trouble. - @lines ||= File.readlines(resource[:path]) - end - - def handle_create_with_match() - regex = resource[:match] ? Regexp.new(resource[:match]) : nil - match_count = lines.select { |l| regex.match(l) }.size - if match_count > 1 - raise Puppet::Error, "More than one line in file '#{resource[:path]}' matches pattern '#{resource[:match]}'" - end - File.open(resource[:path], 'w') do |fh| - lines.each do |l| - fh.puts(regex.match(l) ? resource[:line] : l) - end - - if (match_count == 0) - fh.puts(resource[:line]) - end - end - end - - def handle_create_without_match - File.open(resource[:path], 'a') do |fh| - fh.puts resource[:line] - end - end - - -end diff --git a/puppet/modules/stdlib/lib/puppet/type/anchor.rb b/puppet/modules/stdlib/lib/puppet/type/anchor.rb deleted file mode 100644 index fe1e5aa..0000000 --- a/puppet/modules/stdlib/lib/puppet/type/anchor.rb +++ /dev/null @@ -1,46 +0,0 @@ -Puppet::Type.newtype(:anchor) do - desc <<-'ENDOFDESC' - A simple resource type intended to be used as an anchor in a composite class. - - In Puppet 2.6, when a class declares another class, the resources in the - interior class are not contained by the exterior class. This interacts badly - with the pattern of composing complex modules from smaller classes, as it - makes it impossible for end users to specify order relationships between the - exterior class and other modules. - - The anchor type lets you work around this. By sandwiching any interior - classes between two no-op resources that _are_ contained by the exterior - class, you can ensure that all resources in the module are contained. - - class ntp { - # These classes will have the correct order relationship with each - # other. However, without anchors, they won't have any order - # relationship to Class['ntp']. - class { 'ntp::package': } - -> class { 'ntp::config': } - -> class { 'ntp::service': } - - # These two resources "anchor" the composed classes within the ntp - # class. - anchor { 'ntp::begin': } -> Class['ntp::package'] - Class['ntp::service'] -> anchor { 'ntp::end': } - } - - This allows the end user of the ntp module to establish require and before - relationships with Class['ntp']: - - class { 'ntp': } -> class { 'mcollective': } - class { 'mcollective': } -> class { 'ntp': } - - ENDOFDESC - - newparam :name do - desc "The name of the anchor resource." - end - - def refresh - # We don't do anything with them, but we need this to - # show that we are "refresh aware" and not break the - # chain of propagation. - end -end diff --git a/puppet/modules/stdlib/lib/puppet/type/file_line.rb b/puppet/modules/stdlib/lib/puppet/type/file_line.rb deleted file mode 100644 index f71a4bc..0000000 --- a/puppet/modules/stdlib/lib/puppet/type/file_line.rb +++ /dev/null @@ -1,70 +0,0 @@ -Puppet::Type.newtype(:file_line) do - - desc <<-EOT - Ensures that a given line is contained within a file. The implementation - matches the full line, including whitespace at the beginning and end. If - the line is not contained in the given file, Puppet will add the line to - ensure the desired state. Multiple resources may be declared to manage - multiple lines in the same file. - - Example: - - file_line { 'sudo_rule': - path => '/etc/sudoers', - line => '%sudo ALL=(ALL) ALL', - } - file_line { 'sudo_rule_nopw': - path => '/etc/sudoers', - line => '%sudonopw ALL=(ALL) NOPASSWD: ALL', - } - - In this example, Puppet will ensure both of the specified lines are - contained in the file /etc/sudoers. - - EOT - - ensurable do - defaultvalues - defaultto :present - end - - newparam(:name, :namevar => true) do - desc 'An arbitrary name used as the identity of the resource.' - end - - newparam(:match) do - desc 'An optional regular expression to run against existing lines in the file;\n' + - 'if a match is found, we replace that line rather than adding a new line.' - end - - newparam(:line) do - desc 'The line to be appended to the file located by the path parameter.' - end - - newparam(:path) do - desc 'The file Puppet will ensure contains the line specified by the line parameter.' - validate do |value| - unless (Puppet.features.posix? and value =~ /^\//) or (Puppet.features.microsoft_windows? and (value =~ /^.:\// or value =~ /^\/\/[^\/]+\/[^\/]+/)) - raise(Puppet::Error, "File paths must be fully qualified, not '#{value}'") - end - end - end - - # Autorequire the file resource if it's being managed - autorequire(:file) do - self[:path] - end - - validate do - unless self[:line] and self[:path] - raise(Puppet::Error, "Both line and path are required attributes") - end - - if (self[:match]) - unless Regexp.new(self[:match]).match(self[:line]) - raise(Puppet::Error, "When providing a 'match' parameter, the value must be a regex that matches against the value of your 'line' parameter") - end - end - - end -end diff --git a/puppet/modules/stdlib/manifests/init.pp b/puppet/modules/stdlib/manifests/init.pp deleted file mode 100644 index 500ad77..0000000 --- a/puppet/modules/stdlib/manifests/init.pp +++ /dev/null @@ -1,20 +0,0 @@ -# Class: stdlib -# -# This module manages stdlib. Most of stdlib's features are automatically -# loaded by Puppet, but this class should be declared in order to use the -# standardized run stages. -# -# Parameters: none -# -# Actions: -# -# Declares all other classes in the stdlib module. Currently, this consists -# of stdlib::stages. -# -# Requires: nothing -# -class stdlib { - - class { 'stdlib::stages': } - -} diff --git a/puppet/modules/stdlib/manifests/stages.pp b/puppet/modules/stdlib/manifests/stages.pp deleted file mode 100644 index eb15fd6..0000000 --- a/puppet/modules/stdlib/manifests/stages.pp +++ /dev/null @@ -1,43 +0,0 @@ -# Class: stdlib::stages -# -# This class manages a standard set of run stages for Puppet. It is managed by -# the stdlib class, and should not be declared independently. -# -# The high level stages are (in order): -# -# * setup -# * main -# * runtime -# * setup_infra -# * deploy_infra -# * setup_app -# * deploy_app -# * deploy -# -# Parameters: none -# -# Actions: -# -# Declares various run-stages for deploying infrastructure, -# language runtimes, and application layers. -# -# Requires: nothing -# -# Sample Usage: -# -# node default { -# include stdlib -# class { java: stage => 'runtime' } -# } -# -class stdlib::stages { - - stage { 'setup': before => Stage['main'] } - stage { 'runtime': require => Stage['main'] } - -> stage { 'setup_infra': } - -> stage { 'deploy_infra': } - -> stage { 'setup_app': } - -> stage { 'deploy_app': } - -> stage { 'deploy': } - -} diff --git a/puppet/modules/stdlib/metadata.json b/puppet/modules/stdlib/metadata.json deleted file mode 100644 index 5d3308e..0000000 --- a/puppet/modules/stdlib/metadata.json +++ /dev/null @@ -1,270 +0,0 @@ -{ - "types": [ - { - "doc": " A simple resource type intended to be used as an anchor in a composite class.\n\n In Puppet 2.6, when a class declares another class, the resources in the\n interior class are not contained by the exterior class. This interacts badly\n with the pattern of composing complex modules from smaller classes, as it\n makes it impossible for end users to specify order relationships between the\n exterior class and other modules.\n\n The anchor type lets you work around this. By sandwiching any interior\n classes between two no-op resources that _are_ contained by the exterior\n class, you can ensure that all resources in the module are contained.\n\n class ntp {\n # These classes will have the correct order relationship with each\n # other. However, without anchors, they won't have any order\n # relationship to Class['ntp'].\n class { 'ntp::package': }\n -> class { 'ntp::config': }\n -> class { 'ntp::service': }\n\n # These two resources \"anchor\" the composed classes within the ntp\n # class.\n anchor { 'ntp::begin': } -> Class['ntp::package']\n Class['ntp::service'] -> anchor { 'ntp::end': }\n }\n\n This allows the end user of the ntp module to establish require and before\n relationships with Class['ntp']:\n\n class { 'ntp': } -> class { 'mcollective': }\n class { 'mcollective': } -> class { 'ntp': }\n\n", - "parameters": [ - { - "doc": "The name of the anchor resource.", - "name": "name" - } - ], - "name": "anchor", - "properties": [ - - ] - }, - { - "doc": " Ensures that a given line is contained within a file. The implementation\n matches the full line, including whitespace at the beginning and end. If\n the line is not contained in the given file, Puppet will add the line to\n ensure the desired state. Multiple resources may be declared to manage\n multiple lines in the same file.\n\n Example:\n\n file_line { 'sudo_rule':\n path => '/etc/sudoers',\n line => '%sudo ALL=(ALL) ALL',\n }\n file_line { 'sudo_rule_nopw':\n path => '/etc/sudoers',\n line => '%sudonopw ALL=(ALL) NOPASSWD: ALL',\n }\n\n In this example, Puppet will ensure both of the specified lines are\n contained in the file /etc/sudoers.\n\n", - "providers": [ - { - "doc": "", - "name": "ruby" - } - ], - "parameters": [ - { - "doc": "An arbitrary name used as the identity of the resource.", - "name": "name" - }, - { - "doc": "An optional regular expression to run against existing lines in the file;\\nif a match is found, we replace that line rather than adding a new line.", - "name": "match" - }, - { - "doc": "The line to be appended to the file located by the path parameter.", - "name": "line" - }, - { - "doc": "The file Puppet will ensure contains the line specified by the line parameter.", - "name": "path" - } - ], - "name": "file_line", - "properties": [ - { - "doc": "The basic property that the resource should be in. Valid values are `present`, `absent`.", - "name": "ensure" - } - ] - } - ], - "license": "Apache 2.0", - "checksums": { - "spec/unit/puppet/parser/functions/uriescape_spec.rb": "8d9e15156d93fe29bfe91a2e83352ff4", - "Gemfile": "a7144ac8fdb2255ed7badb6b54f6c342", - "spec/unit/facter/root_home_spec.rb": "4f4c4236ac2368d2e27fd2f3eb606a19", - "spec/unit/puppet/parser/functions/size_spec.rb": "d126b696b21a8cd754d58f78ddba6f06", - "spec/unit/puppet/parser/functions/shuffle_spec.rb": "2141a54d2fb3cf725b88184d639677f4", - "spec/unit/puppet/parser/functions/validate_re_spec.rb": "b21292ad2f30c0d43ab2f0c2df0ba7d5", - "lib/puppet/parser/functions/flatten.rb": "25777b76f9719162a8bab640e5595b7a", - "lib/puppet/parser/functions/ensure_packages.rb": "ca852b2441ca44b91a984094de4e3afc", - "lib/puppet/parser/functions/validate_augeas.rb": "d4acca7b8a9fdada9ae39e5101902cc1", - "spec/unit/puppet/parser/functions/unique_spec.rb": "2df8b3b2edb9503943cb4dcb4a371867", - "tests/has_ip_network.pp": "abc05686797a776ea8c054657e6f7456", - "spec/fixtures/manifests/site.pp": "d41d8cd98f00b204e9800998ecf8427e", - "lib/puppet/parser/functions/defined_with_params.rb": "ffab4433d03f32b551f2ea024a2948fc", - "lib/puppet/parser/functions/size.rb": "8972d48c0f9e487d659bd7326b40b642", - "lib/puppet/parser/functions/has_ip_address.rb": "ee207f47906455a5aa49c4fb219dd325", - "lib/facter/util/puppet_settings.rb": "9f1d2593d0ae56bfca89d4b9266aeee1", - "spec/unit/puppet/parser/functions/any2array_spec.rb": "167e114cfa222de971bf8be141766b6a", - "spec/unit/facter/pe_required_facts_spec.rb": "0ec83db2a004a0d7f6395b34939c53b9", - "spec/unit/puppet/parser/functions/bool2num_spec.rb": "67c3055d5d4e4c9fbcaca82038a09081", - "lib/facter/root_home.rb": "f559294cceafcf70799339627d94871d", - "lib/puppet/parser/functions/loadyaml.rb": "2b912f257aa078e376d3b3f6a86c2a00", - "spec/unit/puppet/parser/functions/is_float_spec.rb": "171fc0e382d9856c2d8db2b70c9ec9cd", - "lib/puppet/type/anchor.rb": "bbd36bb49c3b554f8602d8d3df366c0c", - "lib/puppet/parser/functions/getparam.rb": "4dd7a0e35f4a3780dcfc9b19b4e0006e", - "lib/facter/facter_dot_d.rb": "b35b8b59ec579901444f984127f0b833", - "lib/puppet/parser/functions/strftime.rb": "e02e01a598ca5d7d6eee0ba22440304a", - "lib/puppet/parser/functions/max.rb": "f652fd0b46ef7d2fbdb42b141f8fdd1d", - "spec/spec_helper.rb": "4449b0cafd8f7b2fb440c0cdb0a1f2b3", - "lib/puppet/parser/functions/merge.rb": "52281fe881b762e2adfef20f58dc4180", - "lib/puppet/parser/functions/validate_slength.rb": "0ca530d1d3b45c3fe2d604c69acfc22f", - "spec/unit/puppet/parser/functions/suffix_spec.rb": "c3eed8e40066f2ad56264405c4192f2e", - "spec/unit/puppet/parser/functions/validate_bool_spec.rb": "32a580f280ba62bf17ccd30460d357bd", - "spec/unit/puppet/parser/functions/str2bool_spec.rb": "60e3eaea48b0f6efccc97010df7d912c", - "lib/puppet/parser/functions/reject.rb": "689f6a7c961a55fe9dcd240921f4c7f9", - "lib/puppet/parser/functions/delete.rb": "9b17b9f7f820adf02360147c1a2f4279", - "lib/puppet/parser/functions/strip.rb": "273d547c7b05c0598556464dfd12f5fd", - "lib/puppet/parser/functions/values.rb": "066a6e4170e5034edb9a80463dff2bb5", - "LICENSE": "38a048b9d82e713d4e1b2573e370a756", - "lib/puppet/parser/functions/is_array.rb": "875ca4356cb0d7a10606fb146b4a3d11", - "spec/unit/puppet/parser/functions/strip_spec.rb": "a01796bebbdabd3fad12b0662ea5966e", - "lib/puppet/parser/functions/swapcase.rb": "4902f38f0b9292afec66d40fee4b02ec", - "lib/puppet/parser/functions/has_ip_network.rb": "b4d726c8b2a0afac81ced8a3a28aa731", - "spec/unit/puppet/parser/functions/validate_array_spec.rb": "bcd231229554785c4270ca92ef99cb60", - "lib/puppet/parser/functions/validate_re.rb": "c6664b3943bc820415a43f16372dc2a9", - "lib/puppet/parser/functions/time.rb": "08d88d52abd1e230e3a2f82107545d48", - "lib/puppet/parser/functions/is_numeric.rb": "0a9bcc49e8f57af81bdfbb7e7c3a575c", - "spec/unit/puppet/parser/functions/merge_spec.rb": "a63c0bc2f812e27fbef570d834ef61ce", - "lib/puppet/parser/functions/count.rb": "9eb74eccd93e2b3c87fd5ea14e329eba", - "spec/unit/puppet/parser/functions/values_at_spec.rb": "de45fd8abbc4c037c3c4fac2dcf186f9", - "spec/monkey_patches/publicize_methods.rb": "ce2c98f38b683138c5ac649344a39276", - "spec/unit/puppet/parser/functions/is_hash_spec.rb": "408e121a5e30c4c5c4a0a383beb6e209", - "lib/puppet/parser/functions/chop.rb": "4691a56e6064b792ed4575e4ad3f3d20", - "spec/unit/puppet/parser/functions/validate_cmd_spec.rb": "538db08292a0ecc4cd902a14aaa55d74", - "spec/unit/puppet/parser/functions/is_integer_spec.rb": "a302cf1de5ccb494ca9614d2fc2b53c5", - "spec/functions/ensure_resource_spec.rb": "3423a445e13efc7663a71c6641d49d07", - "spec/unit/puppet/parser/functions/keys_spec.rb": "35cc2ed490dc68da6464f245dfebd617", - "manifests/init.pp": "f2ba5f36e7227ed87bbb69034fc0de8b", - "lib/puppet/parser/functions/dirname.rb": "bef7214eb89db3eb8f7ee5fc9dca0233", - "lib/puppet/parser/functions/validate_hash.rb": "e9cfaca68751524efe16ecf2f958a9a0", - "lib/puppet/parser/functions/join_keys_to_values.rb": "f29da49531228f6ca5b3aa0df00a14c2", - "spec/unit/puppet/parser/functions/delete_spec.rb": "0d84186ea618523b4b2a4ca0b5a09c9e", - "lib/puppet/parser/functions/validate_string.rb": "6afcbc51f83f0714348b8d61e06ea7eb", - "spec/unit/puppet/parser/functions/rstrip_spec.rb": "a408e933753c9c323a05d7079d32cbb3", - "spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb": "c67b71737bee9936f5261d41a37bad46", - "spec/unit/puppet/parser/functions/concat_spec.rb": "c21aaa84609f92290d5ffb2ce8ea4bf5", - "lib/puppet/parser/functions/unique.rb": "217ccce6d23235af92923f50f8556963", - "CHANGELOG": "344383410cb78409f0c59ecf38e8c21a", - "lib/puppet/parser/functions/member.rb": "541e67d06bc4155e79b00843a125e9bc", - "spec/unit/puppet/parser/functions/validate_string_spec.rb": "64a4f681084cba55775a070f7fab5e0c", - "lib/facter/puppet_vardir.rb": "c7ddc97e8a84ded3dd93baa5b9b3283d", - "lib/puppet/parser/functions/pick.rb": "2bede116a0651405c47e650bbf942abe", - "spec/unit/puppet/parser/functions/parseyaml_spec.rb": "65dfed872930ffe0d21954c15daaf498", - "lib/puppet/parser/functions/delete_at.rb": "6bc24b79390d463d8be95396c963381a", - "lib/puppet/parser/functions/zip.rb": "a80782461ed9465f0cd0c010936f1855", - "tests/file_line.pp": "67727539aa7b7dd76f06626fe734f7f7", - "lib/puppet/parser/functions/ensure_resource.rb": "3f68b8e17a16bfd01455cd73f8e324ba", - "lib/puppet/parser/functions/num2bool.rb": "605c12fa518c87ed2c66ae153e0686ce", - "spec/unit/puppet/parser/functions/grep_spec.rb": "78179537496a7150469e591a95e255d8", - "lib/puppet/parser/functions/keys.rb": "eb6ac815ea14fbf423580ed903ef7bad", - "spec/unit/puppet/parser/functions/num2bool_spec.rb": "8cd5b46b7c8e612dfae3362e3a68a5f9", - "lib/puppet/parser/functions/parsejson.rb": "e7f968c34928107b84cd0860daf50ab1", - "lib/puppet/parser/functions/is_mac_address.rb": "288bd4b38d4df42a83681f13e7eaaee0", - "lib/puppet/parser/functions/join.rb": "b28087823456ca5cf943de4a233ac77f", - "spec/unit/puppet/parser/functions/type_spec.rb": "422f2c33458fe9b0cc9614d16f7573ba", - "lib/puppet/parser/functions/downcase.rb": "9204a04c2a168375a38d502db8811bbe", - "spec/unit/puppet/parser/functions/validate_augeas_spec.rb": "1d5bcfbf97dc56b45734248a14358d4f", - "spec/unit/puppet/parser/functions/has_ip_address_spec.rb": "f53c7baeaf024ff577447f6c28c0f3a7", - "lib/puppet/parser/functions/is_function_available.rb": "88c63869cb5df3402bc9756a8d40c16d", - "lib/puppet/parser/functions/prefix.rb": "21fd6a2c1ee8370964346b3bfe829d2b", - "spec/watchr.rb": "b588ddf9ef1c19ab97aa892cc776da73", - "spec/unit/puppet/parser/functions/has_key_spec.rb": "3e4e730d98bbdfb88438b6e08e45868e", - "lib/puppet/parser/functions/values_at.rb": "094ac110ce9f7a5b16d0c80a0cf2243c", - "lib/puppet/parser/functions/fqdn_rotate.rb": "20743a138c56fc806a35cb7b60137dbc", - "lib/puppet/parser/functions/rstrip.rb": "8a0d69876bdbc88a2054ba41c9c38961", - "spec/unit/puppet/parser/functions/validate_slength_spec.rb": "a1b4d805149dc0143e9a57e43e1f84bf", - "spec/functions/ensure_packages_spec.rb": "935b4aec5ab36bdd0458c1a9b2a93ad5", - "lib/puppet/parser/functions/suffix.rb": "109279db4180441e75545dbd5f273298", - "lib/puppet/parser/functions/str2saltedsha512.rb": "49afad7b386be38ce53deaefef326e85", - "spec/unit/puppet/parser/functions/count_spec.rb": "db98ef89752a7112425f0aade10108e0", - "lib/puppet/parser/functions/hash.rb": "9d072527dfc7354b69292e9302906530", - "manifests/stages.pp": "cc6ed1751d334b0ea278c0335c7f0b5a", - "spec/unit/puppet/parser/functions/is_ip_address_spec.rb": "6040a9bae4e5c853966148b634501157", - "spec/unit/facter/pe_version_spec.rb": "ef031cca838f36f99b1dab3259df96a5", - "spec/unit/puppet/parser/functions/get_module_path_spec.rb": "b7ea196f548b1a9a745ab6671295ab27", - "lib/puppet/parser/functions/is_integer.rb": "a50ebc15c30bffd759e4a6f8ec6a0cf3", - "lib/puppet/parser/functions/reverse.rb": "1386371c0f5301055fdf99079e862b3e", - "spec/unit/puppet/parser/functions/has_interface_with_spec.rb": "7c16d731c518b434c81b8cb2227cc916", - "README_SPECS.markdown": "82bb4c6abbb711f40778b162ec0070c1", - "spec/unit/puppet/parser/functions/is_domain_name_spec.rb": "8eed3a9eb9334bf6a473ad4e2cabc2ec", - "spec/unit/puppet/parser/functions/join_spec.rb": "c3b50c39390a86b493511be2c6722235", - "lib/puppet/parser/functions/chomp.rb": "719d46923d75251f7b6b68b6e015cccc", - "lib/puppet/parser/functions/is_string.rb": "2bd9a652bbb2668323eee6c57729ff64", - "spec/unit/puppet/parser/functions/is_array_spec.rb": "8c020af9c360abdbbf1ba887bb26babe", - "Modulefile": "351bba73290cd526ca7bacd4c7d250dc", - "spec/unit/puppet/parser/functions/reject_spec.rb": "8e16c9f064870e958b6278261e480954", - "spec/unit/puppet/type/file_line_spec.rb": "d9f4e08e8b98e565a07f1b995593fa89", - "spec/unit/puppet/parser/functions/lstrip_spec.rb": "1fc2c2d80b5f724a358c3cfeeaae6249", - "lib/puppet/parser/functions/type.rb": "62f914d6c90662aaae40c5539701be60", - "lib/puppet/parser/functions/shuffle.rb": "6445e6b4dc62c37b184a60eeaf34414b", - "lib/puppet/parser/functions/has_key.rb": "7cd9728c38f0b0065f832dabd62b0e7e", - "lib/puppet/parser/functions/concat.rb": "f28a09811ff4d19bb5e7a540e767d65c", - "spec/unit/puppet/parser/functions/capitalize_spec.rb": "82a4209a033fc88c624f708c12e64e2a", - "tests/init.pp": "1d98070412c76824e66db4b7eb74d433", - "lib/puppet/provider/file_line/ruby.rb": "a445a57f9b884037320ea37307dbc92b", - "tests/has_ip_address.pp": "93ce02915f67ddfb43a049b2b84ef391", - "spec/unit/puppet/parser/functions/min_spec.rb": "bf80bf58261117bb24392670b624a611", - "lib/puppet/parser/functions/to_bytes.rb": "83f23c33adbfa42b2a9d9fc2db3daeb4", - "lib/puppet/parser/functions/sort.rb": "504b033b438461ca4f9764feeb017833", - "lib/puppet/parser/functions/capitalize.rb": "14481fc8c7c83fe002066ebcf6722f17", - "lib/puppet/type/file_line.rb": "3e8222cb58f3503b3ea7de3647c602a0", - "lib/puppet/parser/functions/has_interface_with.rb": "8d3ebca805dc6edb88b6b7a13d404787", - "spec/functions/getparam_spec.rb": "122f37cf9ec7489f1dae10db39c871b5", - "Rakefile": "f37e6131fe7de9a49b09d31596f5fbf1", - "spec/unit/puppet/parser/functions/downcase_spec.rb": "b0197829512f2e92a2d2b06ce8e2226f", - "spec/unit/puppet/parser/functions/max_spec.rb": "5562bccc643443af7e4fa7c9d1e52b8b", - "lib/puppet/parser/functions/validate_absolute_path.rb": "385137ac24a2dec6cecc4e6ea75be442", - "spec/unit/puppet/parser/functions/getvar_spec.rb": "842bf88d47077a9ae64097b6e39c3364", - "spec/unit/puppet/parser/functions/sort_spec.rb": "7039cd230a94e95d9d1de2e1094acae2", - "spec/unit/puppet/parser/functions/strftime_spec.rb": "bf140883ecf3254277306fa5b25f0344", - "spec/unit/puppet/parser/functions/is_mac_address_spec.rb": "644cd498b426ff2f9ea9cbc5d8e141d7", - "spec/unit/puppet/parser/functions/empty_spec.rb": "028c30267d648a172d8a81a9262c3abe", - "lib/puppet/parser/functions/is_domain_name.rb": "fba9f855df3bbf90d72dfd5201f65d2b", - "lib/puppet/parser/functions/get_module_path.rb": "d4bf50da25c0b98d26b75354fa1bcc45", - "spec/unit/puppet/provider/file_line/ruby_spec.rb": "e8cd7432739cb212d40a9148523bd4d7", - "spec/unit/puppet/parser/functions/reverse_spec.rb": "48169990e59081ccbd112b6703418ce4", - "spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb": "1de174be8835ba6fef86b590887bb2cc", - "spec/unit/puppet/parser/functions/prefix_spec.rb": "16a95b321d76e773812693c80edfbe36", - "spec/spec.opts": "a600ded995d948e393fbe2320ba8e51c", - "spec/monkey_patches/alias_should_to_must.rb": "7cd4065c63f06f1ab3aaa1c5f92af947", - "lib/puppet/parser/functions/uriescape.rb": "9ebc34f1b2f319626512b8cd7cde604c", - "lib/puppet/parser/functions/floor.rb": "c5a960e9714810ebb99198ff81a11a3b", - "lib/puppet/parser/functions/empty.rb": "ae92905c9d94ddca30bf56b7b1dabedf", - "spec/unit/puppet/parser/functions/range_spec.rb": "91d69115dea43f62a2dca9a10467d836", - "tests/has_interface_with.pp": "59c98b4af0d39fc11d1ef4c7a6dc8f7a", - "spec/unit/puppet/parser/functions/is_function_available.rb": "069ef7490eba66424cab75444f36828a", - "README_DEVELOPER.markdown": "220a8b28521b5c5d2ea87c4ddb511165", - "spec/unit/puppet/parser/functions/flatten_spec.rb": "583c9a70f93e492cfb22ffa1811f6aa0", - "lib/puppet/parser/functions/upcase.rb": "a5744a74577cfa136fca2835e75888d3", - "lib/puppet/parser/functions/str2bool.rb": "c822a8944747f5624b13f2da0df8db21", - "lib/puppet/parser/functions/is_hash.rb": "8c7d9a05084dab0389d1b779c8a05b1a", - "lib/puppet/parser/functions/abs.rb": "32161bd0435fdfc2aec2fc559d2b454b", - "spec/unit/puppet/parser/functions/validate_hash_spec.rb": "8529c74051ceb71e6b1b97c9cecdf625", - "spec/unit/puppet/parser/functions/member_spec.rb": "067c60985efc57022ca1c5508d74d77f", - "README.markdown": "b63097a958f22abf7999d475a6a4d32a", - "spec/unit/puppet/parser/functions/values_spec.rb": "0ac9e141ed1f612d7cc224f747b2d1d9", - "lib/puppet/parser/functions/validate_cmd.rb": "0319a15d24fd077ebabc2f79969f6ab5", - "lib/puppet/parser/functions/is_float.rb": "f1b0d333061d31bf0c25bd4c33dc134b", - "lib/puppet/parser/functions/bool2num.rb": "8e627eee990e811e35e7e838c586bd77", - "lib/puppet/parser/functions/validate_bool.rb": "4ddffdf5954b15863d18f392950b88f4", - "lib/puppet/parser/functions/grep.rb": "5682995af458b05f3b53dd794c4bf896", - "spec/unit/puppet/parser/functions/upcase_spec.rb": "813668919bc62cdd1d349dafc19fbbb3", - "spec/unit/puppet/parser/functions/parsejson_spec.rb": "37ab84381e035c31d6a3dd9bf73a3d53", - "spec/unit/puppet/parser/functions/squeeze_spec.rb": "df5b349c208a9a2a4d4b8e6d9324756f", - "spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb": "07839082d24d5a7628fd5bce6c8b35c3", - "spec/unit/puppet/parser/functions/chop_spec.rb": "4e9534d25b952b261c9f46add677c390", - "lib/puppet/parser/functions/squeeze.rb": "541f85b4203b55c9931d3d6ecd5c75f8", - "lib/puppet/parser/functions/lstrip.rb": "210b103f78622e099f91cc2956b6f741", - "spec/unit/puppet/type/anchor_spec.rb": "a5478a72a7fab2d215f39982a9230c18", - "lib/facter/pe_version.rb": "4a9353952963b011759f3e6652a10da5", - "spec/unit/puppet/parser/functions/hash_spec.rb": "826337a92d8f7a189b7ac19615db0ed7", - "spec/unit/puppet/parser/functions/floor_spec.rb": "d01ef7dfe0245d7a0a73d7df13cb02e3", - "spec/unit/puppet/parser/functions/time_spec.rb": "b6d0279062779efe5153fe5cfafc5bbd", - "spec/unit/puppet/parser/functions/swapcase_spec.rb": "0660ce8807608cc8f98ad1edfa76a402", - "lib/puppet/parser/functions/validate_array.rb": "72b29289b8af1cfc3662ef9be78911b8", - "lib/puppet/parser/functions/is_ip_address.rb": "a714a736c1560e8739aaacd9030cca00", - "lib/puppet/parser/functions/getvar.rb": "10bf744212947bc6a7bfd2c9836dbd23", - "RELEASE_PROCESS.markdown": "94b92bc99ac4106ba1a74d5c04e520f9", - "spec/classes/anchor_spec.rb": "695d65275c3ac310d7fa23b91f8bbb4a", - "lib/puppet/parser/functions/any2array.rb": "a81e71d6b67a551d38770ba9a1948a75", - "spec/functions/defined_with_params_spec.rb": "3bdfac38e3d6f06140ff2e926f4ebed2", - "spec/unit/puppet/parser/functions/pick_spec.rb": "aba6247d3925e373272fca6768fd5403", - "spec/unit/puppet/parser/functions/to_bytes_spec.rb": "80aaf68cf7e938e46b5278c1907af6be", - "spec/unit/puppet/parser/functions/is_string_spec.rb": "5c015d8267de852da3a12b984e077092", - "spec/unit/puppet/parser/functions/abs_spec.rb": "0a5864a29a8e9e99acc483268bd5917c", - "spec/unit/facter/util/puppet_settings_spec.rb": "345bcbef720458e25be0190b7638e4d9", - "spec/unit/puppet/parser/functions/zip_spec.rb": "06a86e4e70d2aea63812582aae1d26c4", - "spec/unit/puppet/parser/functions/dirname_spec.rb": "1d7cf70468c2cfa6dacfc75935322395", - "spec/unit/puppet/parser/functions/delete_at_spec.rb": "5a4287356b5bd36a6e4c100421215b8e", - "spec/unit/puppet/parser/functions/chomp_spec.rb": "3cd8e2fe6b12efeffad94cce5b693b7c", - "spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb": "7c7937411b7fe4bb944c0c022d3a96b0", - "lib/puppet/parser/functions/range.rb": "033048bba333fe429e77e0f2e91db25f", - "lib/puppet/parser/functions/parseyaml.rb": "00f10ec1e2b050e23d80c256061ebdd7", - "spec/unit/puppet/parser/functions/is_numeric_spec.rb": "5f08148803b6088c27b211c446ad3658", - "spec/unit/puppet/parser/functions/has_ip_network_spec.rb": "885ea8a4c987b735d683b742bf846cb1", - "lib/puppet/parser/functions/min.rb": "0d2a1b7e735ab251c5469e735fa3f4c6", - "CONTRIBUTING.md": "fdddc4606dc3b6949e981e6bf50bc8e5" - }, - "version": "4.1.0", - "description": "Standard Library for Puppet Modules", - "source": "git://github.com/puppetlabs/puppetlabs-stdlib.git", - "project_page": "https://github.com/puppetlabs/puppetlabs-stdlib", - "summary": "Puppet Module Standard Library", - "dependencies": [ - - ], - "author": "puppetlabs", - "name": "puppetlabs-stdlib" -} \ No newline at end of file diff --git a/puppet/modules/stdlib/spec/classes/anchor_spec.rb b/puppet/modules/stdlib/spec/classes/anchor_spec.rb deleted file mode 100644 index 2dd17de..0000000 --- a/puppet/modules/stdlib/spec/classes/anchor_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'puppet' -require 'rspec-puppet' - -describe "anchorrefresh" do - let(:node) { 'testhost.example.com' } - let :pre_condition do - <<-ANCHORCLASS -class anchored { - anchor { 'anchored::begin': } - ~> anchor { 'anchored::end': } -} - -class anchorrefresh { - notify { 'first': } - ~> class { 'anchored': } - ~> anchor { 'final': } -} - ANCHORCLASS - end - - def apply_catalog_and_return_exec_rsrc - catalog = subject.to_ral - transaction = catalog.apply - transaction.resource_status("Anchor[final]") - end - - it 'propagates events through the anchored class' do - resource = apply_catalog_and_return_exec_rsrc - - expect(resource.restarted).to eq(true) - end -end diff --git a/puppet/modules/stdlib/spec/fixtures/manifests/site.pp b/puppet/modules/stdlib/spec/fixtures/manifests/site.pp deleted file mode 100644 index e69de29..0000000 --- a/puppet/modules/stdlib/spec/fixtures/manifests/site.pp +++ /dev/null diff --git a/puppet/modules/stdlib/spec/functions/defined_with_params_spec.rb b/puppet/modules/stdlib/spec/functions/defined_with_params_spec.rb deleted file mode 100644 index 28dbab3..0000000 --- a/puppet/modules/stdlib/spec/functions/defined_with_params_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -require 'rspec-puppet' -describe 'defined_with_params' do - describe 'when a resource is not specified' do - it { should run.with_params().and_raise_error(ArgumentError) } - end - describe 'when compared against a resource with no attributes' do - let :pre_condition do - 'user { "dan": }' - end - it do - should run.with_params('User[dan]', {}).and_return(true) - should run.with_params('User[bob]', {}).and_return(false) - should run.with_params('User[dan]', {'foo' => 'bar'}).and_return(false) - end - end - - describe 'when compared against a resource with attributes' do - let :pre_condition do - 'user { "dan": ensure => present, shell => "/bin/csh", managehome => false}' - end - it do - should run.with_params('User[dan]', {}).and_return(true) - should run.with_params('User[dan]', '').and_return(true) - should run.with_params('User[dan]', {'ensure' => 'present'} - ).and_return(true) - should run.with_params('User[dan]', - {'ensure' => 'present', 'managehome' => false} - ).and_return(true) - should run.with_params('User[dan]', - {'ensure' => 'absent', 'managehome' => false} - ).and_return(false) - end - end -end diff --git a/puppet/modules/stdlib/spec/functions/ensure_packages_spec.rb b/puppet/modules/stdlib/spec/functions/ensure_packages_spec.rb deleted file mode 100644 index 1c2a328..0000000 --- a/puppet/modules/stdlib/spec/functions/ensure_packages_spec.rb +++ /dev/null @@ -1,42 +0,0 @@ -#! /usr/bin/env ruby - -require 'spec_helper' -require 'rspec-puppet' - -describe 'ensure_packages' do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - describe 'argument handling' do - it 'fails with no arguments' do - should run.with_params().and_raise_error(Puppet::ParseError) - end - it 'requires an array' do - lambda { scope.function_ensure_packages([['foo']]) }.should_not raise_error - end - it 'fails when given a string' do - should run.with_params('foo').and_raise_error(Puppet::ParseError) - end - end - - context 'given a catalog containing Package[puppet]{ensure => absent}' do - let :pre_condition do - 'package { puppet: ensure => absent }' - end - - # NOTE: should run.with_params has the side effect of making the compiler - # available to the test harness. - it 'has no effect on Package[puppet]' do - should run.with_params(['puppet']) - rsrc = compiler.catalog.resource('Package[puppet]') - rsrc.to_hash.should == {:ensure => "absent"} - end - end - - context 'given a clean catalog' do - it 'declares package resources with ensure => present' do - should run.with_params(['facter']) - rsrc = compiler.catalog.resource('Package[facter]') - rsrc.to_hash.should == {:name => "facter", :ensure => "present"} - end - end -end diff --git a/puppet/modules/stdlib/spec/functions/ensure_resource_spec.rb b/puppet/modules/stdlib/spec/functions/ensure_resource_spec.rb deleted file mode 100644 index 2e8aefc..0000000 --- a/puppet/modules/stdlib/spec/functions/ensure_resource_spec.rb +++ /dev/null @@ -1,64 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -require 'rspec-puppet' -describe 'ensure_resource' do - describe 'when a type or title is not specified' do - it { should run.with_params().and_raise_error(ArgumentError) } - it { should run.with_params(['type']).and_raise_error(ArgumentError) } - end - - describe 'when compared against a resource with no attributes' do - let :pre_condition do - 'user { "dan": }' - end - it "should contain the the ensured resources" do - subject.should run.with_params('user', 'dan', {}) - compiler.catalog.resource('User[dan]').to_s.should == 'User[dan]' - end - end - - describe 'when compared against a resource with attributes' do - let :pre_condition do - 'user { "dan": ensure => present, shell => "/bin/csh", managehome => false}' - end - # these first three should not fail - it { should run.with_params('User', 'dan', {}) } - it { should run.with_params('User', 'dan', '') } - it { should run.with_params('User', 'dan', {'ensure' => 'present'}) } - it { should run.with_params('User', 'dan', {'ensure' => 'present', 'managehome' => false}) } - # test that this fails - it { should run.with_params('User', 'dan', {'ensure' => 'absent', 'managehome' => false}).and_raise_error(Puppet::Error) } - end - - describe 'when an array of new resources are passed in' do - it "should contain the ensured resources" do - subject.should run.with_params('User', ['dan', 'alex'], {}) - compiler.catalog.resource('User[dan]').to_s.should == 'User[dan]' - compiler.catalog.resource('User[alex]').to_s.should == 'User[alex]' - end - end - - describe 'when an array of existing resources is compared against existing resources' do - let :pre_condition do - 'user { "dan": ensure => present; "alex": ensure => present }' - end - it "should return the existing resources" do - subject.should run.with_params('User', ['dan', 'alex'], {}) - compiler.catalog.resource('User[dan]').to_s.should == 'User[dan]' - compiler.catalog.resource('User[alex]').to_s.should == 'User[alex]' - end - end - - describe 'when compared against existing resources with attributes' do - let :pre_condition do - 'user { "dan": ensure => present; "alex": ensure => present }' - end - # These should not fail - it { should run.with_params('User', ['dan', 'alex'], {}) } - it { should run.with_params('User', ['dan', 'alex'], '') } - it { should run.with_params('User', ['dan', 'alex'], {'ensure' => 'present'}) } - # This should fail - it { should run.with_params('User', ['dan', 'alex'], {'ensure' => 'absent'}).and_raise_error(Puppet::Error) } - end -end diff --git a/puppet/modules/stdlib/spec/functions/getparam_spec.rb b/puppet/modules/stdlib/spec/functions/getparam_spec.rb deleted file mode 100644 index d9c50a6..0000000 --- a/puppet/modules/stdlib/spec/functions/getparam_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -require 'rspec-puppet' -describe 'getparam' do - describe 'when a resource is not specified' do - it do - should run.with_params().and_raise_error(ArgumentError) - should run.with_params('User[dan]').and_raise_error(ArgumentError) - should run.with_params('User[dan]', {}).and_raise_error(ArgumentError) - should run.with_params('User[dan]', '').and_return('') - end - end - describe 'when compared against a resource with no params' do - let :pre_condition do - 'user { "dan": }' - end - it do - should run.with_params('User[dan]', 'shell').and_return('') - end - end - - describe 'when compared against a resource with params' do - let :pre_condition do - 'user { "dan": ensure => present, shell => "/bin/sh", managehome => false}' - end - it do - should run.with_params('User[dan]', 'shell').and_return('/bin/sh') - should run.with_params('User[dan]', '').and_return('') - should run.with_params('User[dan]', 'ensure').and_return('present') - should run.with_params('User[dan]', 'managehome').and_return(false) - end - end -end diff --git a/puppet/modules/stdlib/spec/monkey_patches/alias_should_to_must.rb b/puppet/modules/stdlib/spec/monkey_patches/alias_should_to_must.rb deleted file mode 100755 index 1a11117..0000000 --- a/puppet/modules/stdlib/spec/monkey_patches/alias_should_to_must.rb +++ /dev/null @@ -1,8 +0,0 @@ -require 'rspec' - -class Object - # This is necessary because the RAL has a 'should' - # method. - alias :must :should - alias :must_not :should_not -end diff --git a/puppet/modules/stdlib/spec/monkey_patches/publicize_methods.rb b/puppet/modules/stdlib/spec/monkey_patches/publicize_methods.rb deleted file mode 100755 index f3a1abf..0000000 --- a/puppet/modules/stdlib/spec/monkey_patches/publicize_methods.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Some monkey-patching to allow us to test private methods. -class Class - def publicize_methods(*methods) - saved_private_instance_methods = methods.empty? ? self.private_instance_methods : methods - - self.class_eval { public(*saved_private_instance_methods) } - yield - self.class_eval { private(*saved_private_instance_methods) } - end -end diff --git a/puppet/modules/stdlib/spec/spec.opts b/puppet/modules/stdlib/spec/spec.opts deleted file mode 100644 index 91cd642..0000000 --- a/puppet/modules/stdlib/spec/spec.opts +++ /dev/null @@ -1,6 +0,0 @@ ---format -s ---colour ---loadby -mtime ---backtrace diff --git a/puppet/modules/stdlib/spec/spec_helper.rb b/puppet/modules/stdlib/spec/spec_helper.rb deleted file mode 100644 index 931d35c..0000000 --- a/puppet/modules/stdlib/spec/spec_helper.rb +++ /dev/null @@ -1,28 +0,0 @@ -dir = File.expand_path(File.dirname(__FILE__)) -$LOAD_PATH.unshift File.join(dir, 'lib') - -# Don't want puppet getting the command line arguments for rake or autotest -ARGV.clear - -require 'puppet' -require 'facter' -require 'mocha' -gem 'rspec', '>=2.0.0' -require 'rspec/expectations' - -require 'puppetlabs_spec_helper/module_spec_helper' - -RSpec.configure do |config| - # FIXME REVISIT - We may want to delegate to Facter like we do in - # Puppet::PuppetSpecInitializer.initialize_via_testhelper(config) because - # this behavior is a duplication of the spec_helper in Facter. - config.before :each do - # Ensure that we don't accidentally cache facts and environment between - # test cases. This requires each example group to explicitly load the - # facts being exercised with something like - # Facter.collection.loader.load(:ipaddress) - Facter::Util::Loader.any_instance.stubs(:load_all) - Facter.clear - Facter.clear_messages - end -end diff --git a/puppet/modules/stdlib/spec/unit/facter/pe_required_facts_spec.rb b/puppet/modules/stdlib/spec/unit/facter/pe_required_facts_spec.rb deleted file mode 100644 index f219b37..0000000 --- a/puppet/modules/stdlib/spec/unit/facter/pe_required_facts_spec.rb +++ /dev/null @@ -1,69 +0,0 @@ -# Puppet Enterprise requires the following facts to be set in order to operate. -# These facts are set using the file ???? and the two facts are -# `fact_stomp_port`, and `fact_stomp_server`. -# - -require 'spec_helper' - -describe "External facts in /etc/puppetlabs/facter/facts.d/puppet_enterprise_installer.txt" do - context "With Facter 1.6.17 which does not have external facts support" do - before :each do - Facter.stubs(:version).returns("1.6.17") - # Stub out the filesystem for stdlib - Dir.stubs(:entries).with("/etc/puppetlabs/facter/facts.d"). - returns(['puppet_enterprise_installer.txt']) - Dir.stubs(:entries).with("/etc/facter/facts.d").returns([]) - File.stubs(:readlines).with('/etc/puppetlabs/facter/facts.d/puppet_enterprise_installer.txt'). - returns([ - "fact_stomp_port=61613\n", - "fact_stomp_server=puppetmaster.acme.com\n", - "fact_is_puppetagent=true\n", - "fact_is_puppetmaster=false\n", - "fact_is_puppetca=false\n", - "fact_is_puppetconsole=false\n", - ]) - if Facter.collection.respond_to? :load - Facter.collection.load(:facter_dot_d) - else - Facter.collection.loader.load(:facter_dot_d) - end - end - - it 'defines fact_stomp_port' do - Facter.fact(:fact_stomp_port).value.should == '61613' - end - it 'defines fact_stomp_server' do - Facter.fact(:fact_stomp_server).value.should == 'puppetmaster.acme.com' - end - it 'defines fact_is_puppetagent' do - Facter.fact(:fact_is_puppetagent).value.should == 'true' - end - it 'defines fact_is_puppetmaster' do - Facter.fact(:fact_is_puppetmaster).value.should == 'false' - end - it 'defines fact_is_puppetca' do - Facter.fact(:fact_is_puppetca).value.should == 'false' - end - it 'defines fact_is_puppetconsole' do - Facter.fact(:fact_is_puppetconsole).value.should == 'false' - end - end - - [ '1.7.1', '2.0.1' ].each do |v| - context "With Facter #{v} which has external facts support" do - before :each do - Facter.stubs(:version).returns(v) - end - - it 'does not call Facter::Util::DotD.new' do - Facter::Util::DotD.expects(:new).never - - if Facter.collection.respond_to? :load - Facter.collection.load(:facter_dot_d) - else - Facter.collection.loader.load(:facter_dot_d) - end - end - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/facter/pe_version_spec.rb b/puppet/modules/stdlib/spec/unit/facter/pe_version_spec.rb deleted file mode 100644 index 931c6d4..0000000 --- a/puppet/modules/stdlib/spec/unit/facter/pe_version_spec.rb +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env rspec - -require 'spec_helper' - -describe "PE Version specs" do - before :each do - # Explicitly load the pe_version.rb file which contains generated facts - # that cannot be automatically loaded. Puppet 2.x implements - # Facter.collection.load while Facter 1.x markes Facter.collection.load as - # a private method. - if Facter.collection.respond_to? :load - Facter.collection.load(:pe_version) - else - Facter.collection.loader.load(:pe_version) - end - end - - context "If PE is installed" do - %w{ 2.6.1 2.10.300 }.each do |version| - puppetversion = "2.7.19 (Puppet Enterprise #{version})" - context "puppetversion => #{puppetversion}" do - before :each do - Facter.fact(:puppetversion).stubs(:value).returns(puppetversion) - end - - (major,minor,patch) = version.split(".") - - it "Should return true" do - Facter.fact(:is_pe).value.should == true - end - - it "Should have a version of #{version}" do - Facter.fact(:pe_version).value.should == version - end - - it "Should have a major version of #{major}" do - Facter.fact(:pe_major_version).value.should == major - end - - it "Should have a minor version of #{minor}" do - Facter.fact(:pe_minor_version).value.should == minor - end - - it "Should have a patch version of #{patch}" do - Facter.fact(:pe_patch_version).value.should == patch - end - end - end - end - - context "When PE is not installed" do - before :each do - Facter.fact(:puppetversion).stubs(:value).returns("2.7.19") - end - - it "is_pe is false" do - Facter.fact(:is_pe).value.should == false - end - - it "pe_version is nil" do - Facter.fact(:pe_version).value.should be_nil - end - - it "pe_major_version is nil" do - Facter.fact(:pe_major_version).value.should be_nil - end - - it "pe_minor_version is nil" do - Facter.fact(:pe_minor_version).value.should be_nil - end - - it "Should have a patch version" do - Facter.fact(:pe_patch_version).value.should be_nil - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/facter/root_home_spec.rb b/puppet/modules/stdlib/spec/unit/facter/root_home_spec.rb deleted file mode 100644 index ce80684..0000000 --- a/puppet/modules/stdlib/spec/unit/facter/root_home_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -require 'spec_helper' -require 'facter/root_home' - -describe Facter::Util::RootHome do - context "solaris" do - let(:root_ent) { "root:x:0:0:Super-User:/:/sbin/sh" } - let(:expected_root_home) { "/" } - - it "should return /" do - Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(root_ent) - Facter::Util::RootHome.get_root_home.should == expected_root_home - end - end - context "linux" do - let(:root_ent) { "root:x:0:0:root:/root:/bin/bash" } - let(:expected_root_home) { "/root" } - - it "should return /root" do - Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(root_ent) - Facter::Util::RootHome.get_root_home.should == expected_root_home - end - end - context "macosx" do - let(:root_ent) { "root:*:0:0:System Administrator:/var/root:/bin/sh" } - let(:expected_root_home) { "/var/root" } - - it "should return /var/root" do - Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(root_ent) - Facter::Util::RootHome.get_root_home.should == expected_root_home - end - end - context "windows" do - before :each do - Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(nil) - end - it "should be nil on windows" do - Facter::Util::RootHome.get_root_home.should be_nil - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb b/puppet/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb deleted file mode 100644 index c3ce6ea..0000000 --- a/puppet/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'spec_helper' -require 'facter/util/puppet_settings' - -describe Facter::Util::PuppetSettings do - - describe "#with_puppet" do - context "Without Puppet loaded" do - before(:each) do - Module.expects(:const_get).with("Puppet").raises(NameError) - end - - it 'should be nil' do - subject.with_puppet { Puppet[:vardir] }.should be_nil - end - it 'should not yield to the block' do - Puppet.expects(:[]).never - subject.with_puppet { Puppet[:vardir] }.should be_nil - end - end - context "With Puppet loaded" do - module Puppet; end - let(:vardir) { "/var/lib/puppet" } - - before :each do - Puppet.expects(:[]).with(:vardir).returns vardir - end - it 'should yield to the block' do - subject.with_puppet { Puppet[:vardir] } - end - it 'should return the nodes vardir' do - subject.with_puppet { Puppet[:vardir] }.should eq vardir - end - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/abs_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/abs_spec.rb deleted file mode 100755 index c0b4297..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/abs_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe "the abs function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("abs").should == "function_abs" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_abs([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should convert a negative number into a positive" do - result = scope.function_abs(["-34"]) - result.should(eq(34)) - end - - it "should do nothing with a positive number" do - result = scope.function_abs(["5678"]) - result.should(eq(5678)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/any2array_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/any2array_spec.rb deleted file mode 100644 index b266e84..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/any2array_spec.rb +++ /dev/null @@ -1,55 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the any2array function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("any2array").should == "function_any2array" - end - - it "should return an empty array if there is less than 1 argument" do - result = scope.function_any2array([]) - result.should(eq([])) - end - - it "should convert boolean true to [ true ] " do - result = scope.function_any2array([true]) - result.should(eq([true])) - end - - it "should convert one object to [object]" do - result = scope.function_any2array(['one']) - result.should(eq(['one'])) - end - - it "should convert multiple objects to [objects]" do - result = scope.function_any2array(['one', 'two']) - result.should(eq(['one', 'two'])) - end - - it "should return empty array it was called with" do - result = scope.function_any2array([[]]) - result.should(eq([])) - end - - it "should return one-member array it was called with" do - result = scope.function_any2array([['string']]) - result.should(eq(['string'])) - end - - it "should return multi-member array it was called with" do - result = scope.function_any2array([['one', 'two']]) - result.should(eq(['one', 'two'])) - end - - it "should return members of a hash it was called with" do - result = scope.function_any2array([{ 'key' => 'value' }]) - result.should(eq(['key', 'value'])) - end - - it "should return an empty array if it was called with an empty hash" do - result = scope.function_any2array([{ }]) - result.should(eq([])) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/bool2num_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/bool2num_spec.rb deleted file mode 100755 index 518ac85..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/bool2num_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the bool2num function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("bool2num").should == "function_bool2num" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_bool2num([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should convert true to 1" do - result = scope.function_bool2num([true]) - result.should(eq(1)) - end - - it "should convert false to 0" do - result = scope.function_bool2num([false]) - result.should(eq(0)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/capitalize_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/capitalize_spec.rb deleted file mode 100755 index 69c9758..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/capitalize_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the capitalize function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("capitalize").should == "function_capitalize" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_capitalize([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should capitalize the beginning of a string" do - result = scope.function_capitalize(["abc"]) - result.should(eq("Abc")) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/chomp_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/chomp_spec.rb deleted file mode 100755 index e425365..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/chomp_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the chomp function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("chomp").should == "function_chomp" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_chomp([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should chomp the end of a string" do - result = scope.function_chomp(["abc\n"]) - result.should(eq("abc")) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/chop_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/chop_spec.rb deleted file mode 100755 index 9e466de..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/chop_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the chop function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("chop").should == "function_chop" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_chop([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should chop the end of a string" do - result = scope.function_chop(["asdf\n"]) - result.should(eq("asdf")) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/concat_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/concat_spec.rb deleted file mode 100644 index 123188b..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/concat_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the concat function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_concat([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should be able to concat an array" do - result = scope.function_concat([['1','2','3'],['4','5','6']]) - result.should(eq(['1','2','3','4','5','6'])) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/count_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/count_spec.rb deleted file mode 100644 index 2453815..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/count_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe "the count function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("count").should == "function_count" - end - - it "should raise a ArgumentError if there is more than 2 arguments" do - lambda { scope.function_count(['foo', 'bar', 'baz']) }.should( raise_error(ArgumentError)) - end - - it "should be able to count arrays" do - scope.function_count([["1","2","3"]]).should(eq(3)) - end - - it "should be able to count matching elements in arrays" do - scope.function_count([["1", "2", "2"], "2"]).should(eq(2)) - end - - it "should not count nil or empty strings" do - scope.function_count([["foo","bar",nil,""]]).should(eq(2)) - end - - it 'does not count an undefined hash key or an out of bound array index (which are both :undef)' do - expect(scope.function_count([["foo",:undef,:undef]])).to eq(1) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/delete_at_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/delete_at_spec.rb deleted file mode 100755 index d8d9618..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/delete_at_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the delete_at function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("delete_at").should == "function_delete_at" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_delete_at([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should delete an item at specified location from an array" do - result = scope.function_delete_at([['a','b','c'],1]) - result.should(eq(['a','c'])) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/delete_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/delete_spec.rb deleted file mode 100755 index 2f29c93..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/delete_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the delete function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("delete").should == "function_delete" - end - - it "should raise a ParseError if there are fewer than 2 arguments" do - lambda { scope.function_delete([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should raise a ParseError if there are greater than 2 arguments" do - lambda { scope.function_delete([[], 'foo', 'bar']) }.should( raise_error(Puppet::ParseError)) - end - - it "should raise a TypeError if a number is passed as the first argument" do - lambda { scope.function_delete([1, 'bar']) }.should( raise_error(TypeError)) - end - - it "should delete all instances of an element from an array" do - result = scope.function_delete([['a','b','c','b'],'b']) - result.should(eq(['a','c'])) - end - - it "should delete all instances of a substring from a string" do - result = scope.function_delete(['foobarbabarz','bar']) - result.should(eq('foobaz')) - end - - it "should delete a key from a hash" do - result = scope.function_delete([{ 'a' => 1, 'b' => 2, 'c' => 3 },'b']) - result.should(eq({ 'a' => 1, 'c' => 3 })) - end - -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/dirname_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/dirname_spec.rb deleted file mode 100755 index fb3b4fe..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/dirname_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the dirname function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("dirname").should == "function_dirname" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_dirname([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return dirname for an absolute path" do - result = scope.function_dirname(['/path/to/a/file.ext']) - result.should(eq('/path/to/a')) - end - - it "should return dirname for a relative path" do - result = scope.function_dirname(['path/to/a/file.ext']) - result.should(eq('path/to/a')) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/downcase_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/downcase_spec.rb deleted file mode 100755 index acef1f0..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/downcase_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the downcase function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("downcase").should == "function_downcase" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_downcase([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should downcase a string" do - result = scope.function_downcase(["ASFD"]) - result.should(eq("asfd")) - end - - it "should do nothing to a string that is already downcase" do - result = scope.function_downcase(["asdf asdf"]) - result.should(eq("asdf asdf")) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/empty_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/empty_spec.rb deleted file mode 100755 index 7745875..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/empty_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the empty function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - it "should exist" do - Puppet::Parser::Functions.function("empty").should == "function_empty" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_empty([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return a true for an empty string" do - result = scope.function_empty(['']) - result.should(eq(true)) - end - - it "should return a false for a non-empty string" do - result = scope.function_empty(['asdf']) - result.should(eq(false)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/flatten_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/flatten_spec.rb deleted file mode 100755 index dba7a6b..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/flatten_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the flatten function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - it "should exist" do - Puppet::Parser::Functions.function("flatten").should == "function_flatten" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_flatten([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should raise a ParseError if there is more than 1 argument" do - lambda { scope.function_flatten([[], []]) }.should( raise_error(Puppet::ParseError)) - end - - it "should flatten a complex data structure" do - result = scope.function_flatten([["a","b",["c",["d","e"],"f","g"]]]) - result.should(eq(["a","b","c","d","e","f","g"])) - end - - it "should do nothing to a structure that is already flat" do - result = scope.function_flatten([["a","b","c","d"]]) - result.should(eq(["a","b","c","d"])) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/floor_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/floor_spec.rb deleted file mode 100644 index dbc8c77..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/floor_spec.rb +++ /dev/null @@ -1,39 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe "the floor function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("floor").should == "function_floor" - end - - it "should raise a ParseError if there is less than 1 argument" do - lambda { scope.function_floor([]) }.should( raise_error(Puppet::ParseError, /Wrong number of arguments/)) - end - - it "should should raise a ParseError if input isn't numeric (eg. String)" do - lambda { scope.function_floor(["foo"]) }.should( raise_error(Puppet::ParseError, /Wrong argument type/)) - end - - it "should should raise a ParseError if input isn't numeric (eg. Boolean)" do - lambda { scope.function_floor([true]) }.should( raise_error(Puppet::ParseError, /Wrong argument type/)) - end - - it "should return an integer when a numeric type is passed" do - result = scope.function_floor([12.4]) - result.is_a?(Integer).should(eq(true)) - end - - it "should return the input when an integer is passed" do - result = scope.function_floor([7]) - result.should(eq(7)) - end - - it "should return the largest integer less than or equal to the input" do - result = scope.function_floor([3.8]) - result.should(eq(3)) - end -end - diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb deleted file mode 100644 index 2577723..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the fqdn_rotate function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("fqdn_rotate").should == "function_fqdn_rotate" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_fqdn_rotate([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should rotate a string and the result should be the same size" do - scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1") - result = scope.function_fqdn_rotate(["asdf"]) - result.size.should(eq(4)) - end - - it "should rotate a string to give the same results for one host" do - scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1").twice - scope.function_fqdn_rotate(["abcdefg"]).should eql(scope.function_fqdn_rotate(["abcdefg"])) - end - - it "should rotate a string to give different values on different hosts" do - scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1") - val1 = scope.function_fqdn_rotate(["abcdefghijklmnopqrstuvwxyz01234567890987654321"]) - scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.2") - val2 = scope.function_fqdn_rotate(["abcdefghijklmnopqrstuvwxyz01234567890987654321"]) - val1.should_not eql(val2) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/get_module_path_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/get_module_path_spec.rb deleted file mode 100644 index 486bef6..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/get_module_path_spec.rb +++ /dev/null @@ -1,46 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:get_module_path) do - Internals = PuppetlabsSpec::PuppetInternals - class StubModule - attr_reader :path - def initialize(path) - @path = path - end - end - - def scope(environment = "production") - Internals.scope(:compiler => Internals.compiler(:node => Internals.node(:environment => environment))) - end - - it 'should only allow one argument' do - expect { scope.function_get_module_path([]) }.to raise_error(Puppet::ParseError, /Wrong number of arguments, expects one/) - expect { scope.function_get_module_path(['1','2','3']) }.to raise_error(Puppet::ParseError, /Wrong number of arguments, expects one/) - end - it 'should raise an exception when the module cannot be found' do - expect { scope.function_get_module_path(['foo']) }.to raise_error(Puppet::ParseError, /Could not find module/) - end - describe 'when locating a module' do - let(:modulepath) { "/tmp/does_not_exist" } - let(:path_of_module_foo) { StubModule.new("/tmp/does_not_exist/foo") } - - before(:each) { Puppet[:modulepath] = modulepath } - - it 'should be able to find module paths from the modulepath setting' do - Puppet::Module.expects(:find).with('foo', 'production').returns(path_of_module_foo) - scope.function_get_module_path(['foo']).should == path_of_module_foo.path - end - it 'should be able to find module paths when the modulepath is a list' do - Puppet[:modulepath] = modulepath + ":/tmp" - Puppet::Module.expects(:find).with('foo', 'production').returns(path_of_module_foo) - scope.function_get_module_path(['foo']).should == path_of_module_foo.path - end - it 'should respect the environment' do - pending("Disabled on Puppet 2.6.x") if Puppet.version =~ /^2\.6\b/ - Puppet.settings[:environment] = 'danstestenv' - Puppet::Module.expects(:find).with('foo', 'danstestenv').returns(path_of_module_foo) - scope('danstestenv').function_get_module_path(['foo']).should == path_of_module_foo.path - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/getvar_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/getvar_spec.rb deleted file mode 100644 index 5ff834e..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/getvar_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:getvar) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - describe 'when calling getvar from puppet' do - - it "should not compile when no arguments are passed" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = '$foo = getvar()' - expect { - scope.compiler.compile - }.to raise_error(Puppet::ParseError, /wrong number of arguments/) - end - - it "should not compile when too many arguments are passed" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = '$foo = getvar("foo::bar", "baz")' - expect { - scope.compiler.compile - }.to raise_error(Puppet::ParseError, /wrong number of arguments/) - end - - it "should lookup variables in other namespaces" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = <<-'ENDofPUPPETcode' - class site::data { $foo = 'baz' } - include site::data - $foo = getvar("site::data::foo") - if $foo != 'baz' { - fail('getvar did not return what we expect') - } - ENDofPUPPETcode - scope.compiler.compile - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/grep_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/grep_spec.rb deleted file mode 100755 index a93b842..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/grep_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the grep function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("grep").should == "function_grep" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_grep([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should grep contents from an array" do - result = scope.function_grep([["aaabbb","bbbccc","dddeee"], "bbb"]) - result.should(eq(["aaabbb","bbbccc"])) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_interface_with_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_interface_with_spec.rb deleted file mode 100755 index c5264e4..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_interface_with_spec.rb +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env ruby -S rspec -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:has_interface_with) do - - let(:scope) do - PuppetlabsSpec::PuppetInternals.scope - end - - # The subject of these examples is the method itself. - subject do - function_name = Puppet::Parser::Functions.function(:has_interface_with) - scope.method(function_name) - end - - # We need to mock out the Facts so we can specify how we expect this function - # to behave on different platforms. - context "On Mac OS X Systems" do - before :each do - scope.stubs(:lookupvar).with("interfaces").returns('lo0,gif0,stf0,en1,p2p0,fw0,en0,vmnet1,vmnet8,utun0') - end - it 'should have loopback (lo0)' do - subject.call(['lo0']).should be_true - end - it 'should not have loopback (lo)' do - subject.call(['lo']).should be_false - end - end - context "On Linux Systems" do - before :each do - scope.stubs(:lookupvar).with("interfaces").returns('eth0,lo') - scope.stubs(:lookupvar).with("ipaddress").returns('10.0.0.1') - scope.stubs(:lookupvar).with("ipaddress_lo").returns('127.0.0.1') - scope.stubs(:lookupvar).with("ipaddress_eth0").returns('10.0.0.1') - scope.stubs(:lookupvar).with('muppet').returns('kermit') - scope.stubs(:lookupvar).with('muppet_lo').returns('mspiggy') - scope.stubs(:lookupvar).with('muppet_eth0').returns('kermit') - end - it 'should have loopback (lo)' do - subject.call(['lo']).should be_true - end - it 'should not have loopback (lo0)' do - subject.call(['lo0']).should be_false - end - it 'should have ipaddress with 127.0.0.1' do - subject.call(['ipaddress', '127.0.0.1']).should be_true - end - it 'should have ipaddress with 10.0.0.1' do - subject.call(['ipaddress', '10.0.0.1']).should be_true - end - it 'should not have ipaddress with 10.0.0.2' do - subject.call(['ipaddress', '10.0.0.2']).should be_false - end - it 'should have muppet named kermit' do - subject.call(['muppet', 'kermit']).should be_true - end - it 'should have muppet named mspiggy' do - subject.call(['muppet', 'mspiggy']).should be_true - end - it 'should not have muppet named bigbird' do - subject.call(['muppet', 'bigbird']).should be_false - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_address_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_address_spec.rb deleted file mode 100755 index 5a68460..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_address_spec.rb +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env ruby -S rspec -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:has_ip_address) do - - let(:scope) do - PuppetlabsSpec::PuppetInternals.scope - end - - subject do - function_name = Puppet::Parser::Functions.function(:has_ip_address) - scope.method(function_name) - end - - context "On Linux Systems" do - before :each do - scope.stubs(:lookupvar).with('interfaces').returns('eth0,lo') - scope.stubs(:lookupvar).with('ipaddress').returns('10.0.2.15') - scope.stubs(:lookupvar).with('ipaddress_eth0').returns('10.0.2.15') - scope.stubs(:lookupvar).with('ipaddress_lo').returns('127.0.0.1') - end - - it 'should have primary address (10.0.2.15)' do - subject.call(['10.0.2.15']).should be_true - end - - it 'should have lookupback address (127.0.0.1)' do - subject.call(['127.0.0.1']).should be_true - end - - it 'should not have other address' do - subject.call(['192.1681.1.1']).should be_false - end - - it 'should not have "mspiggy" on an interface' do - subject.call(['mspiggy']).should be_false - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_network_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_network_spec.rb deleted file mode 100755 index c3a289e..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_network_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env ruby -S rspec -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:has_ip_network) do - - let(:scope) do - PuppetlabsSpec::PuppetInternals.scope - end - - subject do - function_name = Puppet::Parser::Functions.function(:has_ip_network) - scope.method(function_name) - end - - context "On Linux Systems" do - before :each do - scope.stubs(:lookupvar).with('interfaces').returns('eth0,lo') - scope.stubs(:lookupvar).with('network').returns(:undefined) - scope.stubs(:lookupvar).with('network_eth0').returns('10.0.2.0') - scope.stubs(:lookupvar).with('network_lo').returns('127.0.0.1') - end - - it 'should have primary network (10.0.2.0)' do - subject.call(['10.0.2.0']).should be_true - end - - it 'should have loopback network (127.0.0.0)' do - subject.call(['127.0.0.1']).should be_true - end - - it 'should not have other network' do - subject.call(['192.168.1.0']).should be_false - end - end -end - diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_key_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_key_spec.rb deleted file mode 100644 index 490daea..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/has_key_spec.rb +++ /dev/null @@ -1,42 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:has_key) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - describe 'when calling has_key from puppet' do - it "should not compile when no arguments are passed" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = '$x = has_key()' - expect { - scope.compiler.compile - }.to raise_error(Puppet::ParseError, /wrong number of arguments/) - end - - it "should not compile when 1 argument is passed" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = "$x = has_key('foo')" - expect { - scope.compiler.compile - }.to raise_error(Puppet::ParseError, /wrong number of arguments/) - end - - it "should require the first value to be a Hash" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = "$x = has_key('foo', 'bar')" - expect { - scope.compiler.compile - }.to raise_error(Puppet::ParseError, /expects the first argument to be a hash/) - end - end - - describe 'when calling the function has_key from a scope instance' do - it 'should detect existing keys' do - scope.function_has_key([{'one' => 1}, 'one']).should be_true - end - - it 'should detect existing keys' do - scope.function_has_key([{'one' => 1}, 'two']).should be_false - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/hash_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/hash_spec.rb deleted file mode 100644 index 7c91be9..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/hash_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the hash function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("hash").should == "function_hash" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_hash([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should convert an array to a hash" do - result = scope.function_hash([['a',1,'b',2,'c',3]]) - result.should(eq({'a'=>1,'b'=>2,'c'=>3})) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_array_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_array_spec.rb deleted file mode 100644 index e7f4bcd..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_array_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_array function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_array").should == "function_is_array" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_array([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if passed an array" do - result = scope.function_is_array([[1,2,3]]) - result.should(eq(true)) - end - - it "should return false if passed a hash" do - result = scope.function_is_array([{'a'=>1}]) - result.should(eq(false)) - end - - it "should return false if passed a string" do - result = scope.function_is_array(["asdf"]) - result.should(eq(false)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_domain_name_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_domain_name_spec.rb deleted file mode 100644 index f2ea76d..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_domain_name_spec.rb +++ /dev/null @@ -1,64 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_domain_name function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_domain_name").should == "function_is_domain_name" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_domain_name([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if a valid short domain name" do - result = scope.function_is_domain_name(["x.com"]) - result.should(be_true) - end - - it "should return true if the domain is ." do - result = scope.function_is_domain_name(["."]) - result.should(be_true) - end - - it "should return true if the domain is x.com." do - result = scope.function_is_domain_name(["x.com."]) - result.should(be_true) - end - - it "should return true if a valid domain name" do - result = scope.function_is_domain_name(["foo.bar.com"]) - result.should(be_true) - end - - it "should allow domain parts to start with numbers" do - result = scope.function_is_domain_name(["3foo.2bar.com"]) - result.should(be_true) - end - - it "should allow domain to end with a dot" do - result = scope.function_is_domain_name(["3foo.2bar.com."]) - result.should(be_true) - end - - it "should allow a single part domain" do - result = scope.function_is_domain_name(["orange"]) - result.should(be_true) - end - - it "should return false if domain parts start with hyphens" do - result = scope.function_is_domain_name(["-3foo.2bar.com"]) - result.should(be_false) - end - - it "should return true if domain contains hyphens" do - result = scope.function_is_domain_name(["3foo-bar.2bar-fuzz.com"]) - result.should(be_true) - end - - it "should return false if domain name contains spaces" do - result = scope.function_is_domain_name(["not valid"]) - result.should(be_false) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_float_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_float_spec.rb deleted file mode 100644 index b7d73b0..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_float_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_float function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_float").should == "function_is_float" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_float([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if a float" do - result = scope.function_is_float(["0.12"]) - result.should(eq(true)) - end - - it "should return false if a string" do - result = scope.function_is_float(["asdf"]) - result.should(eq(false)) - end - - it "should return false if an integer" do - result = scope.function_is_float(["3"]) - result.should(eq(false)) - end - it "should return true if a float is created from an arithmetical operation" do - result = scope.function_is_float([3.2*2]) - result.should(eq(true)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_function_available.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_function_available.rb deleted file mode 100644 index bd40c51..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_function_available.rb +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env rspec -require 'spec_helper' - -describe "the is_function_available function" do - before :all do - Puppet::Parser::Functions.autoloader.loadall - end - - before :each do - @scope = Puppet::Parser::Scope.new - end - - it "should exist" do - Puppet::Parser::Functions.function("is_function_available").should == "function_is_function_available" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { @scope.function_is_function_available([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return false if a nonexistent function is passed" do - result = @scope.function_is_function_available(['jeff_mccunes_left_sock']) - result.should(eq(false)) - end - - it "should return true if an available function is passed" do - result = @scope.function_is_function_available(['require']) - result.should(eq(true)) - end - -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_hash_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_hash_spec.rb deleted file mode 100644 index bbebf39..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_hash_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_hash function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_hash").should == "function_is_hash" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_hash([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if passed a hash" do - result = scope.function_is_hash([{"a"=>1,"b"=>2}]) - result.should(eq(true)) - end - - it "should return false if passed an array" do - result = scope.function_is_hash([["a","b"]]) - result.should(eq(false)) - end - - it "should return false if passed a string" do - result = scope.function_is_hash(["asdf"]) - result.should(eq(false)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb deleted file mode 100644 index 4335795..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_integer function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_integer").should == "function_is_integer" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_integer([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if an integer" do - result = scope.function_is_integer(["3"]) - result.should(eq(true)) - end - - it "should return false if a float" do - result = scope.function_is_integer(["3.2"]) - result.should(eq(false)) - end - - it "should return false if a string" do - result = scope.function_is_integer(["asdf"]) - result.should(eq(false)) - end - - it "should return true if an integer is created from an arithmetical operation" do - result = scope.function_is_integer([3*2]) - result.should(eq(true)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_ip_address_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_ip_address_spec.rb deleted file mode 100644 index c0debb3..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_ip_address_spec.rb +++ /dev/null @@ -1,39 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_ip_address function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_ip_address").should == "function_is_ip_address" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_ip_address([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if an IPv4 address" do - result = scope.function_is_ip_address(["1.2.3.4"]) - result.should(eq(true)) - end - - it "should return true if a full IPv6 address" do - result = scope.function_is_ip_address(["fe80:0000:cd12:d123:e2f8:47ff:fe09:dd74"]) - result.should(eq(true)) - end - - it "should return true if a compressed IPv6 address" do - result = scope.function_is_ip_address(["fe00::1"]) - result.should(eq(true)) - end - - it "should return false if not valid" do - result = scope.function_is_ip_address(["asdf"]) - result.should(eq(false)) - end - - it "should return false if IP octets out of range" do - result = scope.function_is_ip_address(["1.1.1.300"]) - result.should(eq(false)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_mac_address_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_mac_address_spec.rb deleted file mode 100644 index ca9c590..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_mac_address_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_mac_address function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_mac_address").should == "function_is_mac_address" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_mac_address([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if a valid mac address" do - result = scope.function_is_mac_address(["00:a0:1f:12:7f:a0"]) - result.should(eq(true)) - end - - it "should return false if octets are out of range" do - result = scope.function_is_mac_address(["00:a0:1f:12:7f:g0"]) - result.should(eq(false)) - end - - it "should return false if not valid" do - result = scope.function_is_mac_address(["not valid"]) - result.should(eq(false)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_numeric_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_numeric_spec.rb deleted file mode 100644 index d7440fb..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_numeric_spec.rb +++ /dev/null @@ -1,39 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_numeric function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_numeric").should == "function_is_numeric" - end - - it "should raise a ParseError if there is less than 1 argument" do - lambda { scope.function_is_numeric([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if an integer" do - result = scope.function_is_numeric(["3"]) - result.should(eq(true)) - end - - it "should return true if a float" do - result = scope.function_is_numeric(["3.2"]) - result.should(eq(true)) - end - - it "should return true if an integer is created from an arithmetical operation" do - result = scope.function_is_numeric([3*2]) - result.should(eq(true)) - end - - it "should return true if a float is created from an arithmetical operation" do - result = scope.function_is_numeric([3.2*2]) - result.should(eq(true)) - end - - it "should return false if a string" do - result = scope.function_is_numeric(["asdf"]) - result.should(eq(false)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_string_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_string_spec.rb deleted file mode 100644 index 3756bea..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/is_string_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the is_string function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("is_string").should == "function_is_string" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_is_string([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if a string" do - result = scope.function_is_string(["asdf"]) - result.should(eq(true)) - end - - it "should return false if an integer" do - result = scope.function_is_string(["3"]) - result.should(eq(false)) - end - - it "should return false if a float" do - result = scope.function_is_string(["3.23"]) - result.should(eq(false)) - end - - it "should return false if an array" do - result = scope.function_is_string([["a","b","c"]]) - result.should(eq(false)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb deleted file mode 100644 index a52fb71..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the join_keys_to_values function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("join_keys_to_values").should == "function_join_keys_to_values" - end - - it "should raise a ParseError if there are fewer than two arguments" do - lambda { scope.function_join_keys_to_values([{}]) }.should raise_error Puppet::ParseError - end - - it "should raise a ParseError if there are greater than two arguments" do - lambda { scope.function_join_keys_to_values([{}, 'foo', 'bar']) }.should raise_error Puppet::ParseError - end - - it "should raise a TypeError if the first argument is an array" do - lambda { scope.function_join_keys_to_values([[1,2], ',']) }.should raise_error TypeError - end - - it "should raise a TypeError if the second argument is an array" do - lambda { scope.function_join_keys_to_values([{}, [1,2]]) }.should raise_error TypeError - end - - it "should raise a TypeError if the second argument is a number" do - lambda { scope.function_join_keys_to_values([{}, 1]) }.should raise_error TypeError - end - - it "should return an empty array given an empty hash" do - result = scope.function_join_keys_to_values([{}, ":"]) - result.should == [] - end - - it "should join hash's keys to its values" do - result = scope.function_join_keys_to_values([{'a'=>1,2=>'foo',:b=>nil}, ":"]) - result.should =~ ['a:1','2:foo','b:'] - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/join_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/join_spec.rb deleted file mode 100644 index aafa1a7..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/join_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the join function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("join").should == "function_join" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_join([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should join an array into a string" do - result = scope.function_join([["a","b","c"], ":"]) - result.should(eq("a:b:c")) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/keys_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/keys_spec.rb deleted file mode 100644 index fdd7a70..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/keys_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the keys function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("keys").should == "function_keys" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_keys([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return an array of keys when given a hash" do - result = scope.function_keys([{'a'=>1, 'b'=>2}]) - # =~ performs 'array with same elements' (set) matching - # For more info see RSpec::Matchers::MatchArray - result.should =~ ['a','b'] - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/lstrip_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/lstrip_spec.rb deleted file mode 100644 index b280ae7..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/lstrip_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the lstrip function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("lstrip").should == "function_lstrip" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_lstrip([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should lstrip a string" do - result = scope.function_lstrip([" asdf"]) - result.should(eq('asdf')) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/max_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/max_spec.rb deleted file mode 100755 index ff6f2b3..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/max_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe "the max function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("max").should == "function_max" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_max([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should be able to compare strings" do - scope.function_max(["albatross","dog","horse"]).should(eq("horse")) - end - - it "should be able to compare numbers" do - scope.function_max([6,8,4]).should(eq(8)) - end - - it "should be able to compare a number with a stringified number" do - scope.function_max([1,"2"]).should(eq("2")) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/member_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/member_spec.rb deleted file mode 100644 index 6e9a023..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/member_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the member function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("member").should == "function_member" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_member([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if a member is in an array" do - result = scope.function_member([["a","b","c"], "a"]) - result.should(eq(true)) - end - - it "should return false if a member is not in an array" do - result = scope.function_member([["a","b","c"], "d"]) - result.should(eq(false)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/merge_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/merge_spec.rb deleted file mode 100644 index 04169e7..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/merge_spec.rb +++ /dev/null @@ -1,47 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:merge) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - describe 'when calling merge from puppet' do - it "should not compile when no arguments are passed" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = '$x = merge()' - expect { - scope.compiler.compile - }.to raise_error(Puppet::ParseError, /wrong number of arguments/) - end - - it "should not compile when 1 argument is passed" do - pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ - Puppet[:code] = "$my_hash={'one' => 1}\n$x = merge($my_hash)" - expect { - scope.compiler.compile - }.to raise_error(Puppet::ParseError, /wrong number of arguments/) - end - end - - describe 'when calling merge on the scope instance' do - it 'should require all parameters are hashes' do - expect { new_hash = scope.function_merge([{}, '2'])}.to raise_error(Puppet::ParseError, /unexpected argument type String/) - end - - it 'should be able to merge two hashes' do - new_hash = scope.function_merge([{'one' => '1', 'two' => '1'}, {'two' => '2', 'three' => '2'}]) - new_hash['one'].should == '1' - new_hash['two'].should == '2' - new_hash['three'].should == '2' - end - - it 'should merge multiple hashes' do - hash = scope.function_merge([{'one' => 1}, {'one' => '2'}, {'one' => '3'}]) - hash['one'].should == '3' - end - - it 'should accept empty hashes' do - scope.function_merge([{},{},{}]).should == {} - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/min_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/min_spec.rb deleted file mode 100755 index 71d593e..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/min_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe "the min function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("min").should == "function_min" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_min([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should be able to compare strings" do - scope.function_min(["albatross","dog","horse"]).should(eq("albatross")) - end - - it "should be able to compare numbers" do - scope.function_min([6,8,4]).should(eq(4)) - end - - it "should be able to compare a number with a stringified number" do - scope.function_min([1,"2"]).should(eq(1)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/num2bool_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/num2bool_spec.rb deleted file mode 100644 index b56196d..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/num2bool_spec.rb +++ /dev/null @@ -1,67 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the num2bool function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("num2bool").should == "function_num2bool" - end - - it "should raise a ParseError if there are no arguments" do - lambda { scope.function_num2bool([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should raise a ParseError if there are more than 1 arguments" do - lambda { scope.function_num2bool(["foo","bar"]) }.should( raise_error(Puppet::ParseError)) - end - - it "should raise a ParseError if passed something non-numeric" do - lambda { scope.function_num2bool(["xyzzy"]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return true if passed string 1" do - result = scope.function_num2bool(["1"]) - result.should(be_true) - end - - it "should return true if passed string 1.5" do - result = scope.function_num2bool(["1.5"]) - result.should(be_true) - end - - it "should return true if passed number 1" do - result = scope.function_num2bool([1]) - result.should(be_true) - end - - it "should return false if passed string 0" do - result = scope.function_num2bool(["0"]) - result.should(be_false) - end - - it "should return false if passed number 0" do - result = scope.function_num2bool([0]) - result.should(be_false) - end - - it "should return false if passed string -1" do - result = scope.function_num2bool(["-1"]) - result.should(be_false) - end - - it "should return false if passed string -1.5" do - result = scope.function_num2bool(["-1.5"]) - result.should(be_false) - end - - it "should return false if passed number -1" do - result = scope.function_num2bool([-1]) - result.should(be_false) - end - - it "should return false if passed float -1.5" do - result = scope.function_num2bool([-1.5]) - result.should(be_false) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/parsejson_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/parsejson_spec.rb deleted file mode 100644 index f179ac1..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/parsejson_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the parsejson function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("parsejson").should == "function_parsejson" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_parsejson([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should convert JSON to a data structure" do - json = <<-EOS -["aaa","bbb","ccc"] -EOS - result = scope.function_parsejson([json]) - result.should(eq(['aaa','bbb','ccc'])) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/parseyaml_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/parseyaml_spec.rb deleted file mode 100644 index 0c7aea8..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/parseyaml_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the parseyaml function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("parseyaml").should == "function_parseyaml" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_parseyaml([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should convert YAML to a data structure" do - yaml = <<-EOS -- aaa -- bbb -- ccc -EOS - result = scope.function_parseyaml([yaml]) - result.should(eq(['aaa','bbb','ccc'])) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/pick_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/pick_spec.rb deleted file mode 100644 index 761db6b..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/pick_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the pick function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("pick").should == "function_pick" - end - - it 'should return the correct value' do - scope.function_pick(['first', 'second']).should == 'first' - end - - it 'should return the correct value if the first value is empty' do - scope.function_pick(['', 'second']).should == 'second' - end - - it 'should remove empty string values' do - scope.function_pick(['', 'first']).should == 'first' - end - - it 'should remove :undef values' do - scope.function_pick([:undef, 'first']).should == 'first' - end - - it 'should remove :undefined values' do - scope.function_pick([:undefined, 'first']).should == 'first' - end - - it 'should error if no values are passed' do - expect { scope.function_pick([]) }.to raise_error(Puppet::Error, /Must provide non empty value./) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/prefix_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/prefix_spec.rb deleted file mode 100644 index 5cf592b..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/prefix_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the prefix function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("prefix").should == "function_prefix" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_prefix([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return a prefixed array" do - result = scope.function_prefix([['a','b','c'], 'p']) - result.should(eq(['pa','pb','pc'])) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/range_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/range_spec.rb deleted file mode 100644 index 42751f4..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/range_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the range function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("range").should == "function_range" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_range([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return a letter range" do - result = scope.function_range(["a","d"]) - result.should(eq(['a','b','c','d'])) - end - - it "should return a number range" do - result = scope.function_range(["1","4"]) - result.should(eq([1,2,3,4])) - end - - it "should work with padded hostname like strings" do - expected = ("host01".."host10").to_a - scope.function_range(["host01","host10"]).should eq expected - end - - it "should coerce zero padded digits to integers" do - expected = (0..10).to_a - scope.function_range(["00", "10"]).should eq expected - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/reject_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/reject_spec.rb deleted file mode 100755 index f2cb741..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/reject_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env ruby - -require 'spec_helper' - -describe "the reject function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("reject").should == "function_reject" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_reject([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should reject contents from an array" do - result = scope.function_reject([["1111", "aaabbb","bbbccc","dddeee"], "bbb"]) - result.should(eq(["1111", "dddeee"])) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/reverse_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/reverse_spec.rb deleted file mode 100644 index 1b59206..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/reverse_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the reverse function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("reverse").should == "function_reverse" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_reverse([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should reverse a string" do - result = scope.function_reverse(["asdfghijkl"]) - result.should(eq('lkjihgfdsa')) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/rstrip_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/rstrip_spec.rb deleted file mode 100644 index d90de1d..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/rstrip_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the rstrip function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("rstrip").should == "function_rstrip" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_rstrip([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should rstrip a string" do - result = scope.function_rstrip(["asdf "]) - result.should(eq('asdf')) - end - - it "should rstrip each element in an array" do - result = scope.function_rstrip([["a ","b ", "c "]]) - result.should(eq(['a','b','c'])) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/shuffle_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/shuffle_spec.rb deleted file mode 100644 index 93346d5..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/shuffle_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the shuffle function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("shuffle").should == "function_shuffle" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_shuffle([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should shuffle a string and the result should be the same size" do - result = scope.function_shuffle(["asdf"]) - result.size.should(eq(4)) - end - - it "should shuffle a string but the sorted contents should still be the same" do - result = scope.function_shuffle(["adfs"]) - result.split("").sort.join("").should(eq("adfs")) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/size_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/size_spec.rb deleted file mode 100644 index b1c435a..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/size_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the size function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("size").should == "function_size" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_size([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return the size of a string" do - result = scope.function_size(["asdf"]) - result.should(eq(4)) - end - - it "should return the size of an array" do - result = scope.function_size([["a","b","c"]]) - result.should(eq(3)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/sort_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/sort_spec.rb deleted file mode 100644 index 3187a5a..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/sort_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the sort function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("sort").should == "function_sort" - end - - it "should raise a ParseError if there is not 1 arguments" do - lambda { scope.function_sort(['','']) }.should( raise_error(Puppet::ParseError)) - end - - it "should sort an array" do - result = scope.function_sort([["a","c","b"]]) - result.should(eq(['a','b','c'])) - end - - it "should sort a string" do - result = scope.function_sort(["acb"]) - result.should(eq('abc')) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/squeeze_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/squeeze_spec.rb deleted file mode 100644 index 60e5a30..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/squeeze_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the squeeze function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("squeeze").should == "function_squeeze" - end - - it "should raise a ParseError if there is less than 2 arguments" do - lambda { scope.function_squeeze([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should squeeze a string" do - result = scope.function_squeeze(["aaabbbbcccc"]) - result.should(eq('abc')) - end - - it "should squeeze all elements in an array" do - result = scope.function_squeeze([["aaabbbbcccc","dddfff"]]) - result.should(eq(['abc','df'])) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb deleted file mode 100644 index ef6350f..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the str2bool function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("str2bool").should == "function_str2bool" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_str2bool([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should convert string 'true' to true" do - result = scope.function_str2bool(["true"]) - result.should(eq(true)) - end - - it "should convert string 'undef' to false" do - result = scope.function_str2bool(["undef"]) - result.should(eq(false)) - end - - it "should return the boolean it was called with" do - result = scope.function_str2bool([true]) - result.should(eq(true)) - result = scope.function_str2bool([false]) - result.should(eq(false)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb deleted file mode 100644 index df8fb8e..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb +++ /dev/null @@ -1,45 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the str2saltedsha512 function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("str2saltedsha512").should == "function_str2saltedsha512" - end - - it "should raise a ParseError if there is less than 1 argument" do - expect { scope.function_str2saltedsha512([]) }.to( raise_error(Puppet::ParseError) ) - end - - it "should raise a ParseError if there is more than 1 argument" do - expect { scope.function_str2saltedsha512(['foo', 'bar', 'baz']) }.to( raise_error(Puppet::ParseError) ) - end - - it "should return a salted-sha512 password hash 136 characters in length" do - result = scope.function_str2saltedsha512(["password"]) - result.length.should(eq(136)) - end - - it "should raise an error if you pass a non-string password" do - expect { scope.function_str2saltedsha512([1234]) }.to( raise_error(Puppet::ParseError) ) - end - - it "should generate a valid password" do - # Allow the function to generate a password based on the string 'password' - password_hash = scope.function_str2saltedsha512(["password"]) - - # Separate the Salt and Password from the Password Hash - salt = password_hash[0..7] - password = password_hash[8..-1] - - # Convert the Salt and Password from Hex to Binary Data - str_salt = Array(salt.lines).pack('H*') - str_password = Array(password.lines).pack('H*') - - # Combine the Binary Salt with 'password' and compare the end result - saltedpass = Digest::SHA512.digest(str_salt + 'password') - result = (str_salt + saltedpass).unpack('H*')[0] - result.should == password_hash - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/strftime_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/strftime_spec.rb deleted file mode 100644 index df42b6f..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/strftime_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the strftime function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("strftime").should == "function_strftime" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_strftime([]) }.should( raise_error(Puppet::ParseError)) - end - - it "using %s should be higher then when I wrote this test" do - result = scope.function_strftime(["%s"]) - result.to_i.should(be > 1311953157) - end - - it "using %s should be lower then 1.5 trillion" do - result = scope.function_strftime(["%s"]) - result.to_i.should(be < 1500000000) - end - - it "should return a date when given %Y-%m-%d" do - result = scope.function_strftime(["%Y-%m-%d"]) - result.should =~ /^\d{4}-\d{2}-\d{2}$/ - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/strip_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/strip_spec.rb deleted file mode 100644 index fccdd26..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/strip_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the strip function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - it "should exist" do - Puppet::Parser::Functions.function("strip").should == "function_strip" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_strip([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should strip a string" do - result = scope.function_strip([" ab cd "]) - result.should(eq('ab cd')) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/suffix_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/suffix_spec.rb deleted file mode 100644 index c28f719..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/suffix_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the suffix function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("suffix").should == "function_suffix" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_suffix([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return a suffixed array" do - result = scope.function_suffix([['a','b','c'], 'p']) - result.should(eq(['ap','bp','cp'])) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/swapcase_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/swapcase_spec.rb deleted file mode 100644 index 808b415..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/swapcase_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the swapcase function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("swapcase").should == "function_swapcase" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_swapcase([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should swapcase a string" do - result = scope.function_swapcase(["aaBBccDD"]) - result.should(eq('AAbbCCdd')) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/time_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/time_spec.rb deleted file mode 100644 index e9fb76e..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/time_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the time function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("time").should == "function_time" - end - - it "should raise a ParseError if there is more than 2 arguments" do - lambda { scope.function_time(['','']) }.should( raise_error(Puppet::ParseError)) - end - - it "should return a number" do - result = scope.function_time([]) - result.should be_an(Integer) - end - - it "should be higher then when I wrote this test" do - result = scope.function_time([]) - result.should(be > 1311953157) - end - - it "should be lower then 1.5 trillion" do - result = scope.function_time([]) - result.should(be < 1500000000) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/to_bytes_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/to_bytes_spec.rb deleted file mode 100755 index d1ea4c8..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/to_bytes_spec.rb +++ /dev/null @@ -1,58 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe "the to_bytes function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("to_bytes").should == "function_to_bytes" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_to_bytes([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should convert kB to B" do - result = scope.function_to_bytes(["4 kB"]) - result.should(eq(4096)) - end - - it "should work without B in unit" do - result = scope.function_to_bytes(["4 k"]) - result.should(eq(4096)) - end - - it "should work without a space before unit" do - result = scope.function_to_bytes(["4k"]) - result.should(eq(4096)) - end - - it "should work without a unit" do - result = scope.function_to_bytes(["5678"]) - result.should(eq(5678)) - end - - it "should convert fractions" do - result = scope.function_to_bytes(["1.5 kB"]) - result.should(eq(1536)) - end - - it "should convert scientific notation" do - result = scope.function_to_bytes(["1.5e2 B"]) - result.should(eq(150)) - end - - it "should do nothing with a positive number" do - result = scope.function_to_bytes([5678]) - result.should(eq(5678)) - end - - it "should should raise a ParseError if input isn't a number" do - lambda { scope.function_to_bytes(["foo"]) }.should( raise_error(Puppet::ParseError)) - end - - it "should should raise a ParseError if prefix is unknown" do - lambda { scope.function_to_bytes(["5 uB"]) }.should( raise_error(Puppet::ParseError)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/type_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/type_spec.rb deleted file mode 100644 index 8fec88f..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/type_spec.rb +++ /dev/null @@ -1,43 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the type function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - it "should exist" do - Puppet::Parser::Functions.function("type").should == "function_type" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_type([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return string when given a string" do - result = scope.function_type(["aaabbbbcccc"]) - result.should(eq('string')) - end - - it "should return array when given an array" do - result = scope.function_type([["aaabbbbcccc","asdf"]]) - result.should(eq('array')) - end - - it "should return hash when given a hash" do - result = scope.function_type([{"a"=>1,"b"=>2}]) - result.should(eq('hash')) - end - - it "should return integer when given an integer" do - result = scope.function_type(["1"]) - result.should(eq('integer')) - end - - it "should return float when given a float" do - result = scope.function_type(["1.34"]) - result.should(eq('float')) - end - - it "should return boolean when given a boolean" do - result = scope.function_type([true]) - result.should(eq('boolean')) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/unique_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/unique_spec.rb deleted file mode 100644 index 5d48d49..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/unique_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the unique function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("unique").should == "function_unique" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_unique([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should remove duplicate elements in a string" do - result = scope.function_unique(["aabbc"]) - result.should(eq('abc')) - end - - it "should remove duplicate elements in an array" do - result = scope.function_unique([["a","a","b","b","c"]]) - result.should(eq(['a','b','c'])) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/upcase_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/upcase_spec.rb deleted file mode 100644 index 5db5513..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/upcase_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the upcase function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("upcase").should == "function_upcase" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_upcase([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should upcase a string" do - result = scope.function_upcase(["abc"]) - result.should(eq('ABC')) - end - - it "should do nothing if a string is already upcase" do - result = scope.function_upcase(["ABC"]) - result.should(eq('ABC')) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/uriescape_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/uriescape_spec.rb deleted file mode 100644 index 371de46..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/uriescape_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the uriescape function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("uriescape").should == "function_uriescape" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_uriescape([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should uriescape a string" do - result = scope.function_uriescape([":/?#[]@!$&'()*+,;= "]) - result.should(eq('%3A%2F%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D%20')) - end - - it "should do nothing if a string is already safe" do - result = scope.function_uriescape(["ABCdef"]) - result.should(eq('ABCdef')) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb deleted file mode 100644 index 08aaf78..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb +++ /dev/null @@ -1,83 +0,0 @@ -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_absolute_path) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - # The subject of these examples is the method itself. - subject do - # This makes sure the function is loaded within each test - function_name = Puppet::Parser::Functions.function(:validate_absolute_path) - scope.method(function_name) - end - - describe "Valid Paths" do - def self.valid_paths - %w{ - C:/ - C:\\ - C:\\WINDOWS\\System32 - C:/windows/system32 - X:/foo/bar - X:\\foo\\bar - /var/tmp - /var/lib/puppet - /var/opt/../lib/puppet - } - end - - context "Without Puppet::Util.absolute_path? (e.g. Puppet <= 2.6)" do - before :each do - # The intent here is to mock Puppet to behave like Puppet 2.6 does. - # Puppet 2.6 does not have the absolute_path? method. This is only a - # convenience test, stdlib should be run with the Puppet 2.6.x in the - # $LOAD_PATH in addition to 2.7.x and master. - Puppet::Util.expects(:respond_to?).with(:absolute_path?).returns(false) - end - valid_paths.each do |path| - it "validate_absolute_path(#{path.inspect}) should not fail" do - expect { subject.call [path] }.not_to raise_error Puppet::ParseError - end - end - end - - context "Puppet without mocking" do - valid_paths.each do |path| - it "validate_absolute_path(#{path.inspect}) should not fail" do - expect { subject.call [path] }.not_to raise_error Puppet::ParseError - end - end - end - end - - describe 'Invalid paths' do - context 'Garbage inputs' do - [ - nil, - [ nil ], - { 'foo' => 'bar' }, - { }, - '', - ].each do |path| - it "validate_absolute_path(#{path.inspect}) should fail" do - expect { subject.call [path] }.to raise_error Puppet::ParseError - end - end - end - - context 'Relative paths' do - %w{ - relative1 - . - .. - ./foo - ../foo - etc/puppetlabs/puppet - opt/puppet/bin - }.each do |path| - it "validate_absolute_path(#{path.inspect}) should fail" do - expect { subject.call [path] }.to raise_error Puppet::ParseError - end - end - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_array_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_array_spec.rb deleted file mode 100644 index 4b31cfd..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_array_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_array) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - describe 'when calling validate_array from puppet' do - - %w{ true false }.each do |the_string| - it "should not compile when #{the_string} is a string" do - Puppet[:code] = "validate_array('#{the_string}')" - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not an Array/) - end - - it "should not compile when #{the_string} is a bare word" do - Puppet[:code] = "validate_array(#{the_string})" - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not an Array/) - end - end - - it "should compile when multiple array arguments are passed" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = [ ] - $bar = [ 'one', 'two' ] - validate_array($foo, $bar) - ENDofPUPPETcode - scope.compiler.compile - end - - it "should not compile when an undef variable is passed" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = undef - validate_array($foo) - ENDofPUPPETcode - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not an Array/) - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_augeas_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_augeas_spec.rb deleted file mode 100644 index ab5c140..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_augeas_spec.rb +++ /dev/null @@ -1,102 +0,0 @@ -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_augeas), :if => Puppet.features.augeas? do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - # The subject of these examplres is the method itself. - subject do - # This makes sure the function is loaded within each test - function_name = Puppet::Parser::Functions.function(:validate_augeas) - scope.method(function_name) - end - - context 'Using Puppet::Parser::Scope.new' do - - describe 'Garbage inputs' do - inputs = [ - [ nil ], - [ [ nil ] ], - [ { 'foo' => 'bar' } ], - [ { } ], - [ '' ], - [ "one", "one", "MSG to User", "4th arg" ], - ] - - inputs.each do |input| - it "validate_augeas(#{input.inspect}) should fail" do - expect { subject.call [input] }.to raise_error Puppet::ParseError - end - end - end - - describe 'Valid inputs' do - inputs = [ - [ "root:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns' ], - [ "proc /proc proc nodev,noexec,nosuid 0 0\n", 'Fstab.lns'], - ] - - inputs.each do |input| - it "validate_augeas(#{input.inspect}) should not fail" do - expect { subject.call input }.not_to raise_error - end - end - end - - describe "Valid inputs which should raise an exception without a message" do - # The intent here is to make sure valid inputs raise exceptions when they - # don't specify an error message to display. This is the behvior in - # 2.2.x and prior. - inputs = [ - [ "root:x:0:0:root\n", 'Passwd.lns' ], - [ "127.0.1.1\n", 'Hosts.lns' ], - ] - - inputs.each do |input| - it "validate_augeas(#{input.inspect}) should fail" do - expect { subject.call input }.to raise_error /validate_augeas.*?matched less than it should/ - end - end - end - - describe "Nicer Error Messages" do - # The intent here is to make sure the function returns the 3rd argument - # in the exception thrown - inputs = [ - [ "root:x:0:0:root\n", 'Passwd.lns', [], 'Failed to validate passwd content' ], - [ "127.0.1.1\n", 'Hosts.lns', [], 'Wrong hosts content' ], - ] - - inputs.each do |input| - it "validate_augeas(#{input.inspect}) should fail" do - expect { subject.call input }.to raise_error /#{input[2]}/ - end - end - end - - describe "Passing simple unit tests" do - inputs = [ - [ "root:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns', ['$file/foobar']], - [ "root:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns', ['$file/root/shell[.="/bin/sh"]', 'foobar']], - ] - - inputs.each do |input| - it "validate_augeas(#{input.inspect}) should fail" do - expect { subject.call input }.not_to raise_error - end - end - end - - describe "Failing simple unit tests" do - inputs = [ - [ "foobar:x:0:0:root:/root:/bin/bash\n", 'Passwd.lns', ['$file/foobar']], - [ "root:x:0:0:root:/root:/bin/sh\n", 'Passwd.lns', ['$file/root/shell[.="/bin/sh"]', 'foobar']], - ] - - inputs.each do |input| - it "validate_augeas(#{input.inspect}) should fail" do - expect { subject.call input }.to raise_error /testing path/ - end - end - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_bool_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_bool_spec.rb deleted file mode 100644 index 261fb23..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_bool_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -#! /usr/bin/env/ruby -S rspec - -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_bool) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - describe 'when calling validate_bool from puppet' do - - %w{ true false }.each do |the_string| - - it "should not compile when #{the_string} is a string" do - Puppet[:code] = "validate_bool('#{the_string}')" - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a boolean/) - end - - it "should compile when #{the_string} is a bare word" do - Puppet[:code] = "validate_bool(#{the_string})" - scope.compiler.compile - end - - end - - it "should not compile when an arbitrary string is passed" do - Puppet[:code] = 'validate_bool("jeff and dan are awesome")' - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a boolean/) - end - - it "should not compile when no arguments are passed" do - Puppet[:code] = 'validate_bool()' - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /wrong number of arguments/) - end - - it "should compile when multiple boolean arguments are passed" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = true - $bar = false - validate_bool($foo, $bar, true, false) - ENDofPUPPETcode - scope.compiler.compile - end - - it "should compile when multiple boolean arguments are passed" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = true - $bar = false - validate_bool($foo, $bar, true, false, 'jeff') - ENDofPUPPETcode - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a boolean/) - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_cmd_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_cmd_spec.rb deleted file mode 100644 index 69ea7f4..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_cmd_spec.rb +++ /dev/null @@ -1,81 +0,0 @@ -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_cmd) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - # The subject of these examplres is the method itself. - subject do - # This makes sure the function is loaded within each test - function_name = Puppet::Parser::Functions.function(:validate_cmd) - scope.method(function_name) - end - - context 'Using Puppet::Parser::Scope.new' do - - describe 'Garbage inputs' do - inputs = [ - [ nil ], - [ [ nil ] ], - [ { 'foo' => 'bar' } ], - [ { } ], - [ '' ], - [ "one", "one", "MSG to User", "4th arg" ], - ] - - inputs.each do |input| - it "validate_cmd(#{input.inspect}) should fail" do - expect { subject.call [input] }.to raise_error Puppet::ParseError - end - end - end - - describe 'Valid inputs' do - inputs = [ - [ '/full/path/to/something', '/bin/echo' ], - [ '/full/path/to/something', '/bin/cat' ], - ] - - inputs.each do |input| - it "validate_cmd(#{input.inspect}) should not fail" do - expect { subject.call input }.not_to raise_error - end - end - end - - describe "Valid inputs which should raise an exception without a message" do - # The intent here is to make sure valid inputs raise exceptions when they - # don't specify an error message to display. This is the behvior in - # 2.2.x and prior. - inputs = [ - [ "hello", "/bin/false" ], - ] - - inputs.each do |input| - it "validate_cmd(#{input.inspect}) should fail" do - expect { subject.call input }.to raise_error /validate_cmd.*?failed to validate content with command/ - end - end - end - - describe "Nicer Error Messages" do - # The intent here is to make sure the function returns the 3rd argument - # in the exception thrown - inputs = [ - [ "hello", [ "bye", "later", "adios" ], "MSG to User" ], - [ "greetings", "salutations", "Error, greetings does not match salutations" ], - ] - - inputs.each do |input| - it "validate_cmd(#{input.inspect}) should fail" do - expect { subject.call input }.to raise_error /#{input[2]}/ - end - end - end - - describe "Test output message" do - it "validate_cmd('whatever', 'kthnksbye') should fail" do - expect { subject.call ['whatever', 'kthnksbye'] }.to raise_error /kthnksbye.* returned 1/ - end - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_hash_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_hash_spec.rb deleted file mode 100644 index a0c35c2..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_hash_spec.rb +++ /dev/null @@ -1,43 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_hash) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - describe 'when calling validate_hash from puppet' do - - %w{ true false }.each do |the_string| - - it "should not compile when #{the_string} is a string" do - Puppet[:code] = "validate_hash('#{the_string}')" - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/) - end - - it "should not compile when #{the_string} is a bare word" do - Puppet[:code] = "validate_hash(#{the_string})" - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/) - end - - end - - it "should compile when multiple hash arguments are passed" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = {} - $bar = { 'one' => 'two' } - validate_hash($foo, $bar) - ENDofPUPPETcode - scope.compiler.compile - end - - it "should not compile when an undef variable is passed" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = undef - validate_hash($foo) - ENDofPUPPETcode - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/) - end - - end - -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_re_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_re_spec.rb deleted file mode 100644 index d189efb..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_re_spec.rb +++ /dev/null @@ -1,76 +0,0 @@ -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_re) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - # The subject of these examplres is the method itself. - subject do - # This makes sure the function is loaded within each test - function_name = Puppet::Parser::Functions.function(:validate_re) - scope.method(function_name) - end - - context 'Using Puppet::Parser::Scope.new' do - - describe 'Garbage inputs' do - inputs = [ - [ nil ], - [ [ nil ] ], - [ { 'foo' => 'bar' } ], - [ { } ], - [ '' ], - [ "one", "one", "MSG to User", "4th arg" ], - ] - - inputs.each do |input| - it "validate_re(#{input.inspect}) should fail" do - expect { subject.call [input] }.to raise_error Puppet::ParseError - end - end - end - - describe 'Valid inputs' do - inputs = [ - [ '/full/path/to/something', '^/full' ], - [ '/full/path/to/something', 'full' ], - [ '/full/path/to/something', ['full', 'absent'] ], - [ '/full/path/to/something', ['full', 'absent'], 'Message to the user' ], - ] - - inputs.each do |input| - it "validate_re(#{input.inspect}) should not fail" do - expect { subject.call input }.not_to raise_error - end - end - end - describe "Valid inputs which should raise an exception without a message" do - # The intent here is to make sure valid inputs raise exceptions when they - # don't specify an error message to display. This is the behvior in - # 2.2.x and prior. - inputs = [ - [ "hello", [ "bye", "later", "adios" ] ], - [ "greetings", "salutations" ], - ] - - inputs.each do |input| - it "validate_re(#{input.inspect}) should fail" do - expect { subject.call input }.to raise_error /validate_re.*?does not match/ - end - end - end - describe "Nicer Error Messages" do - # The intent here is to make sure the function returns the 3rd argument - # in the exception thrown - inputs = [ - [ "hello", [ "bye", "later", "adios" ], "MSG to User" ], - [ "greetings", "salutations", "Error, greetings does not match salutations" ], - ] - - inputs.each do |input| - it "validate_re(#{input.inspect}) should fail" do - expect { subject.call input }.to raise_error /#{input[2]}/ - end - end - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_slength_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_slength_spec.rb deleted file mode 100755 index eccf908..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_slength_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe "the validate_slength function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("validate_slength").should == "function_validate_slength" - end - - it "should raise a ParseError if there is less than 2 arguments" do - expect { scope.function_validate_slength([]) }.to(raise_error(Puppet::ParseError)) - expect { scope.function_validate_slength(["asdf"]) }.to(raise_error(Puppet::ParseError)) - end - - it "should raise a ParseError if argument 2 doesn't convert to a fixnum" do - expect { scope.function_validate_slength(["moo",["2"]]) }.to(raise_error(Puppet::ParseError, /Couldn't convert whatever you passed/)) - end - - it "should raise a ParseError if argument 2 converted, but to 0, e.g. a string" do - expect { scope.function_validate_slength(["moo","monkey"]) }.to(raise_error(Puppet::ParseError, /please pass a positive number as max_length/)) - end - - it "should raise a ParseError if argument 2 converted, but to 0" do - expect { scope.function_validate_slength(["moo","0"]) }.to(raise_error(Puppet::ParseError, /please pass a positive number as max_length/)) - end - - it "should fail if string greater then size" do - expect { scope.function_validate_slength(["test", 2]) }.to(raise_error(Puppet::ParseError, /It should have been less than or equal to/)) - end - - it "should fail if you pass an array of something other than strings" do - expect { scope.function_validate_slength([["moo",["moo"],Hash.new["moo" => 7]], 7]) }.to(raise_error(Puppet::ParseError, /is not a string, it's a/)) - end - - it "should fail if you pass something other than a string or array" do - expect { scope.function_validate_slength([Hash.new["moo" => "7"],6]) }.to(raise_error(Puppet::ParseError), /please pass a string, or an array of strings/) - end - - it "should not fail if string is smaller or equal to size" do - expect { scope.function_validate_slength(["test", 5]) }.to_not(raise_error(Puppet::ParseError)) - end - - it "should not fail if array of string is are all smaller or equal to size" do - expect { scope.function_validate_slength([["moo","foo","bar"], 5]) }.to_not(raise_error(Puppet::ParseError)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_string_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_string_spec.rb deleted file mode 100644 index 3b4fb3e..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/validate_string_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -#! /usr/bin/env ruby -S rspec - -require 'spec_helper' - -describe Puppet::Parser::Functions.function(:validate_string) do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - describe 'when calling validate_string from puppet' do - - %w{ foo bar baz }.each do |the_string| - - it "should compile when #{the_string} is a string" do - Puppet[:code] = "validate_string('#{the_string}')" - scope.compiler.compile - end - - it "should compile when #{the_string} is a bare word" do - Puppet[:code] = "validate_string(#{the_string})" - scope.compiler.compile - end - - end - - %w{ true false }.each do |the_string| - it "should compile when #{the_string} is a string" do - Puppet[:code] = "validate_string('#{the_string}')" - scope.compiler.compile - end - - it "should not compile when #{the_string} is a bare word" do - Puppet[:code] = "validate_string(#{the_string})" - expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a string/) - end - end - - it "should compile when multiple string arguments are passed" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = '' - $bar = 'two' - validate_string($foo, $bar) - ENDofPUPPETcode - scope.compiler.compile - end - - it "should compile when an explicitly undef variable is passed (NOTE THIS MAY NOT BE DESIRABLE)" do - Puppet[:code] = <<-'ENDofPUPPETcode' - $foo = undef - validate_string($foo) - ENDofPUPPETcode - scope.compiler.compile - end - - it "should compile when an undefined variable is passed (NOTE THIS MAY NOT BE DESIRABLE)" do - Puppet[:code] = <<-'ENDofPUPPETcode' - validate_string($foobarbazishouldnotexist) - ENDofPUPPETcode - scope.compiler.compile - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/values_at_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/values_at_spec.rb deleted file mode 100644 index 08e95a5..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/values_at_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the values_at function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("values_at").should == "function_values_at" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_values_at([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should raise a ParseError if you try to use a range where stop is greater then start" do - lambda { scope.function_values_at([['a','b'],["3-1"]]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return a value at from an array" do - result = scope.function_values_at([['a','b','c'],"1"]) - result.should(eq(['b'])) - end - - it "should return a value at from an array when passed a range" do - result = scope.function_values_at([['a','b','c'],"0-1"]) - result.should(eq(['a','b'])) - end - - it "should return chosen values from an array when passed number of indexes" do - result = scope.function_values_at([['a','b','c'],["0","2"]]) - result.should(eq(['a','c'])) - end - - it "should return chosen values from an array when passed ranges and multiple indexes" do - result = scope.function_values_at([['a','b','c','d','e','f','g'],["0","2","4-5"]]) - result.should(eq(['a','c','e','f'])) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/values_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/values_spec.rb deleted file mode 100644 index 14ae417..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/values_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the values function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should exist" do - Puppet::Parser::Functions.function("values").should == "function_values" - end - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_values([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should return values from a hash" do - result = scope.function_values([{'a'=>'1','b'=>'2','c'=>'3'}]) - # =~ is the RSpec::Matchers::MatchArray matcher. - # A.K.A. "array with same elements" (multiset) matching - result.should =~ %w{ 1 2 3 } - end - - it "should return a multiset" do - result = scope.function_values([{'a'=>'1','b'=>'3','c'=>'3'}]) - result.should =~ %w{ 1 3 3 } - result.should_not =~ %w{ 1 3 } - end - - it "should raise a ParseError unless a Hash is provided" do - lambda { scope.function_values([['a','b','c']]) }.should( raise_error(Puppet::ParseError)) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/zip_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/parser/functions/zip_spec.rb deleted file mode 100644 index f45ab17..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/parser/functions/zip_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper' - -describe "the zip function" do - let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - - it "should raise a ParseError if there is less than 1 arguments" do - lambda { scope.function_zip([]) }.should( raise_error(Puppet::ParseError)) - end - - it "should be able to zip an array" do - result = scope.function_zip([['1','2','3'],['4','5','6']]) - result.should(eq([["1", "4"], ["2", "5"], ["3", "6"]])) - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/provider/file_line/ruby_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/provider/file_line/ruby_spec.rb deleted file mode 100644 index 7857d39..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/provider/file_line/ruby_spec.rb +++ /dev/null @@ -1,127 +0,0 @@ -require 'puppet' -require 'tempfile' -provider_class = Puppet::Type.type(:file_line).provider(:ruby) -describe provider_class do - context "when adding" do - before :each do - # TODO: these should be ported over to use the PuppetLabs spec_helper - # file fixtures once the following pull request has been merged: - # https://github.com/puppetlabs/puppetlabs-stdlib/pull/73/files - tmp = Tempfile.new('tmp') - @tmpfile = tmp.path - tmp.close! - @resource = Puppet::Type::File_line.new( - {:name => 'foo', :path => @tmpfile, :line => 'foo'} - ) - @provider = provider_class.new(@resource) - end - it 'should detect if the line exists in the file' do - File.open(@tmpfile, 'w') do |fh| - fh.write('foo') - end - @provider.exists?.should be_true - end - it 'should detect if the line does not exist in the file' do - File.open(@tmpfile, 'w') do |fh| - fh.write('foo1') - end - @provider.exists?.should be_nil - end - it 'should append to an existing file when creating' do - @provider.create - File.read(@tmpfile).chomp.should == 'foo' - end - end - - context "when matching" do - before :each do - # TODO: these should be ported over to use the PuppetLabs spec_helper - # file fixtures once the following pull request has been merged: - # https://github.com/puppetlabs/puppetlabs-stdlib/pull/73/files - tmp = Tempfile.new('tmp') - @tmpfile = tmp.path - tmp.close! - @resource = Puppet::Type::File_line.new( - { - :name => 'foo', - :path => @tmpfile, - :line => 'foo = bar', - :match => '^foo\s*=.*$', - } - ) - @provider = provider_class.new(@resource) - end - - it 'should raise an error if more than one line matches, and should not have modified the file' do - File.open(@tmpfile, 'w') do |fh| - fh.write("foo1\nfoo=blah\nfoo2\nfoo=baz") - end - @provider.exists?.should be_nil - expect { @provider.create }.to raise_error(Puppet::Error, /More than one line.*matches/) - File.read(@tmpfile).should eql("foo1\nfoo=blah\nfoo2\nfoo=baz") - end - - it 'should replace a line that matches' do - File.open(@tmpfile, 'w') do |fh| - fh.write("foo1\nfoo=blah\nfoo2") - end - @provider.exists?.should be_nil - @provider.create - File.read(@tmpfile).chomp.should eql("foo1\nfoo = bar\nfoo2") - end - it 'should add a new line if no lines match' do - File.open(@tmpfile, 'w') do |fh| - fh.write("foo1\nfoo2") - end - @provider.exists?.should be_nil - @provider.create - File.read(@tmpfile).should eql("foo1\nfoo2\nfoo = bar\n") - end - it 'should do nothing if the exact line already exists' do - File.open(@tmpfile, 'w') do |fh| - fh.write("foo1\nfoo = bar\nfoo2") - end - @provider.exists?.should be_true - @provider.create - File.read(@tmpfile).chomp.should eql("foo1\nfoo = bar\nfoo2") - end - end - - context "when removing" do - before :each do - # TODO: these should be ported over to use the PuppetLabs spec_helper - # file fixtures once the following pull request has been merged: - # https://github.com/puppetlabs/puppetlabs-stdlib/pull/73/files - tmp = Tempfile.new('tmp') - @tmpfile = tmp.path - tmp.close! - @resource = Puppet::Type::File_line.new( - {:name => 'foo', :path => @tmpfile, :line => 'foo', :ensure => 'absent' } - ) - @provider = provider_class.new(@resource) - end - it 'should remove the line if it exists' do - File.open(@tmpfile, 'w') do |fh| - fh.write("foo1\nfoo\nfoo2") - end - @provider.destroy - File.read(@tmpfile).should eql("foo1\nfoo2") - end - - it 'should remove the line without touching the last new line' do - File.open(@tmpfile, 'w') do |fh| - fh.write("foo1\nfoo\nfoo2\n") - end - @provider.destroy - File.read(@tmpfile).should eql("foo1\nfoo2\n") - end - - it 'should remove any occurence of the line' do - File.open(@tmpfile, 'w') do |fh| - fh.write("foo1\nfoo\nfoo2\nfoo\nfoo") - end - @provider.destroy - File.read(@tmpfile).should eql("foo1\nfoo2\n") - end - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/type/anchor_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/type/anchor_spec.rb deleted file mode 100644 index 2030b83..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/type/anchor_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env ruby - -require 'puppet' - -anchor = Puppet::Type.type(:anchor).new(:name => "ntp::begin") - -describe anchor do - it "should stringify normally" do - anchor.to_s.should == "Anchor[ntp::begin]" - end -end diff --git a/puppet/modules/stdlib/spec/unit/puppet/type/file_line_spec.rb b/puppet/modules/stdlib/spec/unit/puppet/type/file_line_spec.rb deleted file mode 100644 index edc64bd..0000000 --- a/puppet/modules/stdlib/spec/unit/puppet/type/file_line_spec.rb +++ /dev/null @@ -1,69 +0,0 @@ -require 'puppet' -require 'tempfile' -describe Puppet::Type.type(:file_line) do - let :file_line do - Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'line', :path => '/tmp/path') - end - it 'should accept a line and path' do - file_line[:line] = 'my_line' - file_line[:line].should == 'my_line' - file_line[:path] = '/my/path' - file_line[:path].should == '/my/path' - end - it 'should accept a match regex' do - file_line[:match] = '^foo.*$' - file_line[:match].should == '^foo.*$' - end - it 'should not accept a match regex that does not match the specified line' do - expect { - Puppet::Type.type(:file_line).new( - :name => 'foo', - :path => '/my/path', - :line => 'foo=bar', - :match => '^bar=blah$' - )}.to raise_error(Puppet::Error, /the value must be a regex that matches/) - end - it 'should accept a match regex that does match the specified line' do - expect { - Puppet::Type.type(:file_line).new( - :name => 'foo', - :path => '/my/path', - :line => 'foo=bar', - :match => '^\s*foo=.*$' - )}.not_to raise_error - end - it 'should accept posix filenames' do - file_line[:path] = '/tmp/path' - file_line[:path].should == '/tmp/path' - end - it 'should not accept unqualified path' do - expect { file_line[:path] = 'file' }.to raise_error(Puppet::Error, /File paths must be fully qualified/) - end - it 'should require that a line is specified' do - expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => '/tmp/file') }.to raise_error(Puppet::Error, /Both line and path are required attributes/) - end - it 'should require that a file is specified' do - expect { Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'path') }.to raise_error(Puppet::Error, /Both line and path are required attributes/) - end - it 'should default to ensure => present' do - file_line[:ensure].should eq :present - end - - it "should autorequire the file it manages" do - catalog = Puppet::Resource::Catalog.new - file = Puppet::Type.type(:file).new(:name => "/tmp/path") - catalog.add_resource file - catalog.add_resource file_line - - relationship = file_line.autorequire.find do |rel| - (rel.source.to_s == "File[/tmp/path]") and (rel.target.to_s == file_line.to_s) - end - relationship.should be_a Puppet::Relationship - end - - it "should not autorequire the file it manages if it is not managed" do - catalog = Puppet::Resource::Catalog.new - catalog.add_resource file_line - file_line.autorequire.should be_empty - end -end diff --git a/puppet/modules/stdlib/spec/watchr.rb b/puppet/modules/stdlib/spec/watchr.rb deleted file mode 100644 index 885ef1d..0000000 --- a/puppet/modules/stdlib/spec/watchr.rb +++ /dev/null @@ -1,86 +0,0 @@ -ENV['FOG_MOCK'] ||= 'true' -ENV['AUTOTEST'] = 'true' -ENV['WATCHR'] = '1' - -system 'clear' - -def growl(message) - growlnotify = `which growlnotify`.chomp - title = "Watchr Test Results" - image = case message - when /(\d+)\s+?(failure|error)/i - ($1.to_i == 0) ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png" - else - '~/.watchr_images/unknown.png' - end - options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'" - system %(#{growlnotify} #{options} &) -end - -def run(cmd) - puts(cmd) - `#{cmd}` -end - -def run_spec_test(file) - if File.exist? file - result = run "rspec --format p --color #{file}" - growl result.split("\n").last - puts result - else - puts "FIXME: No test #{file} [#{Time.now}]" - end -end - -def filter_rspec(data) - data.split("\n").find_all do |l| - l =~ /^(\d+)\s+exampl\w+.*?(\d+).*?failur\w+.*?(\d+).*?pending/ - end.join("\n") -end - -def run_all_tests - system('clear') - files = Dir.glob("spec/**/*_spec.rb").join(" ") - result = run "rspec #{files}" - growl_results = filter_rspec result - growl growl_results - puts result - puts "GROWL: #{growl_results}" -end - -# Ctrl-\ -Signal.trap 'QUIT' do - puts " --- Running all tests ---\n\n" - run_all_tests -end - -@interrupted = false - -# Ctrl-C -Signal.trap 'INT' do - if @interrupted then - @wants_to_quit = true - abort("\n") - else - puts "Interrupt a second time to quit" - @interrupted = true - Kernel.sleep 1.5 - # raise Interrupt, nil # let the run loop catch it - run_suite - end -end - -def file2spec(file) - result = file.sub('lib/puppet/', 'spec/unit/puppet/').gsub(/\.rb$/, '_spec.rb') - result = file.sub('lib/facter/', 'spec/unit/facter/').gsub(/\.rb$/, '_spec.rb') -end - - -watch( 'spec/.*_spec\.rb' ) do |md| - #run_spec_test(md[0]) - run_all_tests -end -watch( 'lib/.*\.rb' ) do |md| - # run_spec_test(file2spec(md[0])) - run_all_tests -end diff --git a/puppet/modules/stdlib/tests/file_line.pp b/puppet/modules/stdlib/tests/file_line.pp deleted file mode 100644 index eea693e..0000000 --- a/puppet/modules/stdlib/tests/file_line.pp +++ /dev/null @@ -1,9 +0,0 @@ -# This is a simple smoke test -# of the file_line resource type. -file { '/tmp/dansfile': - ensure => present -}-> -file_line { 'dans_line': - line => 'dan is awesome', - path => '/tmp/dansfile', -} diff --git a/puppet/modules/stdlib/tests/has_interface_with.pp b/puppet/modules/stdlib/tests/has_interface_with.pp deleted file mode 100644 index e1f1353..0000000 --- a/puppet/modules/stdlib/tests/has_interface_with.pp +++ /dev/null @@ -1,10 +0,0 @@ -include stdlib -info('has_interface_with(\'lo\'):', has_interface_with('lo')) -info('has_interface_with(\'loX\'):', has_interface_with('loX')) -info('has_interface_with(\'ipaddress\', \'127.0.0.1\'):', has_interface_with('ipaddress', '127.0.0.1')) -info('has_interface_with(\'ipaddress\', \'127.0.0.100\'):', has_interface_with('ipaddress', '127.0.0.100')) -info('has_interface_with(\'network\', \'127.0.0.0\'):', has_interface_with('network', '127.0.0.0')) -info('has_interface_with(\'network\', \'128.0.0.0\'):', has_interface_with('network', '128.0.0.0')) -info('has_interface_with(\'netmask\', \'255.0.0.0\'):', has_interface_with('netmask', '255.0.0.0')) -info('has_interface_with(\'netmask\', \'256.0.0.0\'):', has_interface_with('netmask', '256.0.0.0')) - diff --git a/puppet/modules/stdlib/tests/has_ip_address.pp b/puppet/modules/stdlib/tests/has_ip_address.pp deleted file mode 100644 index 8429a88..0000000 --- a/puppet/modules/stdlib/tests/has_ip_address.pp +++ /dev/null @@ -1,3 +0,0 @@ -include stdlib -info('has_ip_address(\'192.168.1.256\'):', has_ip_address('192.168.1.256')) -info('has_ip_address(\'127.0.0.1\'):', has_ip_address('127.0.0.1')) diff --git a/puppet/modules/stdlib/tests/has_ip_network.pp b/puppet/modules/stdlib/tests/has_ip_network.pp deleted file mode 100644 index a15d8c0..0000000 --- a/puppet/modules/stdlib/tests/has_ip_network.pp +++ /dev/null @@ -1,4 +0,0 @@ -include stdlib -info('has_ip_network(\'127.0.0.0\'):', has_ip_network('127.0.0.0')) -info('has_ip_network(\'128.0.0.0\'):', has_ip_network('128.0.0.0')) - diff --git a/puppet/modules/stdlib/tests/init.pp b/puppet/modules/stdlib/tests/init.pp deleted file mode 100644 index 9675d83..0000000 --- a/puppet/modules/stdlib/tests/init.pp +++ /dev/null @@ -1 +0,0 @@ -include stdlib diff --git a/puppet/modules/supervisor/Modulefile b/puppet/modules/supervisor/Modulefile deleted file mode 100644 index 360e9c0..0000000 --- a/puppet/modules/supervisor/Modulefile +++ /dev/null @@ -1,9 +0,0 @@ -name 'seocam-supervisor' -version '0.0.1' -source 'https://github.com/TracyWebTech/puppet-supervisor' -author 'Tracy Web Technologies' -summary 'Install and configure Supervisord' -description "This puppet module is used to install and configure Supervisord. It also provides a custom define to manage services (apps) using it." -project_page 'https://github.com/TracyWebTech/puppet-supervisor' - -#dependency 'puppetlabs/stdlib', '>= 2.2.1' diff --git a/puppet/modules/supervisor/README.md b/puppet/modules/supervisor/README.md deleted file mode 100644 index 64dbf28..0000000 --- a/puppet/modules/supervisor/README.md +++ /dev/null @@ -1,27 +0,0 @@ -Puppet Supervisor -================= - -Install and manage apps in supervisord - - -Usage -================= - -Include supervisor class -```puppet -include supervisor -``` - -Install your app using defined type supervisor::app - -```puppet -supervisor::app { 'your-app-title': - app_name => 'your-app-name' # Default to 'your-app-title' - command => 'The command that will be run this app', # required - directory => 'Path where your command will be run' # required - user => 'User to execute this app' # Default to ubuntu - startsecs => 'The total number of seconds which the program needs to stay running after a startup to consider the start successful' # Default to undef - stopwaitsecs => 'The number of seconds to wait for the OS to return a SIGCHILD to supervisord after the program has been sent a stopsignal', # Default to undef - priority => 'The relative priority of the program in the start and shutdown ordering' # Default to undef -} -``` diff --git a/puppet/modules/supervisor/files/debian-isnok-initscript b/puppet/modules/supervisor/files/debian-isnok-initscript deleted file mode 100755 index 01fd900..0000000 --- a/puppet/modules/supervisor/files/debian-isnok-initscript +++ /dev/null @@ -1,217 +0,0 @@ -#! /bin/sh -# -# supervisor built from skeleton /etc/init.d/ script. -# -# skeleton by Miquel van Smoorenburg . -# Modified for Debian by Ian Murdock . -# Further changes by Javier Fernandez-Sanguino . -# More changes by Konstantin Martini . -# -# Version: @(#)supervisor 0.8 25-Jun-2013 isnok@tuxcode.org -# -### BEGIN INIT INFO -# Provides: supervisor -# Required-Start: $remote_fs $network $named -# Required-Stop: $remote_fs $network $named -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start/stop supervisord -# Description: Start/stop supervisor daemon and its configured -# subprocesses. -### END INIT INFO - - -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -#DAEMON=/usr/bin/supervisord # Debian package version (presently 3.0a8-1) -DAEMON=/usr/local/bin/supervisord # Python package index (pypi) version (3.0b1) -NAME=supervisord -DESC="supervisord" - -CONFIGFILE=/etc/supervisord.conf # the supervisord config file -SUPERVISORCTL=/usr/local/bin/supervisorctl # used for reload command(s) -#SUPERVISORCTL=/usr/bin/supervisorctl # again: official deb version - -if [ ! -x $DAEMON ]; then - echo "ERROR: Not executable: $DAEMON" - exit 0 -fi - -LOGDIR=/var/log/supervisor -PIDFILE=/var/run/$NAME.pid -DODTIME=5 # Time to wait for the server to die, in seconds - # If this value is set too low you might not - # let some servers to die gracefully and - # 'restart' will not work. - -# fix some args for certain commands -DAEMON_ARGS="-c$CONFIGFILE" -CTL_ARGS="-c$CONFIGFILE" -STARTSTOP_ARGS="--quiet --pidfile $PIDFILE --exec $DAEMON" - -# Include supervisor defaults if available -if [ -r /etc/default/supervisor ]; then - . /etc/default/supervisor -fi - -set -e - -dod_sleep () { - if [ -n "$DODTIME" ]; then - sleep "$DODTIME"s - fi -} - -running_pid () { - # Check if a pid's cmdline contains a string (name). - # This should work for all users. - pid="$1" - name="$2" - if [ -z "$pid" ]; then - return 1 # no pid given - fi - if [ ! -d /proc/"$pid" ]; then - return 1 # no /proc/$pid directory - fi - if cat /proc/"$pid"/cmdline | tr "\000" "\n"| grep -q "$name"; then - return 0 - else - return 1 # $pid does not match $name - fi -} - -running () { - # Check if DAEMON is running by examining $PIDFILE. - # If this succeeds, it sets $pid (a side effect being used). - - if [ ! -f "$PIDFILE" ]; then - return 1 # No pidfile, probably no daemon present. - fi - # Now, obtain the pid and check it's /proc cmdline: - pid="$(cat $PIDFILE)" - if running_pid "$pid" "$DAEMON"; then - return 0 - else - return 1 - fi -} - -normal_start () { - start-stop-daemon $STARTSTOP_ARGS --start \ - -- "$DAEMON_ARGS" $DAEMON_OPTS - if [ ! -f "$PIDFILE" ]; then - sleep 1 # grace time to create PIDFILE - fi -} - -normal_stop () { - #start-stop-daemon $STARTSTOP_ARGS --stop --oknodo - "$SUPERVISORCTL" $CTL_ARGS shutdown -} - -force_stop () { - # Forcefully stop a running DAEMON. - if running; then - kill -15 "$pid" - dod_sleep - # Check again, try harder if needed. - if running; then - kill -9 "$pid" - dod_sleep - if running; then - echo "Unable to kill running $NAME process (pid=$pid)!" - exit 1 - fi - fi - fi - rm -f "$PIDFILE" - return 0 -} - -ctl_reload () { - # make supervisord reload it's config - if [ -x "$SUPERVISORCTL" ]; then - "$SUPERVISORCTL" $CTL_ARGS reload - else - return 1 - fi -} - -ctl_status () { - # show stati of supervised processes. - # do not mind if this fails. - "$SUPERVISORCTL" $CTL_ARGS status -} - -case "$1" in - start) - echo -n "Starting $DESC: " - normal_start - if running; then - echo "$NAME." - else - echo "ERROR." - fi - ;; - stop) - echo -n "Stopping $DESC: " - if normal_stop; then - echo "$NAME." - else - echo "ERROR." - fi - ;; - restart) - echo "Restarting $DESC..." - "$0" stop && "$0" start - ;; - force-stop) - echo -n "Forcefully stopping $DESC: " - force_stop - if running; then - echo "$NAME." - else - echo "ERROR." - fi - ;; - reload|force-reload) - # - # If the daemon can reload its config files on the fly - # for example by sending it SIGHUP, do it here. - # - # If the daemon responds to changes in its config file - # directly anyway, make this a do-nothing entry. - # - echo "Reloading $DESC: " - if ctl_reload; then - echo "$NAME." - else - echo "ERROR." - fi - ;; - #force-reload) - # - # If the "reload" option is implemented, move the "force-reload" - # option to the "reload" entry above. If not, "force-reload" is - # just the same as "restart" except that it does nothing if the - # daemon isn't already running. - # Check wether $DAEMON is running. If so, restart. - #echo "Not implemented." - #;; - status) - echo -n "$NAME is " - if running; then - echo "running" -# ctl_status - else - echo "not running." - exit 1 - fi - ;; - *) - N=/etc/init.d/"$NAME" - echo "Usage: $N {start|stop|restart|reload|status|force-stop}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/puppet/modules/supervisor/files/supervisord.conf b/puppet/modules/supervisor/files/supervisord.conf deleted file mode 100644 index d90a127..0000000 --- a/puppet/modules/supervisor/files/supervisord.conf +++ /dev/null @@ -1,139 +0,0 @@ -; Sample supervisor config file. -; -; For more information on the config file, please see: -; http://supervisord.org/configuration.html -; -; Note: shell expansion ("~" or "$HOME") is not supported. Environment -; variables can be expanded using this syntax: "%(ENV_HOME)s". - -[unix_http_server] -file=/tmp/supervisor.sock ; (the path to the socket file) -;chmod=0700 ; socket file mode (default 0700) -;chown=nobody:nogroup ; socket file uid:gid owner -;username=user ; (default is no username (open server)) -;password=123 ; (default is no password (open server)) - -;[inet_http_server] ; inet (TCP) server disabled by default -;port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface) -;username=user ; (default is no username (open server)) -;password=123 ; (default is no password (open server)) - -[supervisord] -logfile=/var/log/supervisord.log ; (main log file;default $CWD/supervisord.log) -logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) -logfile_backups=10 ; (num of main logfile rotation backups;default 10) -loglevel=info ; (log level;default info; others: debug,warn,trace) -pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) -nodaemon=false ; (start in foreground if true;default false) -minfds=1024 ; (min. avail startup file descriptors;default 1024) -minprocs=200 ; (min. avail process descriptors;default 200) -;umask=022 ; (process file creation umask;default 022) -;user=chrism ; (default is current user, required if root) -;identifier=supervisor ; (supervisord identifier, default is 'supervisor') -;directory=/tmp ; (default is not to cd during start) -;nocleanup=true ; (don't clean up tempfiles at start;default false) -;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP) -;environment=KEY="value" ; (key value pairs to add to environment) -;strip_ansi=false ; (strip ansi escape codes in logs; def. false) - -; the below section must remain in the config file for RPC -; (supervisorctl/web interface) to work, additional interfaces may be -; added by defining them in separate rpcinterface: sections -[rpcinterface:supervisor] -supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface - -[supervisorctl] -serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket -;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket -;username=chris ; should be same as http_username if set -;password=123 ; should be same as http_password if set -;prompt=mysupervisor ; cmd line prompt (default "supervisor") -;history_file=~/.sc_history ; use readline history if available - -; The below sample program section shows all possible program subsection values, -; create one or more 'real' program: sections to be able to control them under -; supervisor. - -;[program:theprogramname] -;command=/bin/cat ; the program (relative uses PATH, can take args) -;process_name=%(program_name)s ; process_name expr (default %(program_name)s) -;numprocs=1 ; number of processes copies to start (def 1) -;directory=/tmp ; directory to cwd to before exec (def no cwd) -;umask=022 ; umask for process (default None) -;priority=999 ; the relative start priority (default 999) -;autostart=true ; start at supervisord start (default: true) -;autorestart=unexpected ; whether/when to restart (default: unexpected) -;startsecs=1 ; number of secs prog must stay running (def. 1) -;startretries=3 ; max # of serial start failures (default 3) -;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) -;stopsignal=QUIT ; signal used to kill process (default TERM) -;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) -;stopasgroup=false ; send stop signal to the UNIX process group (default false) -;killasgroup=false ; SIGKILL the UNIX process group (def false) -;user=chrism ; setuid to this UNIX account to run the program -;redirect_stderr=true ; redirect proc stderr to stdout (default false) -;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO -;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) -;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) -;stdout_events_enabled=false ; emit events on stdout writes (default false) -;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO -;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) -;stderr_logfile_backups=10 ; # of stderr logfile backups (default 10) -;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) -;stderr_events_enabled=false ; emit events on stderr writes (default false) -;environment=A="1",B="2" ; process environment additions (def no adds) -;serverurl=AUTO ; override serverurl computation (childutils) - -; The below sample eventlistener section shows all possible -; eventlistener subsection values, create one or more 'real' -; eventlistener: sections to be able to handle event notifications -; sent by supervisor. - -;[eventlistener:theeventlistenername] -;command=/bin/eventlistener ; the program (relative uses PATH, can take args) -;process_name=%(program_name)s ; process_name expr (default %(program_name)s) -;numprocs=1 ; number of processes copies to start (def 1) -;events=EVENT ; event notif. types to subscribe to (req'd) -;buffer_size=10 ; event buffer queue size (default 10) -;directory=/tmp ; directory to cwd to before exec (def no cwd) -;umask=022 ; umask for process (default None) -;priority=-1 ; the relative start priority (default -1) -;autostart=true ; start at supervisord start (default: true) -;autorestart=unexpected ; whether/when to restart (default: unexpected) -;startsecs=1 ; number of secs prog must stay running (def. 1) -;startretries=3 ; max # of serial start failures (default 3) -;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) -;stopsignal=QUIT ; signal used to kill process (default TERM) -;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) -;stopasgroup=false ; send stop signal to the UNIX process group (default false) -;killasgroup=false ; SIGKILL the UNIX process group (def false) -;user=chrism ; setuid to this UNIX account to run the program -;redirect_stderr=true ; redirect proc stderr to stdout (default false) -;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO -;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) -;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -;stdout_events_enabled=false ; emit events on stdout writes (default false) -;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO -;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) -;stderr_logfile_backups ; # of stderr logfile backups (default 10) -;stderr_events_enabled=false ; emit events on stderr writes (default false) -;environment=A="1",B="2" ; process environment additions -;serverurl=AUTO ; override serverurl computation (childutils) - -; The below sample group section shows all possible group values, -; create one or more 'real' group: sections to create "heterogeneous" -; process groups. - -;[group:thegroupname] -;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions -;priority=999 ; the relative start priority (default 999) - -; The [include] section can just contain the "files" setting. This -; setting can list multiple files (separated by whitespace or -; newlines). It can also contain wildcards. The filenames are -; interpreted as relative to this file. Included files *cannot* -; include files themselves. - -[include] -files = /etc/supervisor/conf.d/*.conf diff --git a/puppet/modules/supervisor/files/ubuntu-initscript b/puppet/modules/supervisor/files/ubuntu-initscript deleted file mode 100755 index 511befe..0000000 --- a/puppet/modules/supervisor/files/ubuntu-initscript +++ /dev/null @@ -1,170 +0,0 @@ -#! /bin/sh -# -# Downloaded from: -# http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/supervisor/trusty/view/head:/debian/supervisor.init -# -# skeleton example file to build /etc/init.d/ scripts. -# This file should be used to construct scripts for /etc/init.d. -# -# Written by Miquel van Smoorenburg . -# Modified for Debian -# by Ian Murdock . -# Further changes by Javier Fernandez-Sanguino -# -# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl -# -### BEGIN INIT INFO -# Provides: supervisor -# Required-Start: $remote_fs $network $named -# Required-Stop: $remote_fs $network $named -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start/stop supervisor -# Description: Start/stop supervisor daemon and its configured -# subprocesses. -### END INIT INFO - -. /lib/lsb/init-functions - -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -DAEMON=/usr/local/bin/supervisord -NAME=supervisord -DESC=supervisor - -test -x $DAEMON || exit 0 - -LOGDIR=/var/log/supervisor -PIDFILE=/var/run/$NAME.pid -DODTIME=5 # Time to wait for the server to die, in seconds - # If this value is set too low you might not - # let some servers to die gracefully and - # 'restart' will not work - -# Include supervisor defaults if available -if [ -f /etc/default/supervisor ] ; then - . /etc/default/supervisor -fi -DAEMON_OPTS="-c /etc/supervisord.conf $DAEMON_OPTS" - -set -e - -running_pid() -{ - # Check if a given process pid's cmdline matches a given name - pid=$1 - name=$2 - [ -z "$pid" ] && return 1 - [ ! -d /proc/$pid ] && return 1 - (cat /proc/$pid/cmdline | tr "\000" "\n"|grep -q $name) || return 1 - return 0 -} - -running() -{ -# Check if the process is running looking at /proc -# (works for all users) - - # No pidfile, probably no daemon present - [ ! -f "$PIDFILE" ] && return 1 - # Obtain the pid and check it against the binary name - pid=`cat $PIDFILE` - running_pid $pid $DAEMON || return 1 - return 0 -} - -force_stop() { -# Forcefully kill the process - [ ! -f "$PIDFILE" ] && return - if running ; then - kill -15 $pid - # Is it really dead? - [ -n "$DODTIME" ] && sleep "$DODTIME"s - if running ; then - kill -9 $pid - [ -n "$DODTIME" ] && sleep "$DODTIME"s - if running ; then - echo "Cannot kill $LABEL (pid=$pid)!" - exit 1 - fi - fi - fi - rm -f $PIDFILE - return 0 -} - -case "$1" in - start) - echo -n "Starting $DESC: " - start-stop-daemon --start --quiet --pidfile $PIDFILE \ - --startas $DAEMON -- $DAEMON_OPTS - test -f $PIDFILE || sleep 1 - if running ; then - echo "$NAME." - else - echo " ERROR." - fi - ;; - stop) - echo -n "Stopping $DESC: " - start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE - echo "$NAME." - ;; - force-stop) - echo -n "Forcefully stopping $DESC: " - force_stop - if ! running ; then - echo "$NAME." - else - echo " ERROR." - fi - ;; - #reload) - # - # If the daemon can reload its config files on the fly - # for example by sending it SIGHUP, do it here. - # - # If the daemon responds to changes in its config file - # directly anyway, make this a do-nothing entry. - # - # echo "Reloading $DESC configuration files." - # start-stop-daemon --stop --signal 1 --quiet --pidfile \ - # /var/run/$NAME.pid --exec $DAEMON - #;; - force-reload) - # - # If the "reload" option is implemented, move the "force-reload" - # option to the "reload" entry above. If not, "force-reload" is - # just the same as "restart" except that it does nothing if the - # daemon isn't already running. - # check wether $DAEMON is running. If so, restart - start-stop-daemon --stop --test --quiet --pidfile $PIDFILE \ - --startas $DAEMON \ - && $0 restart \ - || exit 0 - ;; - restart) - echo -n "Restarting $DESC: " - start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE - [ -n "$DODTIME" ] && sleep $DODTIME - start-stop-daemon --start --quiet --pidfile $PIDFILE \ - --startas $DAEMON -- $DAEMON_OPTS - echo "$NAME." - ;; - status) - echo -n "$LABEL is " - if running ; then - echo "running" - else - echo " not running." - exit 1 - fi - ;; - *) - N=/etc/init.d/$NAME - # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $N {start|stop|restart|force-reload|status|force-stop}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/puppet/modules/supervisor/manifests/app.pp b/puppet/modules/supervisor/manifests/app.pp deleted file mode 100644 index c1f8f0e..0000000 --- a/puppet/modules/supervisor/manifests/app.pp +++ /dev/null @@ -1,34 +0,0 @@ -define supervisor::app ( - $app_name = $title, - $command, - $directory, - $user = 'ubuntu', - $startsecs = undef, - $stopwaitsecs = undef, - $priority = undef, -) { - - $conf_file = "supervisor_${app_name}" - $service_name = $conf_file - - file { $conf_file: - path => "/etc/supervisor/conf.d/${app_name}.conf", - ensure => present, - content => template('supervisor/supervisor.conf.erb'), - require => Package['supervisor'], - notify => Service['supervisord'], - } - - service { $service_name: - ensure => running, - path => ['/usr/bin'], - start => "supervisorctl start $app_name", - restart => "supervisorctl restart $app_name", - stop => "supervisorctl stop $app_name", - status => "supervisorctl status | awk '/^${name}[: ]/{print \$2}' | grep '^RUNNING$'", - subscribe => File[$conf_file], - hasrestart => false, - hasstatus => false, - provider => base - } -} diff --git a/puppet/modules/supervisor/manifests/init.pp b/puppet/modules/supervisor/manifests/init.pp deleted file mode 100644 index 50d427c..0000000 --- a/puppet/modules/supervisor/manifests/init.pp +++ /dev/null @@ -1,45 +0,0 @@ -class supervisor { - - package { "supervisor": - ensure => installed, - provider => pip, - } - - service { "supervisord": - ensure => running, - enable => true, - require => [Package['supervisor'], - File['/etc/init.d/supervisord']], - stop => '/etc/init.d/supervisord stop', - start => '/etc/init.d/supervisord start', - restart => '/etc/init.d/supervisord restart', - subscribe => File['/etc/supervisord.conf'], - } - - case $operatingsystem { - debian: { $supervisord_conf = "puppet:///modules/supervisor/debian-isnok-initscript" } - ubuntu: { $supervisord_conf = "puppet:///modules/supervisor/ubuntu-initscript" } - } - - file { '/etc/init.d/supervisord': - source => $supervisord_conf, - mode => '0755', - } - - file { '/etc/supervisor': - ensure => directory, - } - - file { '/etc/supervisord.conf': - source => 'puppet:///modules/supervisor/supervisord.conf', - require => File['/etc/supervisor'], - } - - file { '/etc/supervisor/conf.d/': - ensure => directory, - recurse => true, - purge => true, - notify => Service['supervisord'], - require => File['/etc/supervisor'], - } -} diff --git a/puppet/modules/supervisor/templates/supervisor.conf.erb b/puppet/modules/supervisor/templates/supervisor.conf.erb deleted file mode 100644 index b49c739..0000000 --- a/puppet/modules/supervisor/templates/supervisor.conf.erb +++ /dev/null @@ -1,16 +0,0 @@ -[program:<%= @app_name %>] -command=<%= @command %> -directory=<%= @directory %> -user=<%= @user %> -autostart=true -autorestart=true -redirect_stderr=True -<%- if @startsecs -%> -startsecs=<%= @startsecs %> -<%- end -%> -<%- if @stopwaitsecs -%> -stopwaitsecs=<%= @stopwaitsecs %> -<%- end -%> -<%- if @priority -%> -priority=<%= @priority %> -<%- end -%> diff --git a/puppet/modules/supervisor/tests/init.pp b/puppet/modules/supervisor/tests/init.pp deleted file mode 100644 index 91c0893..0000000 --- a/puppet/modules/supervisor/tests/init.pp +++ /dev/null @@ -1,7 +0,0 @@ - -include supervisor - -supervisor::app { 'fake_service': - command => '/bin/cat', - directory => '/tmp/', -} diff --git a/puppet/modules/timezone/.gitignore b/puppet/modules/timezone/.gitignore deleted file mode 100644 index 6ee20c2..0000000 --- a/puppet/modules/timezone/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -pkg/ -*.swp diff --git a/puppet/modules/timezone/LICENSE b/puppet/modules/timezone/LICENSE deleted file mode 100644 index 57bc88a..0000000 --- a/puppet/modules/timezone/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - diff --git a/puppet/modules/timezone/Modulefile b/puppet/modules/timezone/Modulefile deleted file mode 100644 index e8f0cb9..0000000 --- a/puppet/modules/timezone/Modulefile +++ /dev/null @@ -1,9 +0,0 @@ -name 'saz-timezone' -version '1.1.0' - -author 'saz' -license 'Apache License, Version 2.0' -project_page 'https://github.com/saz/puppet-timezone' -source 'git://github.com/saz/puppet-timezone' -summary 'UNKNOWN' -description 'Manage timezone settings via Puppet' diff --git a/puppet/modules/timezone/README.md b/puppet/modules/timezone/README.md deleted file mode 100644 index ce8443d..0000000 --- a/puppet/modules/timezone/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# puppet-timezone - -Manage timezone settings via Puppet - -## Usage - -### Set timezone to UTC -``` - class { 'timezone': - timezone => 'UTC', - } -``` - -### Set timezone to Europe/Berlin -``` - class { 'timezone': - timezone => 'Europe/Berlin', - } -``` - -## Other class parameters -* ensure: present or absent, default: present -* autoupgrade: true or false, default: false. Auto-upgrade package, if there is a newer version -* package: string, default: OS specific. Set package name, if platform is not supported. -* config_file: string, default: OS specific. Set config_file, if platform is not supported. -* zoneinfo_dir: string, default: OS specific. Set zoneinfo_dir, if platform is not supported. diff --git a/puppet/modules/timezone/manifests/init.pp b/puppet/modules/timezone/manifests/init.pp deleted file mode 100644 index a570785..0000000 --- a/puppet/modules/timezone/manifests/init.pp +++ /dev/null @@ -1,82 +0,0 @@ -# Class: timezone -# -# This module manages timezone settings -# -# Parameters: -# [*timezone*] -# The name of the timezone. -# Default: UTC -# -# [*ensure*] -# Ensure if present or absent. -# Default: present -# -# [*autoupgrade*] -# Upgrade package automatically, if there is a newer version. -# Default: false -# -# [*package*] -# Name of the package. -# Only set this, if your platform is not supported or you know, what you're doing. -# Default: auto-set, platform specific -# -# [*config_file*] -# Main configuration file. -# Only set this, if your platform is not supported or you know, what you're doing. -# Default: auto-set, platform specific -# -# [*zoneinfo_dir*] -# Source directory of zoneinfo files. -# Only set this, if your platform is not supported or you know, what you're doing. -# Default: auto-set, platform specific -# -# Actions: -# Installs tzdata and configures timezone -# -# Requires: -# Nothing -# -# Sample Usage: -# class { 'timezone': -# timezone => 'Europe/Berlin', -# } -# -# [Remember: No empty lines between comments and class definition] -class timezone ( - $timezone = 'UTC', - $ensure = 'present', - $autoupgrade = false, - $package = $timezone::params::package, - $config_file = $timezone::params::config_file, - $zoneinfo_dir = $timezone::params::zoneinfo_dir -) inherits timezone::params { - - case $ensure { - /(present)/: { - if $autoupgrade == true { - $package_ensure = 'latest' - } else { - $package_ensure = 'present' - } - $config_ensure = 'link' - } - /(absent)/: { - # Leave package installed, as it is a system dependency - $package_ensure = 'present' - $config_ensure = 'absent' - } - default: { - fail('ensure parameter must be present or absent') - } - } - - package { $package: - ensure => $package_ensure, - } - - file { $config_file: - ensure => $config_ensure, - target => "${zoneinfo_dir}${timezone}", - require => Package[$package], - } -} diff --git a/puppet/modules/timezone/manifests/params.pp b/puppet/modules/timezone/manifests/params.pp deleted file mode 100644 index 8b037af..0000000 --- a/puppet/modules/timezone/manifests/params.pp +++ /dev/null @@ -1,12 +0,0 @@ -class timezone::params { - case $::operatingsystem { - /(Ubuntu|Debian|Gentoo|CentOS|Amazon)/: { - $package = 'tzdata' - $zoneinfo_dir = '/usr/share/zoneinfo/' - $config_file = '/etc/localtime' - } - default: { - fail("Unsupported platform: ${::operatingsystem}") - } - } -} diff --git a/puppet/modules/timezone/spec/spec.opts b/puppet/modules/timezone/spec/spec.opts deleted file mode 100644 index 91cd642..0000000 --- a/puppet/modules/timezone/spec/spec.opts +++ /dev/null @@ -1,6 +0,0 @@ ---format -s ---colour ---loadby -mtime ---backtrace diff --git a/puppet/modules/timezone/spec/spec_helper.rb b/puppet/modules/timezone/spec/spec_helper.rb deleted file mode 100644 index a4aeeae..0000000 --- a/puppet/modules/timezone/spec/spec_helper.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'pathname' -dir = Pathname.new(__FILE__).parent -$LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib') - -require 'mocha' -require 'puppet' -gem 'rspec', '=1.2.9' -require 'spec/autorun' - -Spec::Runner.configure do |config| - config.mock_with :mocha -end - -# We need this because the RAL uses 'should' as a method. This -# allows us the same behaviour but with a different method name. -class Object - alias :must :should -end diff --git a/puppet/modules/timezone/tests/init.pp b/puppet/modules/timezone/tests/init.pp deleted file mode 100644 index 07794dc..0000000 --- a/puppet/modules/timezone/tests/init.pp +++ /dev/null @@ -1 +0,0 @@ -include timezone diff --git a/puppet/modules/vim/README.md b/puppet/modules/vim/README.md deleted file mode 100644 index 39726ef..0000000 --- a/puppet/modules/vim/README.md +++ /dev/null @@ -1,2 +0,0 @@ -puppet-vim -========== \ No newline at end of file diff --git a/puppet/modules/vim/files/vimrc.local b/puppet/modules/vim/files/vimrc.local deleted file mode 100644 index e69de29..0000000 --- a/puppet/modules/vim/files/vimrc.local +++ /dev/null diff --git a/puppet/modules/vim/manifests/init.pp b/puppet/modules/vim/manifests/init.pp deleted file mode 100644 index 0f9448b..0000000 --- a/puppet/modules/vim/manifests/init.pp +++ /dev/null @@ -1,23 +0,0 @@ -class vim ( - $vim_file = 'puppet:///modules/vim/vimrc.local' - ) { - - if ! defined(Package['vim']) { - package { 'vim': - ensure => installed - } - } - - file { 'editor_vim': - path => '/etc/profile.d/editor.sh', - ensure => present, - content => 'export EDITOR="vim"', - } - - file { 'vimrc': - path => '/etc/vim/vimrc.local', - ensure => present, - source => $vim_file - } - -} diff --git a/puppet/modules/vim/test/init.pp b/puppet/modules/vim/test/init.pp deleted file mode 100644 index e69de29..0000000 --- a/puppet/modules/vim/test/init.pp +++ /dev/null -- libgit2 0.21.2