vagrant-pe_build 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ /doc
data/CHANGELOG CHANGED
@@ -1,6 +1,35 @@
1
1
  vagrant-pe_build
2
2
  ================
3
3
 
4
+ 0.4.0
5
+ -----
6
+
7
+ This is a backwards compatible feature and bugfix release.
8
+
9
+ ### User notes:
10
+
11
+ #### Enhancements
12
+
13
+ * New pe_bootstrap configuration option: `autosign` adds the ability to
14
+ configure the Puppet master autosign.conf
15
+
16
+ #### Bugfixes
17
+
18
+ * The pe_bootstrap provisioner restarts the pe-httpd service if changes were
19
+ made to the master configuration that require a restart.
20
+
21
+ ### Developer notes:
22
+
23
+ * pe_bootstrap post-install configuration has been extracted out of the
24
+ provisioner and into the PostInstall module.
25
+ * post-install configuration is now handled by generating a Puppet manifest
26
+ instead of executing sed and a shell script.
27
+
28
+ ### Thanks
29
+
30
+ Thanks to Tom Linkin for his work on handling post-install configuration with
31
+ Augeas and Puppet.
32
+
4
33
  0.3.0
5
34
  -----
6
35
 
data/Gemfile CHANGED
@@ -1,3 +1,15 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ group :doc do
6
+ gem 'yard', '~> 0.8.7'
7
+ gem 'redcarpet'
8
+ end
9
+
10
+ group :development do
11
+ # We depend on Vagrant for development, but we don't add it as a
12
+ # gem dependency because we expect to be installed within the
13
+ # Vagrant environment itself using `vagrant plugin`.
14
+ gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
15
+ end
data/README.markdown CHANGED
@@ -168,8 +168,7 @@ added with `vagrant pe-build copy`.
168
168
  config.vm.define 'agent1' do |node|
169
169
  node.vm.box = 'centos-6-i386'
170
170
 
171
- node.vm.provision :pe_bootstrap do |provisioner|
172
- provisioner.role = :agent end
171
+ node.vm.provision :pe_bootstrap
173
172
  end
174
173
  end
175
174
 
@@ -5,6 +5,12 @@ class PEBuild::Cap::RunInstall::POSIX
5
5
 
6
6
  def self.run_install(machine, config, archive)
7
7
 
8
+ if machine.communicate.test('test -f /opt/puppet/pe_version')
9
+ machine.ui.warn I18n.t('pebuild.cap.run_install.posix..already_installed'),
10
+ :name => machine.name
11
+ return
12
+ end
13
+
8
14
  root = File.join('/vagrant', PEBuild::WORK_DIR)
9
15
 
10
16
  cmd_path = []
@@ -20,7 +26,10 @@ class PEBuild::Cap::RunInstall::POSIX
20
26
 
21
27
  on_machine(machine, argv)
22
28
 
23
- machine.ui.info I18n.t('pebuild.provisioner.pe_bootstrap.scheduling_run')
24
- machine.communicate.sudo("echo '/opt/puppet/bin/puppet agent -t' | at next minute")
29
+
30
+ if machine.communicate.test('which at')
31
+ machine.ui.info I18n.t('pebuild.provisioner.pe_bootstrap.scheduling_run')
32
+ machine.communicate.sudo("echo '/opt/puppet/bin/puppet agent -t --waitforcert 10' | at next minute")
33
+ end
25
34
  end
26
35
  end
@@ -0,0 +1,8 @@
1
+ require 'pe_build/config_default'
2
+
3
+ module PEBuild
4
+ module Config
5
+ require 'pe_build/config/global'
6
+ require 'pe_build/config/pe_bootstrap'
7
+ end
8
+ end
@@ -1,13 +1,9 @@
1
- require 'uri'
2
- require 'vagrant'
3
-
4
1
  require 'pe_build/config_default'
5
2
  require 'pe_build/transfer'
6
3
 
7
- module PEBuild
8
- module Config
4
+ require 'uri'
9
5
 
10
- class Global < Vagrant.plugin('2', :config)
6
+ class PEBuild::Config::Global < Vagrant.plugin('2', :config)
11
7
 
12
8
  # @todo This value should be discovered based on what versions of the
13
9
  # installer are cached.
@@ -57,32 +53,48 @@ class Global < Vagrant.plugin('2', :config)
57
53
  def validate(machine)
58
54
  errors = []
59
55
 
56
+ validate_version(errors)
57
+ validate_download_root(errors)
58
+
59
+ {"PE build global config" => errors}
60
+ end
61
+
62
+ private
63
+
64
+ def validate_version(version)
65
+
66
+ errmsg = I18n.t(
67
+ 'pebuild.config.global.errors.malformed_version',
68
+ :version => @version,
69
+ :version_class => @version.class
70
+ )
71
+
60
72
  # Allow Global version to be unset, rendering it essentially optional. If it is
61
73
  # discovered to be unset by a configuration on the next level up who cannot provide a
62
74
  # value, it is that configuration's job to take action.
63
- if @version.kind_of? String
64
- unless @version.match /\d+\.\d+(\.\d+)?/
65
- errors << "version must be a valid version string, got #{@version.inspect}"
66
- end
75
+ if @version.kind_of? String and !(@version.match /\d+\.\d+(\.\d+)?/)
76
+ errors << errmsg
67
77
  elsif @version != UNSET_VALUE
68
- errors << "version only accepts a string, got #{@version.class}"
78
+ errors << errmsg
69
79
  end
80
+ end
70
81
 
82
+ def validate_download_root(errors)
71
83
  if @download_root and @download_root != UNSET_VALUE
72
84
  begin
73
85
  uri = URI.parse(@download_root)
74
86
 
75
87
  if PEBuild::Transfer::IMPLEMENTATIONS[uri.scheme].nil?
76
- errors << "No handlers available for URI scheme #{uri.scheme}"
88
+ errors << I18n.t(
89
+ 'pebuild.config.global.errors.unhandled_download_root_scheme',
90
+ :download_root => @download_root,
91
+ :scheme => uri.scheme,
92
+ :supported => PEBuild::Transfer::IMPLEMENTATIONS.keys
93
+ )
77
94
  end
78
95
  rescue URI::InvalidURIError
79
- errors << 'download_root must be a valid URL or nil'
96
+ errors << I18n.t('pebuild.config.global.errors.invalid_download_root_uri')
80
97
  end
81
98
  end
82
-
83
- {"PE Build global config" => errors}
84
99
  end
85
100
  end
86
-
87
- end
88
- end
@@ -1,42 +1,59 @@
1
- require 'vagrant'
2
-
3
1
  require 'pe_build/config/global'
4
- require 'pe_build/config_default'
5
-
6
- module PEBuild
7
- module Config
8
2
 
9
- class PEBootstrap < PEBuild::Config::Global
3
+ class PEBuild::Config::PEBootstrap < PEBuild::Config::Global
10
4
 
11
5
  # @!attribute master
12
- # @return The DNS hostname of the Puppet master for this node.
6
+ # @return [String] The DNS hostname of the Puppet master for this node.
7
+ # @since 0.1.0
13
8
  attr_accessor :master
14
9
 
15
10
  # @!attribute answer_file
16
11
  # @return [String] The path to a user specified answer_file file (Optional)
12
+ # @since 0.1.0
17
13
  attr_accessor :answer_file
18
14
 
19
15
  # @!attribute verbose
20
16
  # @return [TrueClass, FalseClass] if stdout will be displayed when installing
17
+ # @since 0.1.0
21
18
  attr_accessor :verbose
22
19
 
23
20
  # @!attribute role
24
21
  # @return [Symbol] The type of the PE installation role. One of [:master, :agent]
22
+ # @since 0.1.0
25
23
  attr_accessor :role
24
+
25
+ # @api private
26
26
  VALID_ROLES = [:agent, :master]
27
27
 
28
28
  # @!attribute step
29
29
  # @return [Hash<Symbol, String>] a hash whose keys are step levels, and whose
30
30
  # keys are directories to optional steps.
31
+ # @deprecated This duplicates the behavior of the shell provider and will
32
+ # be removed in a future release.
33
+ # @since 0.1.0
31
34
  attr_accessor :step
32
35
 
33
- attr_accessor :relocate_manifests
34
36
  # @!attribute relocate_manifests
35
37
  # @return [TrueClass, FalseClass] if the puppet master should use manifests
36
38
  # out of the vagrant directory.
39
+ # @since 0.1.0
40
+ attr_accessor :relocate_manifests
37
41
 
38
- # @todo config option for autosigning.
39
- #attr_accessor :autosign
42
+ # @!attribute [rw] autosign
43
+ # Configure the certificates that will be autosigned by the puppet master.
44
+ #
45
+ # @return [TrueClass] All CSRs will be signed
46
+ # @return [FalseClass] The autosign config file will be unmanaged
47
+ # @return [Array<String>] CSRs with the given addresses
48
+ #
49
+ # @see http://docs.puppetlabs.com/guides/configuring.html#autosignconf
50
+ #
51
+ # @since 0.4.0
52
+ #
53
+ attr_accessor :autosign
54
+
55
+ # @api private
56
+ VALID_AUTOSIGN_VALUES = [TrueClass, FalseClass, Array]
40
57
 
41
58
  def initialize
42
59
  super
@@ -47,7 +64,7 @@ class PEBootstrap < PEBuild::Config::Global
47
64
 
48
65
  @relocate_manifests = UNSET_VALUE
49
66
 
50
- #@autosign = UNSET_VALUE
67
+ @autosign = UNSET_VALUE
51
68
 
52
69
  @step = {}
53
70
  end
@@ -64,53 +81,101 @@ class PEBootstrap < PEBuild::Config::Global
64
81
  set_default :@verbose, true
65
82
  set_default :@master, 'master'
66
83
  set_default :@answer_file, nil
84
+ set_default :@autosign, (@role == :master)
67
85
 
68
86
  set_default :@relocate_manifests, false
69
87
  end
70
88
 
89
+ # @deprecated This duplicates the behavior of the shell provider and will
90
+ # be removed in a future release.
71
91
  def add_step(name, script_path)
72
92
  name = (name.is_a?(Symbol)) ? name : name.intern
73
93
  step[name] = script_path
74
94
  end
75
95
 
76
- # @todo Convert error strings to I18n
96
+ # @param machine [Vagrant::Machine]
77
97
  def validate(machine)
78
98
  h = super
79
99
 
80
100
  unless @step.empty?
81
- machine.ui.warn "pe_bootstrap: explicit steps are deprecated and will be removed soon."
101
+ machine.ui.warn I18n.t('pebuild.config.pe_bootstrap.steps_deprecated')
82
102
  end
83
103
 
84
104
  errors = []
105
+
106
+ validate_version(errors)
107
+ validate_role(errors)
108
+ validate_verbose(errors)
109
+ validate_master(errors)
110
+ validate_answer_file(errors)
111
+ validate_relocate_manifests(errors)
112
+ validate_autosign(errors)
113
+
114
+ errors |= h.values.flatten
115
+ {"PE Bootstrap" => errors}
116
+ end
117
+
118
+ private
119
+
120
+ def validate_version(errors)
85
121
  if @version == UNSET_VALUE and global_config_from(machine).pe_build.version == UNSET_VALUE
86
- errors << "Version must be set on provisioner when unset globally"
122
+ errors << I18n.t('pebuild.config.pe_bootstrap.errors.unset_version')
87
123
  end
124
+ end
88
125
 
126
+ def validate_role(errors)
89
127
  unless VALID_ROLES.any? {|sym| @role == sym}
90
- errors << "Role must be one of #{VALID_ROLES.inspect}, was #{@role.inspect}"
128
+ errors << I18n.t(
129
+ 'pebuild.config.pe_bootstrap.errors.unhandled_role',
130
+ :role => @role.inspect,
131
+ :known_roles => VALID_ROLES,
132
+ )
91
133
  end
134
+ end
92
135
 
136
+ def validate_verbose(errors)
93
137
  unless @verbose == !!@verbose
94
- errors << "'verbose' must be a boolean, got #{@verbose.class}"
138
+ errors << I18n.t(
139
+ 'pebuild.config.pe_bootstrap.errors.malformed_verbose',
140
+ :verbose => @verbose.inspect,
141
+ )
95
142
  end
143
+ end
96
144
 
145
+ def validate_master(errors)
97
146
  unless @master.is_a? String
98
147
  errors << "'master' must be a string containing the address of the master, got a #{@master.class}"
99
148
  end
149
+ end
100
150
 
151
+ def validate_answer_file(errors)
101
152
  if @answer_file and !File.readable? @answer_file
102
153
  errors << "'answers_file' must be a readable file"
103
154
  end
155
+ end
104
156
 
157
+ def validate_relocate_manifests(errors)
105
158
  if @relocate_manifests and not @role == :master
106
159
  errors << "'relocate_manifests' can only be applied to a master"
107
160
  end
108
-
109
- errors |= h.values.flatten
110
- {"PE Bootstrap" => errors}
111
161
  end
112
162
 
113
- private
163
+ def validate_autosign(errors)
164
+ if (@autosign and @role != :master)
165
+ errors << I18n.t(
166
+ 'pebuild.config.pe_bootstrap.errors.invalid_autosign_role',
167
+ :role => @role
168
+ )
169
+ end
170
+
171
+ unless VALID_AUTOSIGN_VALUES.include?(@autosign.class)
172
+ errors << I18n.t(
173
+ 'pebuild.config.pe_bootstrap.errors.invalid_autosign_class',
174
+ :autosign_class => @autosign.class,
175
+ :autosign_classes => VALID_AUTOSIGN_VALUES,
176
+ )
177
+ end
178
+ end
114
179
 
115
180
  # Safely access the global config
116
181
  #
@@ -121,5 +186,3 @@ class PEBootstrap < PEBuild::Config::Global
121
186
  env = machine.env.config_global
122
187
  end
123
188
  end
124
- end
125
- end
@@ -0,0 +1,6 @@
1
+ module PEBuild
2
+ module ConfigBuilder
3
+ require 'pe_build/config_builder/global'
4
+ require 'pe_build/config_builder/pe_bootstrap'
5
+ end
6
+ end
@@ -0,0 +1,37 @@
1
+ require 'config_builder/model'
2
+
3
+ class PEBuild::ConfigBuilder::Global < ::ConfigBuilder::Model::Base
4
+
5
+ # @!attribute [rw] download_root
6
+ def_model_attribute :download_root
7
+
8
+ # @!attribute [rw] version
9
+ def_model_attribute :version
10
+
11
+ # @!attribute [rw] suffix
12
+ def_model_attribute :suffix
13
+
14
+ # @!attribute [rw] filename
15
+ def_model_attribute :filename
16
+
17
+ def to_proc
18
+ Proc.new do |global_config|
19
+ global_config.pe_build.download_root = attr(:download_root) if attr(:download_root)
20
+ global_config.pe_build.version = attr(:version) if attr(:version)
21
+ global_config.pe_build.suffix = attr(:suffix) if attr(:suffix)
22
+ global_config.pe_build.filename = attr(:filename) if attr(:filename)
23
+ end
24
+ end
25
+ end
26
+
27
+ class ConfigBuilder::Model::Root
28
+ def_model_delegator :pe_build
29
+
30
+ def eval_pe_build(root_config)
31
+ if attr(:pe_build)
32
+ p = PEBuild::ConfigBuilder::Global.new_from_hash(attr(:pe_build))
33
+ p.call(root_config)
34
+ end
35
+ end
36
+ private :eval_pe_build
37
+ end
@@ -0,0 +1,29 @@
1
+ require 'config_builder/model'
2
+
3
+ class PEBuild::ConfigBuilder::PEBootstrap < ::PEBuild::ConfigBuilder::Global
4
+
5
+ def_model_attribute :master
6
+ def_model_attribute :answer_file
7
+
8
+ def_model_attribute :verbose
9
+
10
+ def_model_attribute :role
11
+ #def_model_attribute :step
12
+ def_model_attribute :relocate_manifests
13
+
14
+ def to_proc
15
+ Proc.new do |vm_config|
16
+ vm_config.provision :pe_bootstrap do |pe|
17
+ pe.download_root = attr(:download_root) if attr(:download_root)
18
+ pe.version = attr(:version) if attr(:version)
19
+ pe.suffix = attr(:suffix) if attr(:suffix)
20
+ pe.filename = attr(:filename) if attr(:filename)
21
+
22
+ pe.role = attr(:role) if attr(:role)
23
+ pe.relocate_manifests = attr(:relocate_manifests) if attr(:relocate_manifests)
24
+ end
25
+ end
26
+ end
27
+
28
+ ::ConfigBuilder::Model::Provisioner.register('pe_bootstrap', self)
29
+ end
@@ -18,12 +18,12 @@ module PEBuild
18
18
  # User facing plugin configuration
19
19
 
20
20
  config(:pe_bootstrap, :provisioner) do
21
- require_relative 'config/pe_bootstrap'
21
+ require_relative 'config'
22
22
  PEBuild::Config::PEBootstrap
23
23
  end
24
24
 
25
25
  config(:pe_build) do
26
- require_relative 'config/global'
26
+ require_relative 'config'
27
27
  PEBuild::Config::Global
28
28
  end
29
29
 
@@ -70,5 +70,9 @@ module PEBuild
70
70
  require 'pe_build/action'
71
71
  hook.prepend PEBuild::Action::PEBuildDir
72
72
  end
73
+
74
+ def self.config_builder_hook
75
+ require_relative 'config_builder'
76
+ end
73
77
  end
74
78
  end
@@ -11,6 +11,7 @@ module PEBuild
11
11
  class PEBootstrap < Vagrant.plugin('2', :provisioner)
12
12
 
13
13
  require 'pe_build/provisioner/pe_bootstrap/answers_file'
14
+ require 'pe_build/provisioner/pe_bootstrap/post_install'
14
15
 
15
16
  # @!attribute [r] work_dir
16
17
  # @return [String] The path to the machine pe_build working directory
@@ -53,8 +54,9 @@ module PEBuild
53
54
 
54
55
  [:base, @config.role].each { |rolename| process_step rolename, :pre }
55
56
 
56
- perform_installation
57
- relocate_installation if @config.relocate_manifests
57
+ @machine.guest.capability('run_install', @config, @archive)
58
+
59
+ run_postinstall_tasks
58
60
 
59
61
  [:base, @config.role].each { |rolename| process_step rolename, :post }
60
62
  end
@@ -100,6 +102,9 @@ module PEBuild
100
102
  @archive.unpack_to(@work_dir)
101
103
  end
102
104
 
105
+ require 'pe_build/on_machine'
106
+ include PEBuild::OnMachine
107
+
103
108
  def process_step(role, stepname)
104
109
 
105
110
  if role != :base && config.step[stepname]
@@ -125,44 +130,13 @@ module PEBuild
125
130
  template = File.read(template_path)
126
131
  contents = ERB.new(template).result(binding)
127
132
 
128
- on_remote contents
133
+ on_machine(@machine, contents)
129
134
  end
130
135
  end
131
136
 
132
- def perform_installation
133
- if @machine.communicate.test('test -f /opt/puppet/pe_version')
134
- @machine.ui.warn I18n.t('pebuild.provisioner.pe_bootstrap.already_installed'),
135
- :name => @machine.name
136
- else
137
- @machine.guest.capability('run_install', @config, @archive)
138
- end
139
- end
140
-
141
- # Modify the PE puppet master config to use alternate /manifests and /modules
142
- #
143
- # Manifests and modules need to be mounted on the master via shared folders,
144
- # but the default /vagrant mount has permissions and ownership that conflicts
145
- # with the puppet master process and the pe-puppet user. Those directories
146
- # need to be mounted with permissions like 'fmode=644,dmode=755,fmask=022,dmask=022'
147
- #
148
- def relocate_installation
149
- script_path = File.join(PEBuild.template_dir, 'scripts', 'relocate_installation.sh')
150
- script = File.read script_path
151
- on_remote script
152
- end
153
-
154
- def on_remote(cmd)
155
- @machine.communicate.sudo(cmd) do |type, data|
156
- if type == :stdout
157
- if @config.verbose
158
- @machine.ui.info(data.chomp, :color => :green, :prefix => true)
159
- else
160
- @machine.ui.info('.', :color => :green)
161
- end
162
- else
163
- @machine.ui.info(data.chomp, :color => :red, :prefix => true)
164
- end
165
- end
137
+ def run_postinstall_tasks
138
+ postinstall = PostInstall.new(@machine, @config, @work_dir)
139
+ postinstall.run
166
140
  end
167
141
  end
168
142
  end
@@ -0,0 +1,108 @@
1
+ require 'pe_build/on_machine'
2
+
3
+ class PEBuild::Provisioner::PEBootstrap::PostInstall
4
+
5
+ def initialize(machine, config, work_dir)
6
+ @machine, @config = machine, config
7
+
8
+ @post_install_dir = Pathname.new(File.join(work_dir, 'post-install'))
9
+ @post_install_manifest = @post_install_dir.join("#{@machine.name}.pp")
10
+ end
11
+
12
+ include PEBuild::OnMachine
13
+
14
+ def run
15
+ if needs_post_install?
16
+ @machine.ui.info I18n.t('pebuild.provisioner.pe_bootstrap.post_install')
17
+
18
+ resources = []
19
+
20
+ resources << gen_relocate if @config.relocate_manifests
21
+ resources << gen_autosign if @config.autosign
22
+ resources << gen_service
23
+
24
+ manifest = resources.join("\n\n")
25
+ write_manifest(manifest)
26
+
27
+ puppet_apply = "/opt/puppet/bin/puppet apply"
28
+ manifest_path = "/vagrant/.pe_build/post-install/#{@machine.name}.pp"
29
+
30
+ on_machine(@machine, "#{puppet_apply} #{manifest_path}")
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ def write_manifest(manifest)
37
+ @post_install_dir.mkpath unless @post_install_dir.exist?
38
+ @post_install_manifest.open('w') { |fh| fh.write(manifest) }
39
+ end
40
+
41
+ def needs_post_install?
42
+ !!(@config.relocate_manifests or @config.autosign)
43
+ end
44
+
45
+ def gen_relocate
46
+ manifest = <<-MANIFEST.gsub(/^\s{6}/, '')
47
+ augeas { 'move_manifestdir':
48
+ changes => 'set etc/puppetlabs/puppet/puppet.conf/main/manifestdir /manifests',
49
+ notify => Service['pe-httpd'],
50
+ }
51
+
52
+ # Update puppet.conf to add the modulepath directive to point to the
53
+ # /module mount, if it hasn't already been set.
54
+ augeas { 'move_modulepath':
55
+ changes => 'set etc/puppetlabs/puppet/puppet.conf/main/modulepath /modules',
56
+ notify => Service['pe-httpd'],
57
+ }
58
+
59
+ # Rewrite the olde site.pp config since it's not used, and warn people
60
+ # about this.
61
+ file { 'old_site.pp':
62
+ ensure => file,
63
+ path => '/etc/puppetlabs/puppet/manifests/site.pp',
64
+ content => '# /etc/puppetlabs/puppet/manifests is not used; see /manifests.',
65
+ notify => Service['pe-httpd'],
66
+ }
67
+ MANIFEST
68
+
69
+ manifest
70
+ end
71
+
72
+ def gen_autosign
73
+
74
+ autosign_entries = ['pe-internal-dashboard', @machine.name ]
75
+
76
+ case @config.autosign
77
+ when TrueClass
78
+ autosign_entries << '*'
79
+ when Array
80
+ autosign_entries += @config.autosign
81
+ end
82
+
83
+ autosign_content = autosign_entries.map { |line| "#{line}\n" }.join
84
+
85
+ manifest = <<-MANIFEST.gsub(/^\s{6}/, '')
86
+ file { '/etc/puppetlabs/puppet/autosign.conf':
87
+ ensure => file,
88
+ content => "#{autosign_content}",
89
+ owner => 'root',
90
+ group => 'pe-puppet',
91
+ mode => '0644',
92
+ notify => Service['pe-httpd'],
93
+ }
94
+ MANIFEST
95
+
96
+ manifest
97
+ end
98
+
99
+ def gen_service
100
+ manifest = <<-MANIFEST.gsub(/^\s{6}/, '')
101
+ service { 'pe-httpd':
102
+ ensure => running,
103
+ }
104
+ MANIFEST
105
+
106
+ manifest
107
+ end
108
+ end
@@ -1,5 +1,10 @@
1
1
  module PEBuild
2
2
  module Transfer
3
+
4
+ class UnhandledURIScheme < Vagrant::Errors::VagrantError
5
+ error_key('unhandled_uri_scheme', 'pebuild.transfer')
6
+ end
7
+
3
8
  require 'pe_build/transfer/open_uri'
4
9
  require 'pe_build/transfer/file'
5
10
 
@@ -17,7 +22,8 @@ module PEBuild
17
22
  if (klass = IMPLEMENTATIONS[scheme])
18
23
  klass.new(src, dst)
19
24
  else
20
- raise "URI scheme #{scheme.inspect} cannot be handled by any file transferrers"
25
+ raise UnhandledURIScheme, :scheme => scheme,
26
+ :supported => IMPLEMENTATIONS.keys
21
27
  end
22
28
  end
23
29
  end
@@ -1,3 +1,3 @@
1
1
  module PEBuild
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -13,8 +13,41 @@ en:
13
13
  Puppet Enterprise is already installed, skipping installation.
14
14
  scheduling_run: |-
15
15
  Scheduling Puppet run to kickstart node classification.
16
+ post_install: |-
17
+ Applying post-install configuration to Puppet Enterprise.
16
18
  transfer:
17
19
  open_uri:
18
20
  download_failed: |-
19
21
  An error occurred while trying to download the given resource (%{uri}),
20
22
  and the transfer could not complete. The error message generated was "%{msg}".
23
+ unhandled_uri_scheme: |-
24
+ The URI scheme "%{scheme}" cannot be handled by any file transferrers.
25
+ Supported URI schemes: %{supported}
26
+ config:
27
+ global:
28
+ errors:
29
+ malformed_version: |-
30
+ The Puppet Enterprise version "%{version}":%{version_class} is malformed; it must be a String of
31
+ the format "x.y.z"
32
+ unhandled_download_root_scheme: |-
33
+ The URI scheme "%{scheme}" for the download_root "%{download_root}"
34
+ cannot be handled by any file transferrers.
35
+ Supported URI schemes: %{supported}
36
+ invalid_download_root_uri: |-
37
+ The download_root config option must be either unset or a valid URI.
38
+ pe_bootstrap:
39
+ steps_deprecated: |-
40
+ Explicit :pre, :provision, and :post steps are deprecated and will be removed soon.
41
+ This functionality can be replaced by directly invoking the `shell` provisioner. More
42
+ information on the shell provisioner can be found on the Vagrant website at
43
+ http://docs.vagrantup.com/v2/provisioning/shell.html
44
+ errors:
45
+ unset_version: |-
46
+ The Puppet Enterprise version must be set either on the global pe_build config
47
+ object or specified on a per-provisioner basis, but both were unset.
48
+ unknown_role: |-
49
+ The specified role %{role} is unhandled, must be one of %{known_roles}.
50
+ invalid_autosign_role: |-
51
+ Autosign can only be specified if the pe_bootstrap role is 'master', not %{role}.
52
+ invalid_autosign_class: |-
53
+ Autosign must be one of %{autosign_classes}, but was of type %{autosign}.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-pe_build
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-14 00:00:00.000000000 Z
12
+ date: 2013-08-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: progressbar
@@ -49,6 +49,7 @@ executables: []
49
49
  extensions: []
50
50
  extra_rdoc_files: []
51
51
  files:
52
+ - .gitignore
52
53
  - CHANGELOG
53
54
  - Gemfile
54
55
  - LICENSE
@@ -76,14 +77,19 @@ files:
76
77
  - lib/pe_build/command/copy.rb
77
78
  - lib/pe_build/command/download.rb
78
79
  - lib/pe_build/command/list.rb
80
+ - lib/pe_build/config.rb
79
81
  - lib/pe_build/config/global.rb
80
82
  - lib/pe_build/config/pe_bootstrap.rb
83
+ - lib/pe_build/config_builder.rb
84
+ - lib/pe_build/config_builder/global.rb
85
+ - lib/pe_build/config_builder/pe_bootstrap.rb
81
86
  - lib/pe_build/config_default.rb
82
87
  - lib/pe_build/idempotent.rb
83
88
  - lib/pe_build/on_machine.rb
84
89
  - lib/pe_build/plugin.rb
85
90
  - lib/pe_build/provisioner/pe_bootstrap.rb
86
91
  - lib/pe_build/provisioner/pe_bootstrap/answers_file.rb
92
+ - lib/pe_build/provisioner/pe_bootstrap/post_install.rb
87
93
  - lib/pe_build/release.rb
88
94
  - lib/pe_build/release/2_0.rb
89
95
  - lib/pe_build/release/2_5.rb
@@ -104,7 +110,6 @@ files:
104
110
  - templates/answers/master-2.x.txt.erb
105
111
  - templates/answers/master-3.x.txt.erb
106
112
  - templates/locales/en.yml
107
- - templates/scripts/relocate_installation.sh
108
113
  - vagrant-pe_build.gemspec
109
114
  homepage: https://github.com/adrienthebo/vagrant-pe_build
110
115
  licenses:
@@ -1,23 +0,0 @@
1
- # Update puppet.conf to add the manifestdir directive to point to the
2
- # /manifests mount, if the directive isn't already present.
3
- sed -i '
4
- 2 {
5
- /manifest/ !i\
6
- manifestdir = /manifests
7
- }
8
- ' /etc/puppetlabs/puppet/puppet.conf
9
-
10
- # Update puppet.conf to add the modulepath directive to point to the
11
- # /module mount, if it hasn't already been set.
12
- sed -i '
13
- /modulepath/ {
14
- /vagrant/ !s,$,:/modules,
15
- }
16
- ' /etc/puppetlabs/puppet/puppet.conf
17
-
18
- # Rewrite the olde site.pp config since it's not used, and warn people
19
- # about this.
20
- echo '# /etc/puppetlabs/puppet/manifests is not used; see /manifests.' > /etc/puppetlabs/puppet/manifests/site.pp
21
-
22
- # Enable autosigning on the master
23
- echo '*' > /etc/puppetlabs/puppet/autosign.conf