vagrant-pe_build 0.5.0 → 0.6.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/CHANGELOG +18 -0
- data/lib/pe_build/archive.rb +1 -1
- data/lib/pe_build/config/global.rb +12 -25
- data/lib/pe_build/config/pe_bootstrap.rb +13 -14
- data/lib/pe_build/provisioner/pe_bootstrap.rb +2 -2
- data/lib/pe_build/release.rb +11 -1
- data/lib/pe_build/unpack.rb +3 -1
- data/lib/pe_build/unpack/tar.rb +4 -5
- data/lib/pe_build/unpack/tar_gz.rb +17 -0
- data/lib/pe_build/version.rb +1 -1
- data/templates/locales/en.yml +4 -0
- metadata +3 -2
data/CHANGELOG
CHANGED
@@ -1,6 +1,24 @@
|
|
1
1
|
vagrant-pe_build
|
2
2
|
================
|
3
3
|
|
4
|
+
0.6.0
|
5
|
+
-----
|
6
|
+
|
7
|
+
2013-10-03
|
8
|
+
|
9
|
+
This is a backwards compatible bugfix and feature release.
|
10
|
+
|
11
|
+
### User notes:
|
12
|
+
|
13
|
+
* The tar archive unpacker has been split into a true tar unpacker and a
|
14
|
+
tar.gz unpacker. Archives with either '.tar' and '.tar.gz' will be
|
15
|
+
extracted with the correct unpacker.
|
16
|
+
* If a version of PE is requested but there's no definition for it, release
|
17
|
+
information for the latest version of PE will be used. This means that the
|
18
|
+
new versions of PE that aren't yet supported should work without having to
|
19
|
+
specify an explicit answer file.
|
20
|
+
* PE versions with trailing version information can now be used.
|
21
|
+
|
4
22
|
0.5.0
|
5
23
|
-----
|
6
24
|
|
data/lib/pe_build/archive.rb
CHANGED
@@ -5,10 +5,6 @@ require 'uri'
|
|
5
5
|
|
6
6
|
class PEBuild::Config::Global < Vagrant.plugin('2', :config)
|
7
7
|
|
8
|
-
# @todo This value should be discovered based on what versions of the
|
9
|
-
# installer are cached.
|
10
|
-
#DEFAULT_PE_VERSION = '2.7.2'
|
11
|
-
|
12
8
|
# @!attribute download_root
|
13
9
|
attr_accessor :download_root
|
14
10
|
|
@@ -18,19 +14,8 @@ class PEBuild::Config::Global < Vagrant.plugin('2', :config)
|
|
18
14
|
# @!attribute suffix
|
19
15
|
attr_accessor :suffix
|
20
16
|
|
21
|
-
# Allow our filename default to use @version and @suffix variables. This
|
22
|
-
# approach will not break the merging mechanism since the merging directly
|
23
|
-
# accesses the instance variables of the configuration objects.
|
24
|
-
def filename
|
25
|
-
if @filename == UNSET_VALUE
|
26
|
-
"puppet-enterprise-#{version}-#{suffix}.tar.gz"
|
27
|
-
else
|
28
|
-
@filename
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
17
|
# @!attribute filename
|
33
|
-
|
18
|
+
attr_accessor :filename
|
34
19
|
|
35
20
|
def initialize
|
36
21
|
@download_root = UNSET_VALUE
|
@@ -43,25 +28,25 @@ class PEBuild::Config::Global < Vagrant.plugin('2', :config)
|
|
43
28
|
|
44
29
|
def finalize!
|
45
30
|
set_default :@suffix, :detect
|
46
|
-
|
47
|
-
#set_default :@version, DEFAULT_PE_VERSION
|
48
|
-
|
49
31
|
set_default :@download_root, nil
|
32
|
+
set_default :@filename, nil
|
50
33
|
end
|
51
34
|
|
52
35
|
# @todo Convert error strings to I18n
|
53
36
|
def validate(machine)
|
54
37
|
errors = []
|
55
38
|
|
56
|
-
validate_version(errors)
|
57
|
-
validate_download_root(errors)
|
39
|
+
validate_version(errors, machine)
|
40
|
+
validate_download_root(errors, machine)
|
58
41
|
|
59
42
|
{"PE build global config" => errors}
|
60
43
|
end
|
61
44
|
|
62
45
|
private
|
63
46
|
|
64
|
-
|
47
|
+
PE_VERSION_REGEX = %r[\d+\.\d+\.\d+[\w-]*]
|
48
|
+
|
49
|
+
def validate_version(errors, machine)
|
65
50
|
|
66
51
|
errmsg = I18n.t(
|
67
52
|
'pebuild.config.global.errors.malformed_version',
|
@@ -72,14 +57,16 @@ class PEBuild::Config::Global < Vagrant.plugin('2', :config)
|
|
72
57
|
# Allow Global version to be unset, rendering it essentially optional. If it is
|
73
58
|
# discovered to be unset by a configuration on the next level up who cannot provide a
|
74
59
|
# value, it is that configuration's job to take action.
|
75
|
-
if @version.kind_of? String
|
76
|
-
|
60
|
+
if @version.kind_of? String
|
61
|
+
if !(@version.match PE_VERSION_REGEX)
|
62
|
+
errors << errmsg
|
63
|
+
end
|
77
64
|
elsif @version != UNSET_VALUE
|
78
65
|
errors << errmsg
|
79
66
|
end
|
80
67
|
end
|
81
68
|
|
82
|
-
def validate_download_root(errors)
|
69
|
+
def validate_download_root(errors, machine)
|
83
70
|
if @download_root and @download_root != UNSET_VALUE
|
84
71
|
begin
|
85
72
|
uri = URI.parse(@download_root)
|
@@ -103,13 +103,12 @@ class PEBuild::Config::PEBootstrap < PEBuild::Config::Global
|
|
103
103
|
|
104
104
|
errors = []
|
105
105
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
validate_autosign(errors)
|
106
|
+
validate_role(errors, machine)
|
107
|
+
validate_verbose(errors, machine)
|
108
|
+
validate_master(errors, machine)
|
109
|
+
validate_answer_file(errors, machine)
|
110
|
+
validate_relocate_manifests(errors, machine)
|
111
|
+
validate_autosign(errors, machine)
|
113
112
|
|
114
113
|
errors |= h.values.flatten
|
115
114
|
{"PE Bootstrap" => errors}
|
@@ -117,13 +116,13 @@ class PEBuild::Config::PEBootstrap < PEBuild::Config::Global
|
|
117
116
|
|
118
117
|
private
|
119
118
|
|
120
|
-
def validate_version(errors)
|
119
|
+
def validate_version(errors, machine)
|
121
120
|
if @version == UNSET_VALUE and global_config_from(machine).pe_build.version == UNSET_VALUE
|
122
121
|
errors << I18n.t('pebuild.config.pe_bootstrap.errors.unset_version')
|
123
122
|
end
|
124
123
|
end
|
125
124
|
|
126
|
-
def validate_role(errors)
|
125
|
+
def validate_role(errors, machine)
|
127
126
|
unless VALID_ROLES.any? {|sym| @role == sym}
|
128
127
|
errors << I18n.t(
|
129
128
|
'pebuild.config.pe_bootstrap.errors.unhandled_role',
|
@@ -133,7 +132,7 @@ class PEBuild::Config::PEBootstrap < PEBuild::Config::Global
|
|
133
132
|
end
|
134
133
|
end
|
135
134
|
|
136
|
-
def validate_verbose(errors)
|
135
|
+
def validate_verbose(errors, machine)
|
137
136
|
unless @verbose == !!@verbose
|
138
137
|
errors << I18n.t(
|
139
138
|
'pebuild.config.pe_bootstrap.errors.malformed_verbose',
|
@@ -142,25 +141,25 @@ class PEBuild::Config::PEBootstrap < PEBuild::Config::Global
|
|
142
141
|
end
|
143
142
|
end
|
144
143
|
|
145
|
-
def validate_master(errors)
|
144
|
+
def validate_master(errors, machine)
|
146
145
|
unless @master.is_a? String
|
147
146
|
errors << "'master' must be a string containing the address of the master, got a #{@master.class}"
|
148
147
|
end
|
149
148
|
end
|
150
149
|
|
151
|
-
def validate_answer_file(errors)
|
150
|
+
def validate_answer_file(errors, machine)
|
152
151
|
if @answer_file and !File.readable? @answer_file
|
153
152
|
errors << "'answers_file' must be a readable file"
|
154
153
|
end
|
155
154
|
end
|
156
155
|
|
157
|
-
def validate_relocate_manifests(errors)
|
156
|
+
def validate_relocate_manifests(errors, machine)
|
158
157
|
if @relocate_manifests and not @role == :master
|
159
158
|
errors << "'relocate_manifests' can only be applied to a master"
|
160
159
|
end
|
161
160
|
end
|
162
161
|
|
163
|
-
def validate_autosign(errors)
|
162
|
+
def validate_autosign(errors, machine)
|
164
163
|
if (@autosign and @role != :master)
|
165
164
|
errors << I18n.t(
|
166
165
|
'pebuild.config.pe_bootstrap.errors.invalid_autosign_role',
|
@@ -71,8 +71,8 @@ module PEBuild
|
|
71
71
|
# is being used for default values and was never directly touched then it
|
72
72
|
# may have bad values, so we re-finalize everything. This may not be
|
73
73
|
# generally safe but inside of this plugin it should be ok.
|
74
|
-
provision.finalize!
|
75
74
|
global.finalize!
|
75
|
+
provision.finalize!
|
76
76
|
|
77
77
|
merged = PEBuild::Util::Config.local_merge(provision, global)
|
78
78
|
|
@@ -85,7 +85,7 @@ module PEBuild
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def load_archive
|
88
|
-
if @config.suffix == :detect
|
88
|
+
if @config.suffix == :detect and @config.filename.nil?
|
89
89
|
filename = @machine.guest.capability('detect_installer', @config.version)
|
90
90
|
else
|
91
91
|
filename = @config.filename
|
data/lib/pe_build/release.rb
CHANGED
@@ -8,7 +8,17 @@ module PEBuild
|
|
8
8
|
@releases = {}
|
9
9
|
|
10
10
|
def self.[](ver)
|
11
|
-
@releases[ver]
|
11
|
+
release = @releases[ver]
|
12
|
+
|
13
|
+
if release.nil?
|
14
|
+
logger = Log4r::Logger.new('vagrant::pe_build::release')
|
15
|
+
logger.warn I18n.t 'pebuild.release.unknown_version',
|
16
|
+
:missing_version => ver,
|
17
|
+
:latest_version => LATEST_VERSION
|
18
|
+
release = @releases[LATEST_VERSION]
|
19
|
+
end
|
20
|
+
|
21
|
+
release
|
12
22
|
end
|
13
23
|
|
14
24
|
def self.newrelease(&blk)
|
data/lib/pe_build/unpack.rb
CHANGED
@@ -6,10 +6,12 @@ module PEBuild
|
|
6
6
|
end
|
7
7
|
|
8
8
|
require 'pe_build/unpack/tar'
|
9
|
+
require 'pe_build/unpack/tar_gz'
|
9
10
|
require 'pe_build/unpack/copy'
|
10
11
|
|
11
12
|
IMPLEMENTATIONS = {
|
12
|
-
'.tar
|
13
|
+
'.tar' => PEBuild::Unpack::Tar,
|
14
|
+
'.tar.gz' => PEBuild::Unpack::TarGZ,
|
13
15
|
'.msi' => PEBuild::Unpack::Copy,
|
14
16
|
}
|
15
17
|
|
data/lib/pe_build/unpack/tar.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'archive/tar/minitar'
|
2
|
-
require 'zlib'
|
3
2
|
|
4
3
|
module PEBuild
|
5
4
|
module Unpack
|
@@ -12,7 +11,7 @@ class Tar
|
|
12
11
|
end
|
13
12
|
|
14
13
|
def unpack
|
15
|
-
::Archive::Tar::Minitar.unpack(
|
14
|
+
::Archive::Tar::Minitar.unpack(file_stream, @dst)
|
16
15
|
end
|
17
16
|
|
18
17
|
# @return [String] The file/dir that will be created as a result of unpack
|
@@ -22,7 +21,7 @@ class Tar
|
|
22
21
|
|
23
22
|
# @return [String] The base directory contained in the tar archive
|
24
23
|
def dirname
|
25
|
-
input = ::Archive::Tar::Minitar::Input.new(
|
24
|
+
input = ::Archive::Tar::Minitar::Input.new(file_stream)
|
26
25
|
|
27
26
|
base = nil
|
28
27
|
input.each do |entry|
|
@@ -35,8 +34,8 @@ class Tar
|
|
35
34
|
|
36
35
|
private
|
37
36
|
|
38
|
-
def
|
39
|
-
|
37
|
+
def file_stream
|
38
|
+
File.open(@src, 'rb')
|
40
39
|
end
|
41
40
|
end
|
42
41
|
end
|
data/lib/pe_build/version.rb
CHANGED
data/templates/locales/en.yml
CHANGED
@@ -62,3 +62,7 @@ en:
|
|
62
62
|
The VM "%{name}" could not detect the version of Puppet Enterprise and failed with
|
63
63
|
the following error:
|
64
64
|
"%{error}"
|
65
|
+
release:
|
66
|
+
unknown_version: |-
|
67
|
+
Release information for PE version %{missing_version} could not be found. Falling back
|
68
|
+
Falling back to %{latest_version}.
|
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.
|
4
|
+
version: 0.6.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-
|
12
|
+
date: 2013-10-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: progressbar
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- lib/pe_build/unpack.rb
|
109
109
|
- lib/pe_build/unpack/copy.rb
|
110
110
|
- lib/pe_build/unpack/tar.rb
|
111
|
+
- lib/pe_build/unpack/tar_gz.rb
|
111
112
|
- lib/pe_build/util/config.rb
|
112
113
|
- lib/pe_build/version.rb
|
113
114
|
- lib/vagrant-pe_build.rb
|