dpkginv 0.1.0.pre.1
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/bin/dpkginv +34 -0
- data/plugins/ohai/dpkg.rb +18 -0
- metadata +59 -0
data/bin/dpkginv
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'ohai'
|
5
|
+
require 'json'
|
6
|
+
require 'open4'
|
7
|
+
|
8
|
+
Ohai::Config[:plugin_path] << File.dirname(__FILE__) + '/../plugins/ohai'
|
9
|
+
o = Ohai::System.new
|
10
|
+
|
11
|
+
# ohai has dozens of plugins; let's only load the ones we need...
|
12
|
+
o.require_plugin('linux/lsb')
|
13
|
+
o.require_plugin('linux/hostname')
|
14
|
+
o.require_plugin('os')
|
15
|
+
o.require_plugin('platform')
|
16
|
+
o.require_plugin('kernel')
|
17
|
+
o.require_plugin('dpkg')
|
18
|
+
|
19
|
+
distro = o[:platform]
|
20
|
+
|
21
|
+
json = {
|
22
|
+
:fqdn => o[:fqdn],
|
23
|
+
:os => {
|
24
|
+
:distro => distro,
|
25
|
+
:codename => o[:lsb][:codename]
|
26
|
+
},
|
27
|
+
:kernel => {
|
28
|
+
:release => o[:kernel][:release],
|
29
|
+
:machine => o[:kernel][:machine]
|
30
|
+
},
|
31
|
+
:dpkg => o[:dpkg]
|
32
|
+
}
|
33
|
+
|
34
|
+
puts JSON.pretty_generate(json)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Debian/Ubuntu dpkg plugin for Chef's Ohai
|
3
|
+
#
|
4
|
+
|
5
|
+
provides "dpkg"
|
6
|
+
|
7
|
+
dpkg Mash.new
|
8
|
+
|
9
|
+
popen4("dpkg-query -W -f '${Status}|${Package}|${Version}|${Architecture}\n'") do |pid, stdin, stdout, stderr|
|
10
|
+
stdout.each do |line|
|
11
|
+
output = line.split('|')
|
12
|
+
name = output[1]
|
13
|
+
dpkg[name] = Mash.new
|
14
|
+
dpkg[name][:selection_status], null, dpkg[name][:install_status] = output[0].split
|
15
|
+
dpkg[name][:version] = output[2].to_s
|
16
|
+
dpkg[name][:arch] = output[3].chomp
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dpkginv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0.pre.1
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dave Coyle
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-10-25 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: ohai
|
16
|
+
requirement: &82387010 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0.6'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *82387010
|
25
|
+
description: Pre-release; don't use this yet.
|
26
|
+
email: hello@coyled.com
|
27
|
+
executables:
|
28
|
+
- dpkginv
|
29
|
+
extensions: []
|
30
|
+
extra_rdoc_files: []
|
31
|
+
files:
|
32
|
+
- bin/dpkginv
|
33
|
+
- plugins/ohai/dpkg.rb
|
34
|
+
homepage: http://coyled.com/dpkginv
|
35
|
+
licenses:
|
36
|
+
- MIT
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
49
|
+
requirements:
|
50
|
+
- - ! '>'
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.3.1
|
53
|
+
requirements: []
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 1.8.11
|
56
|
+
signing_key:
|
57
|
+
specification_version: 3
|
58
|
+
summary: Debian/Ubuntu package inventory tools
|
59
|
+
test_files: []
|