oscar 0.2.0alpha2 → 0.2.0alpha3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/oscar/config.rb CHANGED
@@ -18,6 +18,8 @@ class Oscar::Config
18
18
  def load!(searchpath)
19
19
  files = ['config.yaml', 'config'].map { |m| "#{searchpath}/#{m}" }
20
20
  load_all files
21
+
22
+ raise "No configuration loaded" if @data.nil? or @data.empty?
21
23
  end
22
24
 
23
25
  # Recursively load any YAML files contained in the given paths.
@@ -30,18 +30,10 @@ class Oscar::Networking
30
30
  arr = []
31
31
 
32
32
  arr << ['127.0.0.1', ['localhost']]
33
- arr << ['127.0.1.1', [node.name, "#{node.name}.#{@domainname}"]]
34
-
35
- arr << ['::1', %w{ip6-localhost ip6-loopback}]
36
-
37
- arr << ['fe00::0', ['ip6-localnet']]
38
- arr << ['ff00::0', ['ip6-mcastprefix']]
39
- arr << ['ff02::1', ['ip6-allnodes']]
40
- arr << ['ff02::2', ['ip6-allrouters']]
33
+ arr << ['127.0.1.1', ["#{node.name}.#{@domainname}", node.name]]
41
34
 
42
35
  @nodes.each_pair { |address, n| arr << [address, [n.name, "#{n.name}.#{@domainname}"]] }
43
36
 
44
-
45
37
  arr
46
38
  end
47
39
  end
data/lib/oscar/node.rb CHANGED
@@ -29,12 +29,10 @@ class Oscar::Node
29
29
  node.vm.boot_mode = @gui if @gui
30
30
 
31
31
  host_entries = @networking.hosts_for(self)
32
- #node.vm.provision :shell do |shell|
33
- # shell.inline = %{grep "#{entry}" /etc/hosts || echo "#{entry}" >> /etc/hosts}
34
- #end
35
32
 
36
- node.vm.provision :hosts do |h|
37
- host_entries.each { |(address, aliases)| h.add_host address, aliases }
33
+ node.vm.provision :hosts do |provisioner|
34
+ host_entries.each { |(address, aliases)| provisioner.add_host address, aliases }
35
+ provisioner.add_ipv6_multicast
38
36
  end
39
37
 
40
38
  node.vm.provision :puppet_enterprise_bootstrap do |pe|
data/lib/oscar/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Oscar
2
- VERSION = '0.2.0alpha2'
2
+ VERSION = '0.2.0alpha3'
3
3
  end
data/oscar.gemspec CHANGED
@@ -17,10 +17,11 @@ Gem::Specification.new do |gem|
17
17
  gem.email = 'adrien@somethingsinistral.net'
18
18
  gem.homepage = 'https://github.com/adrienthebo/oscar'
19
19
 
20
- gem.add_dependency 'vagrant', '~> 1.0.0'
21
- gem.add_dependency 'vagrant-hosts', '0.0.1rc1'
22
- gem.add_dependency 'kwalify', '~> 0.7.0'
23
- gem.add_dependency 'ipaddress', '~> 0.8.0'
20
+ gem.add_dependency 'vagrant', '~> 1.0.0'
21
+ gem.add_dependency 'vagrant-hosts', '>= 0.0.1'
22
+ gem.add_dependency 'vagrant-pe_build', '>= 0.0.1'
23
+ gem.add_dependency 'kwalify', '~> 0.7.0'
24
+ gem.add_dependency 'ipaddress', '~> 0.8.0'
24
25
 
25
26
  gem.files = %x{git ls-files -z}.split("\0")
26
27
  gem.require_path = 'lib'
metadata CHANGED
@@ -1,108 +1,110 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: oscar
3
- version: !ruby/object:Gem::Version
4
- hash: 2754431913
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0alpha3
5
5
  prerelease: 5
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- - alpha
11
- - 2
12
- version: 0.2.0alpha2
13
6
  platform: ruby
14
- authors:
7
+ authors:
15
8
  - Adrien Thebo
16
9
  autorequire:
17
10
  bindir: bin
18
11
  cert_chain: []
19
-
20
- date: 2012-11-05 00:00:00 Z
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
12
+ date: 2013-01-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
23
15
  name: vagrant
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
26
17
  none: false
27
- requirements:
18
+ requirements:
28
19
  - - ~>
29
- - !ruby/object:Gem::Version
30
- hash: 23
31
- segments:
32
- - 1
33
- - 0
34
- - 0
20
+ - !ruby/object:Gem::Version
35
21
  version: 1.0.0
36
22
  type: :runtime
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.0
30
+ - !ruby/object:Gem::Dependency
39
31
  name: vagrant-hosts
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 0.0.1
38
+ type: :runtime
40
39
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.0.1
46
+ - !ruby/object:Gem::Dependency
47
+ name: vagrant-pe_build
48
+ requirement: !ruby/object:Gem::Requirement
42
49
  none: false
43
- requirements:
44
- - - "="
45
- - !ruby/object:Gem::Version
46
- hash: -459699854
47
- segments:
48
- - 0
49
- - 0
50
- - 1
51
- - rc
52
- - 1
53
- version: 0.0.1rc1
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 0.0.1
54
54
  type: :runtime
55
- version_requirements: *id002
56
- - !ruby/object:Gem::Dependency
57
- name: kwalify
58
55
  prerelease: false
59
- requirement: &id003 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.0.1
62
+ - !ruby/object:Gem::Dependency
63
+ name: kwalify
64
+ requirement: !ruby/object:Gem::Requirement
60
65
  none: false
61
- requirements:
66
+ requirements:
62
67
  - - ~>
63
- - !ruby/object:Gem::Version
64
- hash: 3
65
- segments:
66
- - 0
67
- - 7
68
- - 0
68
+ - !ruby/object:Gem::Version
69
69
  version: 0.7.0
70
70
  type: :runtime
71
- version_requirements: *id003
72
- - !ruby/object:Gem::Dependency
73
- name: ipaddress
74
71
  prerelease: false
75
- requirement: &id004 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.7.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: ipaddress
80
+ requirement: !ruby/object:Gem::Requirement
76
81
  none: false
77
- requirements:
82
+ requirements:
78
83
  - - ~>
79
- - !ruby/object:Gem::Version
80
- hash: 63
81
- segments:
82
- - 0
83
- - 8
84
- - 0
84
+ - !ruby/object:Gem::Version
85
85
  version: 0.8.0
86
86
  type: :runtime
87
- version_requirements: *id004
88
- description: " Oscar is a series of extensions to simplify building out a Puppet Enterprise\n environment. It handles networking configuration and fetching/installing\n Puppet Enterprise.\n"
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.8.0
94
+ description: ! " Oscar is a series of extensions to simplify building out a Puppet
95
+ Enterprise\n environment. It handles networking configuration and fetching/installing\n
96
+ \ Puppet Enterprise.\n"
89
97
  email: adrien@somethingsinistral.net
90
98
  executables: []
91
-
92
99
  extensions: []
93
-
94
100
  extra_rdoc_files: []
95
-
96
- files:
101
+ files:
97
102
  - .gitignore
98
103
  - CHANGELOG
99
104
  - Gemfile
100
105
  - LICENSE
101
106
  - README.markdown
102
107
  - Vagrantfile
103
- - bootstrap/base/pre/set_hostname.sh
104
- - bootstrap/base/provision/install_puppet_enterprise.sh
105
- - bootstrap/master/post/relocate_puppet.sh
106
108
  - config/.gitignore
107
109
  - config/roles.yaml.dist
108
110
  - doc/answers/README.markdown
@@ -118,59 +120,32 @@ files:
118
120
  - lib/oscar/node.rb
119
121
  - lib/oscar/schema.yaml
120
122
  - lib/oscar/version.rb
121
- - lib/pe_build.rb
122
- - lib/pe_build/action.rb
123
- - lib/pe_build/action/download.rb
124
- - lib/pe_build/action/unpackage.rb
125
- - lib/pe_build/command.rb
126
- - lib/pe_build/command/download.rb
127
- - lib/pe_build/command/list.rb
128
- - lib/pe_build/config.rb
129
- - lib/pe_build/provisioners.rb
130
- - lib/pe_build/provisioners/puppet_enterprise.rb
131
- - lib/pe_build/provisioners/puppet_enterprise_bootstrap.rb
132
- - lib/pe_build/version.rb
133
123
  - lib/vagrant_init.rb
134
- - manifests/.gitignore
135
- - modules/.gitignore
136
124
  - oscar.gemspec
137
125
  - templates/answers/agent.txt.erb
138
126
  - templates/answers/master.txt.erb
139
127
  homepage: https://github.com/adrienthebo/oscar
140
128
  licenses: []
141
-
142
129
  post_install_message:
143
130
  rdoc_options: []
144
-
145
- require_paths:
131
+ require_paths:
146
132
  - lib
147
- required_ruby_version: !ruby/object:Gem::Requirement
133
+ required_ruby_version: !ruby/object:Gem::Requirement
148
134
  none: false
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- hash: 3
153
- segments:
154
- - 0
155
- version: "0"
156
- required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ required_rubygems_version: !ruby/object:Gem::Requirement
157
140
  none: false
158
- requirements:
159
- - - ">"
160
- - !ruby/object:Gem::Version
161
- hash: 25
162
- segments:
163
- - 1
164
- - 3
165
- - 1
141
+ requirements:
142
+ - - ! '>'
143
+ - !ruby/object:Gem::Version
166
144
  version: 1.3.1
167
145
  requirements: []
168
-
169
146
  rubyforge_project:
170
- rubygems_version: 1.8.24
147
+ rubygems_version: 1.8.23
171
148
  signing_key:
172
149
  specification_version: 3
173
150
  summary: Easy mode Puppet Enterprise provisioning
174
151
  test_files: []
175
-
176
- has_rdoc:
@@ -1,3 +0,0 @@
1
- hostname <%= @env[:vm].name %>
2
- domainname soupkitchen.internal
3
- echo <%= @env[:vm].name %> > /etc/hostname
@@ -1,6 +0,0 @@
1
- if [ -f /opt/puppet/bin/puppet ]; then
2
- echo "Puppet Enterprise already present, version $(/opt/puppet/bin/puppet --version)"
3
- echo "Skipping installation."
4
- else
5
- <%= @installer_cmd %>
6
- fi
@@ -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
data/lib/pe_build.rb DELETED
@@ -1,17 +0,0 @@
1
- require 'vagrant'
2
-
3
- module PEBuild
4
- def self.archive_directory
5
- File.expand_path(File.join(ENV['HOME'], '.vagrant.d', 'pe_builds'))
6
- end
7
-
8
- def self.source_root
9
- @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), '..'))
10
- end
11
- end
12
-
13
- require 'pe_build/version'
14
- require 'pe_build/action'
15
- require 'pe_build/config'
16
- require 'pe_build/command'
17
- require 'pe_build/provisioners'
@@ -1,20 +0,0 @@
1
- require 'vagrant'
2
- require 'vagrant/action/builder'
3
- require 'pe_build'
4
-
5
- module PEBuild::Action
6
- end
7
-
8
- require 'pe_build/action/download'
9
- require 'pe_build/action/unpackage'
10
-
11
- builder = Vagrant::Action::Builder.new do
12
- use PEBuild::Action::Download
13
- end
14
-
15
- Vagrant.actions.register :download_pe_build, builder
16
-
17
- Vagrant.actions.register(:prep_build, Vagrant::Action::Builder.new do
18
- use PEBuild::Action::Download
19
- use PEBuild::Action::Unpackage
20
- end)
@@ -1,56 +0,0 @@
1
- require 'pe_build'
2
- require 'pe_build/action'
3
- require 'vagrant'
4
- require 'fileutils'
5
-
6
- class PEBuild::Action::Download
7
- # Downloads a PE build to a temp directory
8
-
9
- def initialize(app, env)
10
- @app, @env = app, env
11
- load_variables
12
- end
13
-
14
- def call(env)
15
- @env = env
16
- perform_download
17
- @app.call(@env)
18
- end
19
-
20
- private
21
-
22
- # Determine system state and download a PE build accordingly.
23
- #
24
- # If we are applying actions within the context of a single box, then we
25
- # should try to prefer and box level configuration options first. If
26
- # anything is unset then we should fall back to the global settings.
27
- def load_variables
28
- if @env[:box_name]
29
- @root = @env[:vm].pe_build.download_root
30
- @version = @env[:vm].pe_build.version
31
- @filename = @env[:vm].pe_build.version
32
- end
33
-
34
- @root ||= @env[:global_config].pe_build.download_root
35
- @version ||= @env[:global_config].pe_build.version
36
- @filename ||= @env[:global_config].pe_build.filename
37
-
38
- @archive_path = File.join(PEBuild.archive_directory, @filename)
39
- end
40
-
41
- # @return [String] The full URL to download, based on the config
42
- def url
43
- [@root, @version, @filename].join('/')
44
- end
45
-
46
- def perform_download
47
- if File.exist? @archive_path
48
- @env[:ui].info "#{@filename} cached, skipping download."
49
- else
50
- FileUtils.mkdir_p PEBuild.archive_directory unless File.directory? PEBuild.archive_directory
51
- cmd = %{curl -L -A "Vagrant/PEBuild (v#{PEBuild::VERSION})" -O #{url}}
52
- @env[:ui].info "Executing '#{cmd}'"
53
- Dir.chdir(PEBuild.archive_directory) { %x{#{cmd}} }
54
- end
55
- end
56
- end
@@ -1,70 +0,0 @@
1
- require 'vagrant'
2
- require 'pe_build/action'
3
- require 'fileutils'
4
-
5
- class PEBuild::Action::Unpackage
6
- def initialize(app, env)
7
- @app, @env = app, env
8
- load_variables
9
- end
10
-
11
- def call(env)
12
- @env = env
13
- @extracted_dir = File.join(@env[:unpack_directory], destination_directory)
14
- extract_build
15
- @app.call(@env)
16
- end
17
-
18
- private
19
-
20
- def load_variables
21
- if @env[:box_name]
22
- @root = @env[:vm].pe_build.download_root
23
- @version = @env[:vm].pe_build.version
24
- @filename = @env[:vm].pe_build.version
25
- end
26
-
27
- @root ||= @env[:global_config].pe_build.download_root
28
- @version ||= @env[:global_config].pe_build.version
29
- @filename ||= @env[:global_config].pe_build.filename
30
-
31
- @archive_path = File.join(PEBuild.archive_directory, @filename)
32
- end
33
-
34
- # Sadly, shelling out is more sane than trying to use the facilities
35
- # provided.
36
- def extract_build
37
- if File.directory? @extracted_dir
38
- @env[:ui].info "#{destination_directory} already present, skipping extraction."
39
- else
40
- cmd = %{tar xf #{@archive_path} -C #{@env[:unpack_directory]}}
41
- @env[:ui].info "Extracting #{@archive_path} to #{@env[:unpack_directory]}"
42
- %x{#{cmd}}
43
- end
44
- rescue => e
45
- # If anything goes wrong while extracting, nuke the extracted directory
46
- # as it could be incomplete. If we do this, then we can ensure that if
47
- # the extracted directory already exists then it will be in a good state.
48
- @env[:ui].info "Removing possibly damaged installer directory '#{@extracted_dir}'"
49
- FileUtils.rm_r @extracted_dir
50
- end
51
-
52
- # Determine the name of the top level directory by peeking into the tarball
53
- def destination_directory
54
- raise Errno::ENOENT, "No such file \"#{@archive_path}\"" unless File.file? @archive_path
55
-
56
- firstline = nil
57
- dir = nil
58
- dir_regex = %r[^(.*?)/]
59
- IO.popen(%{tar -tf #{@archive_path}}) { |out| firstline = out.gets }
60
-
61
- if firstline.nil? or firstline.empty?
62
- raise "Could not get a directory listing from the installer tarfile #{File.basename @archive_path}"
63
- elsif (match = firstline.match dir_regex)
64
- dir = match[1]
65
- else
66
- raise "Could not determine the base directory name from #{firstline} - doesn't match #{dir_regex.to_s}"
67
- end
68
- dir
69
- end
70
- end
@@ -1,31 +0,0 @@
1
- require 'pe_build'
2
- require 'vagrant'
3
-
4
- class PEBuild::Command < Vagrant::Command::Base
5
- def initialize(argv, env)
6
- @argv, @env = argv, env
7
-
8
- @main_args, @subcommand, @sub_args = split_main_and_subcommand(argv)
9
-
10
- # Is this even remotely sane? Are we verging on cargo cult programming?
11
- @subcommands = Vagrant::Registry.new
12
-
13
- @subcommands.register('download') { PEBuild::Command::Download }
14
- @subcommands.register('list') { PEBuild::Command::List }
15
- end
16
-
17
- def execute
18
- if @subcommand and (klass = @subcommands.get(@subcommand))
19
- klass.new(@argv, @env).execute
20
- elsif @subcommand
21
- raise "Unrecognized subcommand #{@subcommand}"
22
- else
23
- PEBuild::Command::List.new(@argv, @env).execute
24
- end
25
- end
26
- end
27
-
28
- require 'pe_build/command/list'
29
- require 'pe_build/command/download'
30
-
31
- Vagrant.commands.register(:pe_build) { PEBuild::Command }
@@ -1,8 +0,0 @@
1
- require 'pe_build'
2
- require 'vagrant'
3
-
4
- class PEBuild::Command::Download < Vagrant::Command::Base
5
- def execute
6
- @env.action_runner.run(:download_pe_build)
7
- end
8
- end
@@ -1,10 +0,0 @@
1
- require 'vagrant'
2
- class PEBuild::Command::List < Vagrant::Command::Base
3
- def execute
4
- if File.directory? PEBuild.archive_directory and (entries = Dir["#{PEBuild.archive_directory}/*"])
5
- puts entries.join('\n')
6
- else
7
- warn "No PE versions downloaded."
8
- end
9
- end
10
- end
@@ -1,30 +0,0 @@
1
- require 'vagrant'
2
- require 'uri'
3
- require 'pe_build'
4
-
5
- class PEBuild::Config < Vagrant::Config::Base
6
- attr_writer :download_root
7
- attr_writer :version
8
- attr_writer :filename
9
-
10
- def download_root
11
- @download_root || 'https://pm.puppetlabs.com/puppet-enterprise'
12
- end
13
-
14
- def version
15
- @version || '2.5.2'
16
- end
17
-
18
- def filename
19
- @filename || "puppet-enterprise-#{version}-all.tar.gz"
20
- end
21
-
22
- def validate(env, errors)
23
- URI.parse(download_root)
24
- rescue
25
- # TODO I18n
26
- errors.add("Invalid download root '#{download_root.inspect}'")
27
- end
28
- end
29
-
30
- Vagrant.config_keys.register(:pe_build) { PEBuild::Config }
@@ -1,9 +0,0 @@
1
- require 'pe_build'
2
- require 'vagrant'
3
-
4
- module PEBuild::Provisioners; end
5
-
6
- require 'pe_build/provisioners/puppet_enterprise_bootstrap'
7
- #require 'pe_build/provisioners/puppet_enterprise'
8
-
9
- Vagrant.provisioners.register(:puppet_enterprise_bootstrap) { PEBuild::Provisioners::PuppetEnterpriseBootstrap}
@@ -1 +0,0 @@
1
- require 'pe_build/provisioners'
@@ -1,137 +0,0 @@
1
- require 'pe_build/provisioners'
2
- require 'vagrant'
3
- require 'fileutils'
4
- require 'erb'
5
-
6
- class PEBuild::Provisioners::PuppetEnterpriseBootstrap < Vagrant::Provisioners::Base
7
-
8
- class Config < Vagrant::Config::Base
9
- attr_writer :verbose, :master
10
-
11
- def role=(rolename)
12
- @role = (rolename.is_a?(Symbol)) ? rolename : rolename.intern
13
- end
14
-
15
- def role
16
- @role || :agent
17
- end
18
-
19
- def verbose
20
- @verbose || true
21
- end
22
-
23
- def master
24
- @master || 'master'
25
- end
26
-
27
- def validate(env, errors)
28
- errors.add("role must be one of [:master, :agent]") unless [:master, :agent].include? role
29
- end
30
- end
31
-
32
- def self.config_class
33
- Config
34
- end
35
-
36
- def initialize(*args)
37
- super
38
-
39
- load_variables
40
-
41
- @cache_path = File.join(@env[:root_path], '.pe_build')
42
- @answers_dir = File.join(@cache_path, 'answers')
43
- end
44
-
45
- def validate(app, env)
46
-
47
- end
48
-
49
- def prepare
50
- FileUtils.mkdir @cache_path unless File.directory? @cache_path
51
- @env[:action_runner].run(:prep_build, :unpack_directory => @cache_path)
52
- end
53
-
54
- def provision!
55
- # determine if bootstrapping is necessary
56
-
57
- prepare_answers_file
58
- configure_installer
59
-
60
- [:pre, :provision, :post].each do |stepname|
61
- [:base, config.role].each do |rolename|
62
- step rolename, stepname
63
- end
64
- end
65
- end
66
-
67
- private
68
-
69
- # I HATE THIS.
70
- def load_variables
71
- if @env[:box_name]
72
- @root = @env[:vm].pe_build.download_root
73
- @version = @env[:vm].pe_build.version
74
- @filename = @env[:vm].pe_build.version
75
- end
76
-
77
- @root ||= @env[:global_config].pe_build.download_root
78
- @version ||= @env[:global_config].pe_build.version
79
- @filename ||= @env[:global_config].pe_build.filename
80
-
81
- @archive_path = File.join(PEBuild.archive_directory, @filename)
82
- end
83
-
84
- def prepare_answers_file
85
- FileUtils.mkdir_p @answers_dir unless File.directory? @answers_dir
86
- @env[:ui].info "Creating answers file, node:#{@env[:vm].name}, role: #{config.role}"
87
-
88
- template = File.read("#{PEBuild.source_root}/templates/answers/#{config.role}.txt.erb")
89
- dest = "#{@answers_dir}/#{@env[:vm].name}.txt"
90
-
91
- contents = ERB.new(template).result(binding)
92
-
93
- @env[:ui].info "Writing answers file to #{dest}"
94
- File.open(dest, "w") do |file|
95
- file.write contents
96
- end
97
- end
98
-
99
- def step(role, stepname)
100
- script_dir = File.join(@env[:root_path], 'bootstrap', role.to_s, stepname.to_s)
101
- script_list = Dir.glob("#{script_dir}/*")
102
-
103
- if script_list.empty?
104
- @env[:ui].info "No steps for #{role}/#{stepname}", :color => :cyan
105
- end
106
-
107
- script_list.each do |template_path|
108
- template = File.read(template_path)
109
- contents = ERB.new(template).result(binding)
110
-
111
- on_remote contents
112
- end
113
- end
114
-
115
- # Determine the proper invocation of the PE installer
116
- #
117
- # @todo Don't restrict this to the universal installer
118
- def configure_installer
119
- vm_base_dir = "/vagrant/.pe_build"
120
- installer = "#{vm_base_dir}/puppet-enterprise-#{@version}-all/puppet-enterprise-installer"
121
- answers = "#{vm_base_dir}/answers/#{@env[:vm].name}.txt"
122
- log_file = "/root/puppet-enterprise-installer-#{Time.now.strftime('%s')}.log"
123
-
124
- @installer_cmd = "#{installer} -a #{answers} -l #{log_file}"
125
- end
126
-
127
- def on_remote(cmd)
128
- env[:vm].channel.sudo(cmd) do |type, data|
129
- # This section is directly ripped off from the shell provider.
130
- if type == :stdout and config.verbose
131
- @env[:ui].info(data.chomp, :color => :green, :prefix => false)
132
- elsif type == :stderr
133
- @env[:ui].info(data.chomp, :color => :red, :prefix => false)
134
- end
135
- end
136
- end
137
- end
@@ -1,5 +0,0 @@
1
- require 'oscar/version'
2
- module PEBuild
3
- # Copy the version constant from oscar
4
- VERSION = Oscar::VERSION
5
- end
data/manifests/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- *
2
- !.gitignore
3
-
data/modules/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- *
2
- !.gitignore