knife-pkg 0.1.1 → 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 +7 -0
- data/README.md +25 -0
- data/lib/chef/knife/pkg_base.rb +1 -0
- data/lib/chef/knife/pkg_install_updates.rb +7 -0
- data/lib/knife-pkg/controllers/apt.rb +28 -20
- data/lib/knife-pkg/controllers/package_controller.rb +86 -75
- data/lib/knife-pkg/version.rb +1 -1
- data/spec/controllers/apt_spec.rb +80 -16
- metadata +5 -21
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 693eb26a2679a69e02ec7c5e401f658fe0bf1f7a
|
|
4
|
+
data.tar.gz: 234e8b042f480d0b6b9f25ce67a5c3a623b6a059
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 43f34e39548c1a7e3c06e6e916a0b1207047b06443d29bd27ff5a017b0a8d964a58389d081d5dc2b774bfc620e0f74f010d52aceffbede87687f6342380d6357
|
|
7
|
+
data.tar.gz: 4ea377499214e59d5e453caed9cd68f13f45e053cf35c4dd0e2f8fa2b2cc176fc0a80677b2427a3f164701b5b622fd56d6eb75c59177b60adf3d3d068e575bfe
|
data/README.md
CHANGED
|
@@ -106,6 +106,31 @@ $ knife pkg install updates "roles:webserver" -U "libxml2,gpgv,gnupg"
|
|
|
106
106
|
...
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
+
- install all updates, don't ask
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
$ knife pkg install updates "*:*" -y
|
|
113
|
+
===> s10.example.com
|
|
114
|
+
Updating libwbclient0 (3.6.6-6+deb7u1~bpo60+1)
|
|
115
|
+
Updating samba-common (3.6.6-6+deb7u1~bpo60+1)
|
|
116
|
+
Updating samba-common-bin (3.6.6-6+deb7u1~bpo60+1)
|
|
117
|
+
Updating smbclient (3.6.6-6+deb7u1~bpo60+1)
|
|
118
|
+
===> s11.example.com
|
|
119
|
+
Updating libwbclient0 (3.6.6-6+deb7u1~bpo60+1)
|
|
120
|
+
Updating samba-common (3.6.6-6+deb7u1~bpo60+1)
|
|
121
|
+
Updating samba-common-bin (3.6.6-6+deb7u1~bpo60+1)
|
|
122
|
+
Updating smbclient (3.6.6-6+deb7u1~bpo60+1)
|
|
123
|
+
===> s12.example.com
|
|
124
|
+
Updating libwbclient0 (3.6.6-6+deb7u1~bpo60+1)
|
|
125
|
+
Updating samba-common (3.6.6-6+deb7u1~bpo60+1)
|
|
126
|
+
Updating samba-common-bin (3.6.6-6+deb7u1~bpo60+1)
|
|
127
|
+
===> s13.example.com
|
|
128
|
+
Updating libwbclient0 (3.6.6-6+deb7u1~bpo60+1)
|
|
129
|
+
Updating samba-common (3.6.6-6+deb7u1~bpo60+1)
|
|
130
|
+
Updating samba-common-bin (3.6.6-6+deb7u1~bpo60+1)
|
|
131
|
+
Updating smbclient (3.6.6-6+deb7u1~bpo60+1)
|
|
132
|
+
```
|
|
133
|
+
|
|
109
134
|
## Supported Packet Managers
|
|
110
135
|
|
|
111
136
|
* apt
|
data/lib/chef/knife/pkg_base.rb
CHANGED
|
@@ -101,6 +101,13 @@ class Chef
|
|
|
101
101
|
:description => "QUERY is a space separated list of servers",
|
|
102
102
|
:default => false
|
|
103
103
|
|
|
104
|
+
option :dry_run,
|
|
105
|
+
:short => "-D",
|
|
106
|
+
:long => "--dry-run",
|
|
107
|
+
:boolean => true,
|
|
108
|
+
:description => "Simulates package installation. Actually this is only supported by 'apt'",
|
|
109
|
+
:default => false
|
|
110
|
+
|
|
104
111
|
|
|
105
112
|
def run
|
|
106
113
|
super
|
|
@@ -22,6 +22,7 @@ module Knife
|
|
|
22
22
|
|
|
23
23
|
def initialize(node, session, opts = {})
|
|
24
24
|
super(node, session, opts)
|
|
25
|
+
@installed_packages = Array.new
|
|
25
26
|
end
|
|
26
27
|
|
|
27
28
|
def dry_run_supported?
|
|
@@ -33,11 +34,9 @@ module Knife
|
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
def last_pkg_cache_update
|
|
36
|
-
raise_update_notifier_missing! unless update_notifier_installed?
|
|
37
|
-
|
|
38
37
|
result = nil
|
|
39
38
|
begin
|
|
40
|
-
result = exec("stat -c %y /var/lib/apt/
|
|
39
|
+
result = exec("#{sudo} stat -c %y /var/lib/apt/lists")
|
|
41
40
|
Time.parse(result.stdout.chomp)
|
|
42
41
|
rescue RuntimeError => e
|
|
43
42
|
e.backtrace.each { |l| Chef::Log.debug(l) }
|
|
@@ -47,7 +46,14 @@ module Knife
|
|
|
47
46
|
end
|
|
48
47
|
|
|
49
48
|
def installed_version(package)
|
|
50
|
-
|
|
49
|
+
package = @installed_packages.select { |p| p.name == package.name }.first || Package.new("")
|
|
50
|
+
if !package.name.empty?
|
|
51
|
+
version = package.version
|
|
52
|
+
else
|
|
53
|
+
# fallback
|
|
54
|
+
version = exec("dpkg -p #{package.name} | grep -i Version: | awk '{print $2}' | head -1").stdout.chomp
|
|
55
|
+
end
|
|
56
|
+
version
|
|
51
57
|
end
|
|
52
58
|
|
|
53
59
|
def update_version(package)
|
|
@@ -55,15 +61,25 @@ module Knife
|
|
|
55
61
|
end
|
|
56
62
|
|
|
57
63
|
def available_updates
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
parse_upgrade(exec("#{sudo} apt-get dist-upgrade -V -s | egrep -v \"^(Conf|Inst)\"").stdout)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def parse_upgrade(upgrade_line)
|
|
68
|
+
result = Array.new
|
|
69
|
+
rx = Regexp.new(/\s+(?<name>\S+)\s\((?<installed>.+)\s=>\s(?<new>.+)\)/)
|
|
70
|
+
found = false
|
|
71
|
+
upgrade_line.split("\n").each do |line|
|
|
72
|
+
unless found
|
|
73
|
+
found = true if line.match(/will be upgraded/)
|
|
74
|
+
next
|
|
75
|
+
end
|
|
76
|
+
match = rx.match(line)
|
|
77
|
+
unless match.nil?
|
|
78
|
+
result << Package.new(match[:name], match[:new])
|
|
79
|
+
@installed_packages << Package.new(match[:name], match[:installed])
|
|
80
|
+
end
|
|
65
81
|
end
|
|
66
|
-
|
|
82
|
+
result
|
|
67
83
|
end
|
|
68
84
|
|
|
69
85
|
def update_package!(package)
|
|
@@ -71,14 +87,6 @@ module Knife
|
|
|
71
87
|
cmd_string += " -s" if @options[:dry_run]
|
|
72
88
|
exec(cmd_string)
|
|
73
89
|
end
|
|
74
|
-
|
|
75
|
-
def update_notifier_installed?
|
|
76
|
-
exec("dpkg-query -W update-notifier-common 2>/dev/null || echo 'false'").stdout.chomp != 'false'
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def raise_update_notifier_missing!
|
|
80
|
-
raise RuntimeError, "No update-notifier(-common) installed!? Install it and try again!"
|
|
81
|
-
end
|
|
82
90
|
end
|
|
83
91
|
end
|
|
84
92
|
end
|
|
@@ -34,20 +34,79 @@ module Knife
|
|
|
34
34
|
@options = opts
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
end
|
|
37
|
+
|
|
38
|
+
class << self
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
def list_available_updates(updates)
|
|
41
|
+
updates.each do |update|
|
|
42
|
+
ui.info(ui.color("\t" + update.to_s, :yellow))
|
|
43
|
+
end
|
|
44
|
+
end
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
def ui
|
|
47
|
+
@ui ||= Chef::Knife::UI.new(STDOUT, STDERR, STDIN, {})
|
|
48
|
+
end
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
# Connects to the node, updates packages (defined with param `packages`) without confirmation, all other available updates with confirmation
|
|
51
|
+
# @param [Hash] node the node
|
|
52
|
+
# @option node [String] :platform_family platform of the node, e.g. `debian`. if not set, `ohai` will be executed
|
|
53
|
+
# @param [Session] session the ssh session to be used to connect to the node
|
|
54
|
+
# @param [Array<String>] packages name of the packages which should be updated without confirmation
|
|
55
|
+
# @param [Hash] opts the options
|
|
56
|
+
# @option opts [Boolean] :dry_run whether the update should only be simulated (if supported by the package manager)
|
|
57
|
+
# @option opts [Boolean] :verbose whether the update process should be more verbose
|
|
58
|
+
# @option opts [Boolean] :yes whether all available updates should be installed without confirmation
|
|
59
|
+
def update!(node, session, packages, opts)
|
|
60
|
+
ctrl = self.init_controller(node, session, opts)
|
|
61
|
+
|
|
62
|
+
auto_updates = packages.map { |u| Package.new(u) }
|
|
63
|
+
updates_for_dialog = Array.new
|
|
64
|
+
|
|
65
|
+
ctrl.try_update_pkg_cache
|
|
66
|
+
available_updates = ctrl.available_updates
|
|
67
|
+
|
|
68
|
+
# install all available packages
|
|
69
|
+
if opts[:yes]
|
|
70
|
+
auto_updates = available_updates
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# install packages in auto_updates without confirmation,
|
|
74
|
+
# but only if they are available as update
|
|
75
|
+
# don't install packages which aren't installed
|
|
76
|
+
available_updates.each do |avail|
|
|
77
|
+
if auto_updates.select { |p| p.name == avail.name }.count == 0
|
|
78
|
+
updates_for_dialog << avail
|
|
79
|
+
else
|
|
80
|
+
ui.info("\tUpdating #{avail.to_s}")
|
|
81
|
+
ctrl.update_package_verbose!(avail)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
ctrl.update_dialog(updates_for_dialog)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def available_updates(node, session, opts = {})
|
|
89
|
+
ctrl = self.init_controller(node, session, opts)
|
|
90
|
+
ctrl.try_update_pkg_cache
|
|
91
|
+
updates = ctrl.available_updates
|
|
92
|
+
list_available_updates(ctrl.update_info(updates))
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def init_controller(node, session, opts)
|
|
96
|
+
platform_family = node[:platform_family] || self.platform_family_by_local_ohai(session, opts)
|
|
97
|
+
ctrl_name = PlatformFamily.map_to_pkg_ctrl(platform_family)
|
|
98
|
+
raise NotImplementedError, "I'm sorry, but #{node[:platform_family]} is not supported!" if ctrl_name == 'unknown'
|
|
99
|
+
|
|
100
|
+
Chef::Log.debug("Platform Family #{platform_family} detected, using #{ctrl_name}")
|
|
101
|
+
require File.join(File.dirname(__FILE__), ctrl_name)
|
|
102
|
+
ctrl = Object.const_get('Knife').const_get('Pkg').const_get("#{ctrl_name.capitalize}PackageController").new(node, session, opts)
|
|
103
|
+
ctrl.ui = self.ui
|
|
104
|
+
ctrl
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def platform_family_by_local_ohai(session, opts)
|
|
108
|
+
ShellCommand.exec("ohai platform_family| grep \\\"", session).stdout.strip.gsub(/\"/,'')
|
|
109
|
+
end
|
|
51
110
|
end
|
|
52
111
|
|
|
53
112
|
## ++ methods to implement
|
|
@@ -91,6 +150,19 @@ module Knife
|
|
|
91
150
|
end
|
|
92
151
|
|
|
93
152
|
## ++ methods to implement
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def sudo
|
|
156
|
+
@options[:sudo] ? 'sudo ' : ''
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def exec(cmd)
|
|
160
|
+
ShellCommand.exec(cmd, @session)
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def max_pkg_cache_age
|
|
164
|
+
options[:max_pkg_cache_age] || ONE_DAY_IN_SECS
|
|
165
|
+
end
|
|
94
166
|
|
|
95
167
|
def update_info(packages)
|
|
96
168
|
result = []
|
|
@@ -107,7 +179,7 @@ module Knife
|
|
|
107
179
|
result = update_package!(package)
|
|
108
180
|
if @options[:dry_run] || @options[:verbose]
|
|
109
181
|
ui.info(result.stdout)
|
|
110
|
-
ui.error(result.stderr)
|
|
182
|
+
ui.error(result.stderr) unless result.stderr.empty?
|
|
111
183
|
end
|
|
112
184
|
end
|
|
113
185
|
|
|
@@ -121,8 +193,8 @@ module Knife
|
|
|
121
193
|
def update_dialog(packages)
|
|
122
194
|
return if packages.count == 0
|
|
123
195
|
|
|
124
|
-
ui.info("\tThe following updates are available:")
|
|
125
|
-
PackageController
|
|
196
|
+
ui.info("\tThe following updates are available:")
|
|
197
|
+
PackageController.list_available_updates(update_info(packages))
|
|
126
198
|
|
|
127
199
|
if UserDecision.yes?("\tDo you want to update all packages? [y|n]: ")
|
|
128
200
|
ui.info("\tupdating...")
|
|
@@ -139,67 +211,6 @@ module Knife
|
|
|
139
211
|
end
|
|
140
212
|
end
|
|
141
213
|
end
|
|
142
|
-
|
|
143
|
-
def self.list_available_updates(updates)
|
|
144
|
-
updates.each do |update|
|
|
145
|
-
ui.info(ui.color("\t" + update.to_s, :yellow))
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
# Connects to the node, updates packages (defined with param `packages`) without confirmation, all other available updates with confirmation
|
|
150
|
-
# @param [Hash] node the node
|
|
151
|
-
# @option node [String] :platform_family platform of the node, e.g. `debian`. if not set, `ohai` will be executed
|
|
152
|
-
# @param [Session] session the ssh session to be used to connect to the node
|
|
153
|
-
# @param [Array<String>] packages name of the packages which should be updated without confirmation
|
|
154
|
-
# @param [Hash] opts the options
|
|
155
|
-
# @option opts [Boolean] :dry_run wether the update should only be simulated (if supported by the package manager)
|
|
156
|
-
# @option opts [Boolean] :verbose wether the update process should be more verbose
|
|
157
|
-
def self.update!(node, session, packages, opts)
|
|
158
|
-
ctrl = self.init_controller(node, session, opts)
|
|
159
|
-
|
|
160
|
-
auto_updates = packages.map { |u| Package.new(u) }
|
|
161
|
-
updates_for_dialog = Array.new
|
|
162
|
-
|
|
163
|
-
ctrl.try_update_pkg_cache
|
|
164
|
-
available_updates = ctrl.available_updates
|
|
165
|
-
|
|
166
|
-
# install packages in auto_updates without confirmation,
|
|
167
|
-
# but only if they are available as update
|
|
168
|
-
# don't install packages which aren't installed
|
|
169
|
-
available_updates.each do |avail|
|
|
170
|
-
if auto_updates.select { |p| p.name == avail.name }.count == 0
|
|
171
|
-
updates_for_dialog << avail
|
|
172
|
-
else
|
|
173
|
-
ui.info("\tUpdating #{avail.to_s}")
|
|
174
|
-
ctrl.update_package_verbose!(avail)
|
|
175
|
-
end
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
ctrl.update_dialog(updates_for_dialog)
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
def self.available_updates(node, session, opts = {})
|
|
182
|
-
ctrl = self.init_controller(node, session, opts)
|
|
183
|
-
ctrl.try_update_pkg_cache
|
|
184
|
-
updates = ctrl.available_updates
|
|
185
|
-
list_available_updates(ctrl.update_info(updates))
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
def self.init_controller(node, session, opts)
|
|
189
|
-
platform_family = node[:platform_family] || self.platform_family_by_local_ohai(session, opts)
|
|
190
|
-
ctrl_name = PlatformFamily.map_to_pkg_ctrl(platform_family)
|
|
191
|
-
raise NotImplementedError, "I'm sorry, but #{node[:platform_family]} is not supported!" if ctrl_name == 'unknown'
|
|
192
|
-
|
|
193
|
-
Chef::Log.debug("Platform Family #{platform_family} detected, using #{ctrl_name}")
|
|
194
|
-
require File.join(File.dirname(__FILE__), ctrl_name)
|
|
195
|
-
ctrl = Object.const_get('Knife').const_get('Pkg').const_get("#{ctrl_name.capitalize}PackageController").new(node, session, opts)
|
|
196
|
-
ctrl.ui = self.ui
|
|
197
|
-
ctrl
|
|
198
|
-
end
|
|
199
|
-
|
|
200
|
-
def self.platform_family_by_local_ohai(session, opts)
|
|
201
|
-
ShellCommand.exec("ohai platform_family| grep \\\"", session).stdout.strip.gsub(/\"/,'')
|
|
202
|
-
end
|
|
203
214
|
end
|
|
204
215
|
end
|
|
205
216
|
end
|
data/lib/knife-pkg/version.rb
CHANGED
|
@@ -34,26 +34,90 @@ describe 'AptPackageController' do
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe "#available_updates" do
|
|
37
|
-
it 'should
|
|
37
|
+
it 'should return an array' do
|
|
38
38
|
p = AptPackageController.new(nil, nil)
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
result = ShellCommandResult.new(nil,"will be upgraded\n base-files2 (7.1wheezy1 => 7.1wheezy2)\nbla",nil,nil)
|
|
40
|
+
p.stub(:exec).and_return(result)
|
|
41
|
+
packages = p.available_updates
|
|
42
|
+
expect(packages).to be_an_instance_of Array
|
|
43
|
+
expect(packages[0].name).to eq("base-files2")
|
|
44
|
+
expect(packages[0].version).to eq("7.1wheezy2")
|
|
41
45
|
end
|
|
46
|
+
end
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
describe "#installed_version" do
|
|
49
|
+
it 'should return the installed version from internal list' do
|
|
45
50
|
p = AptPackageController.new(nil, nil)
|
|
46
|
-
|
|
47
|
-
p.
|
|
48
|
-
p.
|
|
49
|
-
p.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
output = "will be upgraded\n base-files (7.1wheezy1 => 7.1wheezy2)\nbla"
|
|
52
|
+
p.parse_upgrade(output)
|
|
53
|
+
expect(p).not_to receive(:exec)
|
|
54
|
+
expect(p.installed_version(Package.new("base-files"))).to eq("7.1wheezy1")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'should return the installed version from dpkg' do
|
|
58
|
+
p = AptPackageController.new(nil, nil)
|
|
59
|
+
output = "bla\n base-files (7.1wheezy1 => 7.1wheezy2)\nbla"
|
|
60
|
+
p.parse_upgrade(output)
|
|
61
|
+
r = Struct.new(:stdout)
|
|
62
|
+
output_exec = r.new("1.0.0\n")
|
|
63
|
+
p.stub(:exec).and_return(output_exec)
|
|
64
|
+
expect(p).to receive(:exec)
|
|
65
|
+
expect(p.installed_version(Package.new("bla"))).to eq("1.0.0")
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
describe "#parse_upgrade" do
|
|
70
|
+
it 'should parse output from apt-get upgrade and return an array of packages' do
|
|
71
|
+
stdout = <<-END.gsub(/^ {6}/, '')
|
|
72
|
+
Reading package lists...
|
|
73
|
+
Building dependency tree...
|
|
74
|
+
Reading state information...
|
|
75
|
+
The following packages have been kept back:
|
|
76
|
+
esl-erlang (16.b-2~debian~squeeze => 16.b.2-1)
|
|
77
|
+
postgresql-client-9.2 (9.2.4-1.pgdg60+1 => 9.2.5-1.pgdg60+1)
|
|
78
|
+
The following packages will be upgraded:
|
|
79
|
+
base-files (7.1wheezy1 => 7.1wheezy2)
|
|
80
|
+
curl (7.26.0-1+wheezy3 => 7.26.0-1+wheezy4)
|
|
81
|
+
dmsetup (1.02.74-7 => 1.02.74-8)
|
|
82
|
+
dpkg (1.16.10 => 1.16.12)
|
|
83
|
+
gnupg (1.4.12-7+deb7u1 => 1.4.12-7+deb7u2)
|
|
84
|
+
gpgv (1.4.12-7+deb7u1 => 1.4.12-7+deb7u2)
|
|
85
|
+
grub-common (1.99-27+deb7u1 => 1.99-27+deb7u2)
|
|
86
|
+
grub-pc (1.99-27+deb7u1 => 1.99-27+deb7u2)
|
|
87
|
+
grub-pc-bin (1.99-27+deb7u1 => 1.99-27+deb7u2)
|
|
88
|
+
grub2-common (1.99-27+deb7u1 => 1.99-27+deb7u2)
|
|
89
|
+
initscripts (2.88dsf-41 => 2.88dsf-41+deb7u1)
|
|
90
|
+
libcurl3 (7.26.0-1+wheezy3 => 7.26.0-1+wheezy4)
|
|
91
|
+
libdevmapper-event1.02.1 (1.02.74-7 => 1.02.74-8)
|
|
92
|
+
libdevmapper1.02.1 (1.02.74-7 => 1.02.74-8)
|
|
93
|
+
libxml2 (2.8.0+dfsg1-7+nmu1 => 2.8.0+dfsg1-7+nmu2)
|
|
94
|
+
linux-headers-3.2.0-4-amd64 (3.2.46-1+deb7u1 => 3.2.51-1)
|
|
95
|
+
linux-headers-3.2.0-4-common (3.2.46-1+deb7u1 => 3.2.51-1)
|
|
96
|
+
linux-image-3.2.0-4-amd64 (3.2.46-1+deb7u1 => 3.2.51-1)
|
|
97
|
+
linux-libc-dev (3.2.46-1+deb7u1 => 3.2.51-1)
|
|
98
|
+
lvm2 (2.02.95-7 => 2.02.95-8)
|
|
99
|
+
mutt (1.5.21-6.2 => 1.5.21-6.2+deb7u1)
|
|
100
|
+
perl (5.14.2-21 => 5.14.2-21+deb7u1)
|
|
101
|
+
perl-base (5.14.2-21 => 5.14.2-21+deb7u1)
|
|
102
|
+
perl-modules (5.14.2-21 => 5.14.2-21+deb7u1)
|
|
103
|
+
python (2.7.3-4 => 2.7.3-4+deb7u1)
|
|
104
|
+
python-minimal (2.7.3-4 => 2.7.3-4+deb7u1)
|
|
105
|
+
sysv-rc (2.88dsf-41 => 2.88dsf-41+deb7u1)
|
|
106
|
+
sysvinit (2.88dsf-41 => 2.88dsf-41+deb7u1)
|
|
107
|
+
sysvinit-utils (2.88dsf-41 => 2.88dsf-41+deb7u1)
|
|
108
|
+
tzdata (2013c-0wheezy1 => 2013d-0wheezy1)
|
|
109
|
+
30 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
|
|
110
|
+
Need to get 49.9 MB of archives.
|
|
111
|
+
After this operation, 864 kB disk space will be freed.
|
|
112
|
+
Do you want to continue [Y/n]? Abort.
|
|
113
|
+
END
|
|
114
|
+
p = AptPackageController.new(nil, nil)
|
|
115
|
+
packages = p.parse_upgrade(stdout)
|
|
116
|
+
expect(packages.count).to eq(30)
|
|
117
|
+
expect(packages[0].name).to eq("base-files")
|
|
118
|
+
expect(packages[0].version).to eq("7.1wheezy2")
|
|
119
|
+
expect(packages[29].name).to eq("tzdata")
|
|
120
|
+
expect(packages[29].version).to eq("2013d-0wheezy1")
|
|
57
121
|
end
|
|
58
122
|
end
|
|
59
123
|
end
|
metadata
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: knife-pkg
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 0.2.0
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Holger Amann
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date: 2013-10-
|
|
11
|
+
date: 2013-10-19 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: chef
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
16
|
requirements:
|
|
19
17
|
- - '>='
|
|
20
18
|
- !ruby/object:Gem::Version
|
|
@@ -22,7 +20,6 @@ dependencies:
|
|
|
22
20
|
type: :runtime
|
|
23
21
|
prerelease: false
|
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
23
|
requirements:
|
|
27
24
|
- - '>='
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
@@ -30,7 +27,6 @@ dependencies:
|
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
|
31
28
|
name: bundler
|
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
30
|
requirements:
|
|
35
31
|
- - ~>
|
|
36
32
|
- !ruby/object:Gem::Version
|
|
@@ -38,7 +34,6 @@ dependencies:
|
|
|
38
34
|
type: :development
|
|
39
35
|
prerelease: false
|
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
37
|
requirements:
|
|
43
38
|
- - ~>
|
|
44
39
|
- !ruby/object:Gem::Version
|
|
@@ -46,7 +41,6 @@ dependencies:
|
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
|
47
42
|
name: rake
|
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
44
|
requirements:
|
|
51
45
|
- - '>='
|
|
52
46
|
- !ruby/object:Gem::Version
|
|
@@ -54,7 +48,6 @@ dependencies:
|
|
|
54
48
|
type: :development
|
|
55
49
|
prerelease: false
|
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
51
|
requirements:
|
|
59
52
|
- - '>='
|
|
60
53
|
- !ruby/object:Gem::Version
|
|
@@ -62,7 +55,6 @@ dependencies:
|
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
|
63
56
|
name: rspec
|
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
|
65
|
-
none: false
|
|
66
58
|
requirements:
|
|
67
59
|
- - '>='
|
|
68
60
|
- !ruby/object:Gem::Version
|
|
@@ -70,7 +62,6 @@ dependencies:
|
|
|
70
62
|
type: :development
|
|
71
63
|
prerelease: false
|
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
-
none: false
|
|
74
65
|
requirements:
|
|
75
66
|
- - '>='
|
|
76
67
|
- !ruby/object:Gem::Version
|
|
@@ -111,33 +102,26 @@ files:
|
|
|
111
102
|
homepage: https://github.com/hamann/knife-pkg
|
|
112
103
|
licenses:
|
|
113
104
|
- Apache 2.0
|
|
105
|
+
metadata: {}
|
|
114
106
|
post_install_message:
|
|
115
107
|
rdoc_options: []
|
|
116
108
|
require_paths:
|
|
117
109
|
- lib
|
|
118
110
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
|
-
none: false
|
|
120
111
|
requirements:
|
|
121
112
|
- - '>='
|
|
122
113
|
- !ruby/object:Gem::Version
|
|
123
114
|
version: '0'
|
|
124
|
-
segments:
|
|
125
|
-
- 0
|
|
126
|
-
hash: 3505602516276971978
|
|
127
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
|
-
none: false
|
|
129
116
|
requirements:
|
|
130
117
|
- - '>='
|
|
131
118
|
- !ruby/object:Gem::Version
|
|
132
119
|
version: '0'
|
|
133
|
-
segments:
|
|
134
|
-
- 0
|
|
135
|
-
hash: 3505602516276971978
|
|
136
120
|
requirements: []
|
|
137
121
|
rubyforge_project:
|
|
138
|
-
rubygems_version: 1.8
|
|
122
|
+
rubygems_version: 2.1.8
|
|
139
123
|
signing_key:
|
|
140
|
-
specification_version:
|
|
124
|
+
specification_version: 4
|
|
141
125
|
summary: A plugin for chef's knife to manage package updates
|
|
142
126
|
test_files:
|
|
143
127
|
- spec/controllers/apt_spec.rb
|