pe_info 0.1.6 → 0.2.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/pe_info/tarball.rb +49 -4
- data/lib/pe_info/version.rb +1 -1
- data/pe_info.gemspec +4 -4
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 405b7419cedb6fd7824e1ea75c51e4130b60ffa6
|
4
|
+
data.tar.gz: 894e5b64f54de79f9550ad741c1635f1988a72b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75b4b58d09ca21bb1e9246baaecabd441acece276eaed84e5322b1e7e0fa389ab1ecc40b71f8886f5bf2b9214247ecd07797bc5b40feb93df0f021fb1194aa5d
|
7
|
+
data.tar.gz: 4d13f9142e94ed0d3d392d5e441507c42dadc4e40022ecd8708ce40fd51a222e1e676f2cbaf78421cd31aa0aa8a3c2dcf10e65895f32dee2bbac132040c1e105
|
data/.gitignore
CHANGED
data/lib/pe_info/tarball.rb
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
# See the License for the specific language governing permissions and
|
15
15
|
# limitations under the License.
|
16
16
|
require "pe_info/version"
|
17
|
+
require "tmpdir"
|
17
18
|
|
18
19
|
module PeInfo
|
19
20
|
module Tarball
|
@@ -53,9 +54,49 @@ module PeInfo
|
|
53
54
|
agent_version
|
54
55
|
end
|
55
56
|
|
56
|
-
def self.
|
57
|
-
|
58
|
-
|
57
|
+
def self.supported_platforms_from_dir(pe_modules_dir)
|
58
|
+
platforms = []
|
59
|
+
Dir.chdir(pe_modules_dir) do
|
60
|
+
Dir.chdir("opt/puppetlabs/puppet/modules/pe_repo/manifests/platform") do
|
61
|
+
# windows doesn't use the platform tag...
|
62
|
+
manifests = Dir.glob("*.pp").reject {|e| e =~ /windows/ }
|
63
|
+
manifests.each { |f|
|
64
|
+
pe_repo_match = File.open(f).grep(/^\s+pe_repo::/)
|
65
|
+
if pe_repo_match.length > 0
|
66
|
+
# need to read the call the manifest would have made to get the
|
67
|
+
# platform tag, eg ubuntu-1604-i386 is really ubuntu-16.04-i386...
|
68
|
+
platforms << pe_repo_match[0].scan(/[^']+'([^']+)':/)
|
69
|
+
else
|
70
|
+
# some manifests dont have installers any more... (skipped)
|
71
|
+
end
|
72
|
+
}
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# scan seems to wrap elements in arrays..
|
77
|
+
platforms.flatten.sort
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.supported_platforms(tarball, fail_bad_tarball=true)
|
81
|
+
platforms = false
|
82
|
+
Dir.mktmpdir do |temp_dir|
|
83
|
+
Dir.chdir(temp_dir) do
|
84
|
+
if system("#{tar} --strip-components 3 -zxvf #{tarball} --wildcards puppet-enterprise*/packages/*/pe-modules*.rpm && rpm2cpio pe-modules*.rpm | cpio -idmv")
|
85
|
+
platforms = supported_platforms_from_dir(temp_dir)
|
86
|
+
elsif fail_bad_tarball
|
87
|
+
raise "Tarball error - not found or missing .rpm"
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
92
|
+
platforms
|
93
|
+
end
|
94
|
+
|
95
|
+
# @param fail_bad_tarball False to ignore bad tarballs and proceed (for testing)
|
96
|
+
def self.inspect(tarball, fail_bad_tarball=true)
|
97
|
+
pe_version = false
|
98
|
+
agent_version = false
|
99
|
+
supported_platforms = []
|
59
100
|
|
60
101
|
if is_pe_tarball(tarball)
|
61
102
|
if File.exists?(tarball)
|
@@ -65,13 +106,17 @@ module PeInfo
|
|
65
106
|
|
66
107
|
# look for the agent version
|
67
108
|
agent_version = agent_version(tarball)
|
109
|
+
|
110
|
+
# Extract the pe-modules*rpm from the tarball and scan it supported
|
111
|
+
# platforms in puppet code
|
112
|
+
supported_platforms = supported_platforms(tarball, fail_bad_tarball)
|
68
113
|
else
|
69
114
|
PeInfo.logger.debug "File not found: #{tarball}"
|
70
115
|
end
|
71
116
|
else
|
72
117
|
PeInfo.logger.debug "Not a puppet install tarball: #{tarball}"
|
73
118
|
end
|
74
|
-
return pe_version, agent_version
|
119
|
+
return pe_version, agent_version, supported_platforms
|
75
120
|
end
|
76
121
|
end
|
77
122
|
end
|
data/lib/pe_info/version.rb
CHANGED
data/pe_info.gemspec
CHANGED
@@ -6,13 +6,13 @@ require 'pe_info/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "pe_info"
|
8
8
|
spec.version = PeInfo::VERSION
|
9
|
-
spec.authors = ["
|
10
|
-
spec.email = ["
|
9
|
+
spec.authors = ["Declarative Systems"]
|
10
|
+
spec.email = ["sales@declarativesystems.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Get info about a PE installation tarball}
|
13
13
|
spec.description = %q{Peek inside a Puppet Enterprise tarball to lookup versions and capabilities}
|
14
|
-
spec.homepage = "https://github.com/
|
15
|
-
spec.license = "Apache
|
14
|
+
spec.homepage = "https://github.com/declarativesystems/pe_info"
|
15
|
+
spec.license = "Apache-2.0"
|
16
16
|
|
17
17
|
|
18
18
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pe_info
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Declarative Systems
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '3.0'
|
55
55
|
description: Peek inside a Puppet Enterprise tarball to lookup versions and capabilities
|
56
56
|
email:
|
57
|
-
-
|
57
|
+
- sales@declarativesystems.com
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
@@ -73,9 +73,9 @@ files:
|
|
73
73
|
- lib/pe_info/tarball.rb
|
74
74
|
- lib/pe_info/version.rb
|
75
75
|
- pe_info.gemspec
|
76
|
-
homepage: https://github.com/
|
76
|
+
homepage: https://github.com/declarativesystems/pe_info
|
77
77
|
licenses:
|
78
|
-
- Apache
|
78
|
+
- Apache-2.0
|
79
79
|
metadata: {}
|
80
80
|
post_install_message:
|
81
81
|
rdoc_options: []
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
95
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
96
|
+
rubygems_version: 2.5.2
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: Get info about a PE installation tarball
|