Skip to content
Permalink
Browse files

Merge pull request #6831 from DavidS/pup-8716-remove-pmt-generate

(PUP-8716) remove `puppet module generate` functionality
  • Loading branch information
jhelwig committed Jun 19, 2018
2 parents 1b31936 + 157f6ed commit 4fc612518099762ee85c2bd2545f4c81b6fa51a6
Showing with 55 additions and 1,622 deletions.
  1. +0 −1 .rubocop.yml
  2. +10 −10 acceptance/lib/puppet/acceptance/module_utils.rb
  3. +29 −11 acceptance/tests/face/loadable_from_modules.rb
  4. +0 −27 acceptance/tests/modules/build/build_agent.rb
  5. +0 −78 acceptance/tests/modules/build/build_basic.rb
  6. +0 −50 acceptance/tests/modules/build/build_ignore_module_file.rb
  7. +0 −42 acceptance/tests/modules/build/build_should_not_allow_symlinks.rb
  8. +0 −36 acceptance/tests/modules/build/build_should_not_create_changes.rb
  9. +0 −27 acceptance/tests/modules/generate/basic_generate.rb
  10. +0 −4 lib/puppet/defaults.rb
  11. +4 −59 lib/puppet/face/module/build.rb
  12. +5 −247 lib/puppet/face/module/generate.rb
  13. +0 −1 lib/puppet/module_tool/applications.rb
  14. +1 −1 lib/puppet/module_tool/applications/application.rb
  15. +0 −152 lib/puppet/module_tool/applications/builder.rb
  16. +0 −7 lib/puppet/module_tool/skeleton/templates/generator/.fixtures.yml.erb
  17. +0 −18 lib/puppet/module_tool/skeleton/templates/generator/.gitignore
  18. +0 −42 lib/puppet/module_tool/skeleton/templates/generator/.rubocop.yml
  19. +0 −1 lib/puppet/module_tool/skeleton/templates/generator/.yardopts
  20. +0 −18 lib/puppet/module_tool/skeleton/templates/generator/Gemfile
  21. +0 −89 lib/puppet/module_tool/skeleton/templates/generator/README.md.erb
  22. +0 −32 lib/puppet/module_tool/skeleton/templates/generator/Rakefile
  23. +0 −12 lib/puppet/module_tool/skeleton/templates/generator/examples/init.pp.erb
  24. +0 −48 lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb
  25. +0 −1 lib/puppet/module_tool/skeleton/templates/generator/metadata.json.erb
  26. +0 −6 lib/puppet/module_tool/skeleton/templates/generator/spec/classes/init_spec.rb.erb
  27. +0 −1 lib/puppet/module_tool/skeleton/templates/generator/spec/spec_helper.rb
  28. +0 −8 man/man5/puppet.conf.5
  29. +6 −84 man/man8/puppet-module.8
  30. +0 −69 spec/unit/face/module/build_spec.rb
  31. +0 −440 spec/unit/module_tool/applications/builder_spec.rb
@@ -15,7 +15,6 @@ AllCops:
- 'lib/puppet/vendor/**/*'
- 'lib/puppet/parser/parser.rb'
- 'lib/puppet/pops/parser/eparser.rb'
- 'lib/puppet/module_tool/skeleton/**/*'
- 'lib/semantic_puppet/dependency/module_release.rb'

Lint/ConditionPosition:
@@ -14,7 +14,7 @@ module ModuleUtils
#
# @param host [String] hostname
# @return [Array] paths for found modulepath
def get_modulepaths_for_host (host)
def get_modulepaths_for_host(host)
environment = on(host, puppet("config print environment")).stdout.chomp
on(host, puppet("config print modulepath --environment #{environment}")).stdout.chomp.split(host['pathseparator'])
end
@@ -27,7 +27,7 @@ def get_modulepaths_for_host (host)
#
# @param host [String] hostname
# @return [String] first path for found modulepath
def get_default_modulepath_for_host (host)
def get_default_modulepath_for_host(host)
get_modulepaths_for_host(host)[0]
end

@@ -43,7 +43,7 @@ def get_default_modulepath_for_host (host)
#
# @param host [String] hostname
# @return [Array] paths for found modules
def get_installed_modules_for_host (host)
def get_installed_modules_for_host(host)
on host, puppet("module list --render-as pson")
str = stdout.lines.to_a.last
pat = /\(([^()]+)\)/
@@ -74,7 +74,7 @@ def get_installed_modules_for_host (host)
#
# @param hosts [Array] hostnames
# @return [Hash] paths for found modules indexed by hostname
def get_installed_modules_for_hosts (hosts)
def get_installed_modules_for_hosts(hosts)
mods = {}
hosts.each do |host|
mods[host] = get_installed_modules_for_host host
@@ -102,7 +102,7 @@ def get_installed_modules_for_hosts (hosts)
# by hostname. Taken in the setup stage of a test.
# @param ending_hash [Hash] paths for found modules indexed
# by hostname. Taken in the teardown stage of a test.
def rm_installed_modules_from_hosts (beginning_hash, ending_hash)
def rm_installed_modules_from_hosts(beginning_hash, ending_hash)
ending_hash.each do |host, mod_array|
mod_array.each do |mod|
if ! beginning_hash[host].include? mod
@@ -119,7 +119,7 @@ def rm_installed_modules_from_hosts (beginning_hash, ending_hash)
# 10242
#
# @param semver [String] semantic version number
def semver_to_i ( semver )
def semver_to_i( semver )
# semver assumed to be in format <major>.<minor>.<patch>
# calculation assumes that each segment is < 100
tmp = semver.split('.')
@@ -133,7 +133,7 @@ def semver_to_i ( semver )
# a value greater than 0 indicates that the semver1 is greater than semver2
# a value less than 0 indicates that the semver1 is less than semver2
#
def semver_cmp ( semver1, semver2 )
def semver_cmp( semver1, semver2 )
semver_to_i(semver1) - semver_to_i(semver2)
end

@@ -151,7 +151,7 @@ def semver_cmp ( semver1, semver2 )
# installed version
# @param compare_op [String] the operator for comparing the verions of
# the installed module
def assert_module_installed_ui ( stdout, module_author, module_name, module_version = nil, compare_op = nil )
def assert_module_installed_ui( stdout, module_author, module_name, module_version = nil, compare_op = nil )
valid_compare_ops = {'==' => 'equal to', '>' => 'greater than', '<' => 'less than'}
assert_match(/#{module_author}-#{module_name}/, stdout,
"Notice that module '#{module_author}-#{module_name}' was installed was not displayed")
@@ -171,7 +171,7 @@ def assert_module_installed_ui ( stdout, module_author, module_name, module_vers
# @param module_name [String] the name portion of a module name
# @param optional moduledir [String, Array] the path where the module should be, will
# iterate over components of the modulepath by default.
def assert_module_installed_on_disk (host, module_name, moduledir=nil)
def assert_module_installed_on_disk(host, module_name, moduledir=nil)
moduledir ||= get_modulepaths_for_host(host)
modulepath = moduledir.is_a?(Array) ? moduledir : [moduledir]
moduledir= nil
@@ -249,7 +249,7 @@ def parse_ls(line)
# @param module_name [String] the name portion of a module name
# @param optional moduledir [String, Array] the path where the module should be, will
# iterate over components of the modulepath by default.
def assert_module_not_installed_on_disk (host, module_name, moduledir=nil)
def assert_module_not_installed_on_disk(host, module_name, moduledir=nil)
moduledir ||= get_modulepaths_for_host(host)
modulepath = moduledir.is_a?(Array) ? moduledir : [moduledir]
moduledir= nil
@@ -13,36 +13,57 @@
extend Puppet::Acceptance::TempFileUtils
initialize_temp_dirs

metadata_json_file = <<-FILE
{
"name": "puppetlabs-helloworld",
"version": "0.0.1",
"author": "Puppet Labs",
"summary": "Nginx Module",
"license": "Apache Version 2.0",
"source": "git://github.com/puppetlabs/puppetlabs-nginx.git",
"project_page": "https://github.com/puppetlabs/puppetlabs-nginx",
"issues_url": "https://github.com/puppetlabs/puppetlabs-nginx",
"dependencies": [
{"name":"puppetlabs-stdlub","version_requirement":">= 1.0.0"}
]
}
FILE

agents.each do |agent|

if on(agent, facter("fips_enabled")).stdout =~ /true/
puts "Module build, loading and installing not supported on fips enabled platforms"
next
end

environmentpath = get_test_file_path(agent, 'environments')
dev_modulepath = "#{environmentpath}/dev/modules"
module_base_dir = "#{dev_modulepath}/helloworld"

teardown do
on agent, "rm -rf #{module_base_dir}"
end

# make sure that we use the modulepath from the dev environment
puppetconf = get_test_file_path(agent, 'puppet.conf')
on agent, puppet("config", "set", "environmentpath", environmentpath, "--section", "main", "--config", puppetconf)
on agent, puppet("config", "set", "environment", "dev", "--section", "user", "--config", puppetconf)

on agent, 'rm -rf helloworld'
on agent, puppet("module", "generate", "puppetlabs-helloworld", "--skip-interview")
mkdirs agent, 'helloworld/lib/puppet/application'
mkdirs agent, 'helloworld/lib/puppet/face'
mkdirs agent, module_base_dir
create_remote_file(agent, "#{module_base_dir}/metadata.json", metadata_json_file)
mkdirs agent, "#{module_base_dir}/lib/puppet/application"
mkdirs agent, "#{module_base_dir}/lib/puppet/face"

# copy application, face, and utility module
create_remote_file(agent, "helloworld/lib/puppet/application/helloworld.rb", <<'EOM')
create_remote_file(agent, "#{module_base_dir}/lib/puppet/application/helloworld.rb", <<'EOM')
require 'puppet/face'
require 'puppet/application/face_base'
class Puppet::Application::Helloworld < Puppet::Application::FaceBase
end
EOM

create_remote_file(agent, "helloworld/lib/puppet/face/helloworld.rb", <<'EOM')
create_remote_file(agent, "#{module_base_dir}/lib/puppet/face/helloworld.rb", <<'EOM')
Puppet::Face.define(:helloworld, '0.1.0') do
summary "Hello world face"
description "This is the hello world face"
@@ -64,7 +85,7 @@ class Puppet::Application::Helloworld < Puppet::Application::FaceBase
end
EOM

create_remote_file(agent, "helloworld/lib/puppet/helloworld.rb", <<'EOM')
create_remote_file(agent, "#{module_base_dir}/lib/puppet/helloworld.rb", <<'EOM')
module Puppet::Helloworld
def print
puts "Hello world from a required module"
@@ -73,9 +94,6 @@ def print
end
EOM

on agent, puppet('module', 'build', 'helloworld')
on agent, puppet('module', 'install', '--ignore-dependencies', '--target-dir', dev_modulepath, 'helloworld/pkg/puppetlabs-helloworld-0.1.0.tar.gz')

on(agent, puppet('help', '--config', puppetconf)) do
assert_match(/helloworld\s*Hello world face/, stdout, "Face missing from list of available subcommands")
end

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 4fc6125

Please sign in to comment.
You can’t perform that action at this time.