linux_admin 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +6 -8
- data/lib/linux_admin/distro.rb +2 -2
- data/lib/linux_admin/etc_issue.rb +1 -1
- data/lib/linux_admin/fstab.rb +0 -1
- data/lib/linux_admin/logical_volume.rb +6 -8
- data/lib/linux_admin/registration_system/rhn.rb +2 -2
- data/lib/linux_admin/registration_system/subscription_manager.rb +1 -1
- data/lib/linux_admin/version.rb +1 -1
- data/lib/linux_admin/volume.rb +3 -3
- data/lib/linux_admin/yum.rb +8 -3
- data/spec/common_spec.rb +2 -4
- data/spec/deb_spec.rb +7 -9
- data/spec/disk_spec.rb +61 -63
- data/spec/distro_spec.rb +2 -4
- data/spec/etc_issue_spec.rb +1 -2
- data/spec/fstab_spec.rb +23 -24
- data/spec/hosts_spec.rb +3 -5
- data/spec/logical_volume_spec.rb +42 -44
- data/spec/mountable_spec.rb +28 -30
- data/spec/partition_spec.rb +5 -7
- data/spec/physical_volume_spec.rb +25 -27
- data/spec/registration_system_spec.rb +8 -10
- data/spec/rhn_spec.rb +17 -19
- data/spec/rpm_spec.rb +17 -19
- data/spec/service_spec.rb +23 -25
- data/spec/spec_helper.rb +68 -14
- data/spec/subscription_manager_spec.rb +21 -23
- data/spec/system_spec.rb +2 -4
- data/spec/volume_group_spec.rb +18 -20
- data/spec/yum_spec.rb +27 -23
- metadata +19 -45
- data/spec/linux_admin_spec.rb +0 -4
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ae83085610c76ae512132f71299833426b68c566
|
4
|
+
data.tar.gz: 37a232193db39e75850aee03e397c87988a9b99f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 41b4c8a63752bcbcb11fdd9f20161847a861e88d2c86f4b1f34cf21238d5e069a04d8e6a498e53d0f1d7f1f3d844c9394100232137f24477ca8d44e1a09cb273
|
7
|
+
data.tar.gz: 7347bac8c99654f4a357907ca81deac4e7466d8b3b135ddaafa7fc7a1522727fa2a259c66d0bd2c2ce0d48b11340701f7bad978614ffa03de5c2a1b3c7bd80cd
|
data/README.md
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
# LinuxAdmin
|
2
|
-
|
3
|
-
[![
|
4
|
-
[![
|
5
|
-
[![
|
6
|
-
[![
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/linux_admin.svg)](http://badge.fury.io/rb/linux_admin)
|
4
|
+
[![Build Status](https://travis-ci.org/ManageIQ/linux_admin.svg)](https://travis-ci.org/ManageIQ/linux_admin)
|
5
|
+
[![Code Climate](http://img.shields.io/codeclimate/github/ManageIQ/linux_admin.svg)](https://codeclimate.com/github/ManageIQ/linux_admin)
|
6
|
+
[![Coverage Status](http://img.shields.io/coveralls/ManageIQ/linux_admin.svg)](https://coveralls.io/r/ManageIQ/linux_admin)
|
7
|
+
[![Dependency Status](https://gemnasium.com/ManageIQ/linux_admin.svg)](https://gemnasium.com/ManageIQ/linux_admin)
|
7
8
|
|
8
9
|
LinuxAdmin is a module to simplify management of linux systems.
|
9
10
|
It should be a single place to manage various system level configurations,
|
10
11
|
registration, updates, etc.
|
11
12
|
|
12
|
-
## Supported Rubies
|
13
|
-
* MRI 1.9
|
14
|
-
|
15
13
|
## Installation
|
16
14
|
|
17
15
|
Add this line to your application's Gemfile:
|
data/lib/linux_admin/distro.rb
CHANGED
@@ -53,11 +53,11 @@ class LinuxAdmin
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def detected_by_etc_release?
|
56
|
-
release_file && File.
|
56
|
+
release_file && File.exist?(release_file)
|
57
57
|
end
|
58
58
|
|
59
59
|
def command(name)
|
60
|
-
@path.collect { |dir| "#{dir}/#{name}" }.detect { |cmd| File.
|
60
|
+
@path.collect { |dir| "#{dir}/#{name}" }.detect { |cmd| File.exist?(cmd) }
|
61
61
|
end
|
62
62
|
|
63
63
|
def info(pkg)
|
data/lib/linux_admin/fstab.rb
CHANGED
@@ -11,11 +11,8 @@ class LinuxAdmin
|
|
11
11
|
|
12
12
|
DEVICE_PATH = Pathname.new('/dev/')
|
13
13
|
|
14
|
-
# path to logical volume
|
15
|
-
attr_accessor :path
|
16
|
-
|
17
14
|
# logical volume name
|
18
|
-
|
15
|
+
attr_reader :name
|
19
16
|
|
20
17
|
# volume group name
|
21
18
|
attr_accessor :volume_group
|
@@ -35,6 +32,11 @@ class LinuxAdmin
|
|
35
32
|
# major device number of logical volume
|
36
33
|
# minor device number of logical volume
|
37
34
|
|
35
|
+
# path to logical volume
|
36
|
+
def path
|
37
|
+
"/dev/#{self.volume_group.name}/#{self.name}"
|
38
|
+
end
|
39
|
+
|
38
40
|
def path=(value)
|
39
41
|
@path = value.include?(File::SEPARATOR) ? value : DEVICE_PATH.join(@volume_group.name, value)
|
40
42
|
end
|
@@ -57,10 +59,6 @@ class LinuxAdmin
|
|
57
59
|
self
|
58
60
|
end
|
59
61
|
|
60
|
-
def path
|
61
|
-
"/dev/#{self.volume_group.name}/#{self.name}"
|
62
|
-
end
|
63
|
-
|
64
62
|
private
|
65
63
|
|
66
64
|
def self.bytes_to_string(bytes)
|
@@ -7,7 +7,7 @@ class LinuxAdmin
|
|
7
7
|
|
8
8
|
def registered?
|
9
9
|
id = ""
|
10
|
-
if File.
|
10
|
+
if File.exist?(systemid_file)
|
11
11
|
xml = Nokogiri.XML(File.read(systemid_file))
|
12
12
|
id = xml.xpath('/params/param/value/struct/member[name="system_id"]/value/string').text
|
13
13
|
end
|
@@ -103,4 +103,4 @@ class LinuxAdmin
|
|
103
103
|
"/etc/sysconfig/rhn/systemid"
|
104
104
|
end
|
105
105
|
end
|
106
|
-
end
|
106
|
+
end
|
data/lib/linux_admin/version.rb
CHANGED
data/lib/linux_admin/volume.rb
CHANGED
@@ -10,9 +10,9 @@ class LinuxAdmin
|
|
10
10
|
def self.process_volume_display_line(line)
|
11
11
|
groups = VolumeGroup.scan
|
12
12
|
fields = line.split(':')
|
13
|
-
vgname = fields[1]
|
14
|
-
vg = groups.find { |
|
15
|
-
return fields, vg
|
13
|
+
vgname = fields[1]
|
14
|
+
vg = groups.find { |g| g.name == vgname }
|
15
|
+
return fields, vg
|
16
16
|
end
|
17
17
|
|
18
18
|
protected
|
data/lib/linux_admin/yum.rb
CHANGED
@@ -55,7 +55,12 @@ class LinuxAdmin
|
|
55
55
|
cmd = "yum -y update"
|
56
56
|
params = {nil => packages} unless packages.blank?
|
57
57
|
|
58
|
-
run!(cmd, :params => params)
|
58
|
+
out = run!(cmd, :params => params)
|
59
|
+
|
60
|
+
# Handle errors that exit 0 https://bugzilla.redhat.com/show_bug.cgi?id=1141318
|
61
|
+
raise AwesomeSpawn::CommandResultError.new(out.error, out) if out.error.include?("No Match for argument")
|
62
|
+
|
63
|
+
out
|
59
64
|
end
|
60
65
|
|
61
66
|
def self.version_available(*packages)
|
@@ -110,11 +115,11 @@ class LinuxAdmin
|
|
110
115
|
next if line.start_with?(index_start)
|
111
116
|
next if !collect_content
|
112
117
|
|
113
|
-
repo_id,
|
118
|
+
repo_id, _repo_name, _status = line.split(/\s{2,}/)
|
114
119
|
array.push(repo_id)
|
115
120
|
end
|
116
121
|
end
|
117
122
|
end
|
118
123
|
end
|
119
124
|
|
120
|
-
Dir.glob(File.join(File.dirname(__FILE__), "yum", "*.rb")).each { |f| require f }
|
125
|
+
Dir.glob(File.join(File.dirname(__FILE__), "yum", "*.rb")).each { |f| require f }
|
data/spec/common_spec.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
describe LinuxAdmin::Common do
|
4
2
|
subject { Class.new { include LinuxAdmin::Common }.new }
|
5
3
|
|
@@ -10,12 +8,12 @@ describe LinuxAdmin::Common do
|
|
10
8
|
end
|
11
9
|
|
12
10
|
it "#run" do
|
13
|
-
AwesomeSpawn.
|
11
|
+
expect(AwesomeSpawn).to receive(:run).with("echo", nil => "test")
|
14
12
|
subject.run("echo", nil => "test")
|
15
13
|
end
|
16
14
|
|
17
15
|
it "#run!" do
|
18
|
-
AwesomeSpawn.
|
16
|
+
expect(AwesomeSpawn).to receive(:run!).with("echo", nil => "test")
|
19
17
|
subject.run!("echo", nil => "test")
|
20
18
|
end
|
21
19
|
end
|
data/spec/deb_spec.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
describe LinuxAdmin::Deb do
|
4
2
|
describe "#info" do
|
5
3
|
it "returns package metadata" do
|
@@ -39,16 +37,16 @@ Origin: Ubuntu
|
|
39
37
|
Supported: 9m
|
40
38
|
Task: kubuntu-desktop, kubuntu-full, kubuntu-active, kubuntu-active-desktop, kubuntu-active-full, kubuntu-active, edubuntu-desktop-gnome, ubuntustudio-font-meta
|
41
39
|
EOS
|
42
|
-
described_class.
|
40
|
+
expect(described_class).to receive(:run!).
|
43
41
|
with(described_class::APT_CACHE_CMD, :params => ["show", "ruby"]).
|
44
42
|
and_return(double(:output => data))
|
45
43
|
metadata = described_class.info("ruby")
|
46
|
-
metadata['package'].
|
47
|
-
metadata['priority'].
|
48
|
-
metadata['section'].
|
49
|
-
metadata['architecture'].
|
50
|
-
metadata['version'].
|
51
|
-
metadata['origin'].
|
44
|
+
expect(metadata['package']).to eq('ruby')
|
45
|
+
expect(metadata['priority']).to eq('optional')
|
46
|
+
expect(metadata['section']).to eq('interpreters')
|
47
|
+
expect(metadata['architecture']).to eq('all')
|
48
|
+
expect(metadata['version']).to eq('4.9')
|
49
|
+
expect(metadata['origin']).to eq('Ubuntu')
|
52
50
|
end
|
53
51
|
end
|
54
52
|
end
|
data/spec/disk_spec.rb
CHANGED
@@ -1,21 +1,19 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
describe LinuxAdmin::Disk do
|
4
2
|
describe "#local" do
|
5
3
|
it "returns local disks" do
|
6
|
-
Dir.
|
4
|
+
expect(Dir).to receive(:glob).with(['/dev/[vhs]d[a-z]', '/dev/xvd[a-z]']).
|
7
5
|
and_return(['/dev/hda', '/dev/sda'])
|
8
6
|
disks = LinuxAdmin::Disk.local
|
9
7
|
paths = disks.collect { |disk| disk.path }
|
10
|
-
paths.
|
11
|
-
paths.
|
8
|
+
expect(paths).to include('/dev/hda')
|
9
|
+
expect(paths).to include('/dev/sda')
|
12
10
|
end
|
13
11
|
end
|
14
12
|
|
15
13
|
describe "#size" do
|
16
14
|
it "uses fdisk" do
|
17
15
|
disk = LinuxAdmin::Disk.new :path => '/dev/hda'
|
18
|
-
disk.
|
16
|
+
expect(disk).to receive(:run!).
|
19
17
|
with(disk.cmd(:fdisk),
|
20
18
|
:params => {"-l" => nil}).
|
21
19
|
and_return(double(:output => ""))
|
@@ -38,15 +36,15 @@ Disk identifier: 0x3ddb508b
|
|
38
36
|
eos
|
39
37
|
|
40
38
|
disk = LinuxAdmin::Disk.new :path => '/dev/hda'
|
41
|
-
disk.
|
42
|
-
disk.size.
|
39
|
+
allow(disk).to receive(:run!).and_return(double(:output => fdisk))
|
40
|
+
expect(disk.size).to eq(500.1.gigabytes)
|
43
41
|
end
|
44
42
|
end
|
45
43
|
|
46
44
|
describe "#partitions" do
|
47
45
|
it "uses parted" do
|
48
46
|
disk = LinuxAdmin::Disk.new :path => '/dev/hda'
|
49
|
-
disk.
|
47
|
+
expect(disk).to receive(:run).
|
50
48
|
with(disk.cmd(:parted),
|
51
49
|
:params => { nil => %w(--script /dev/hda print) }).and_return(double(:output => ""))
|
52
50
|
disk.partitions
|
@@ -54,8 +52,8 @@ eos
|
|
54
52
|
|
55
53
|
it "returns [] on non-zero parted rc" do
|
56
54
|
disk = LinuxAdmin::Disk.new :path => '/dev/hda'
|
57
|
-
disk.
|
58
|
-
disk.partitions.
|
55
|
+
expect(disk).to receive(:run).and_return(double(:output => "", :exit_status => 1))
|
56
|
+
expect(disk.partitions).to eq([])
|
59
57
|
end
|
60
58
|
|
61
59
|
it "sets partitons" do
|
@@ -72,29 +70,29 @@ Number Start End Size Type File system Flags
|
|
72
70
|
3 162GB 163GB 1074MB logical linux-swap(v1)
|
73
71
|
eos
|
74
72
|
disk = LinuxAdmin::Disk.new
|
75
|
-
disk.
|
76
|
-
|
77
|
-
disk.partitions[0].id.
|
78
|
-
disk.partitions[0].disk.
|
79
|
-
disk.partitions[0].size.
|
80
|
-
disk.partitions[0].start_sector.
|
81
|
-
disk.partitions[0].end_sector.
|
82
|
-
disk.partitions[0].partition_type.
|
83
|
-
disk.partitions[0].fs_type.
|
84
|
-
disk.partitions[1].id.
|
85
|
-
disk.partitions[1].disk.
|
86
|
-
disk.partitions[1].size.
|
87
|
-
disk.partitions[1].start_sector.
|
88
|
-
disk.partitions[1].end_sector.
|
89
|
-
disk.partitions[1].partition_type.
|
90
|
-
disk.partitions[1].fs_type.
|
91
|
-
disk.partitions[2].id.
|
92
|
-
disk.partitions[2].disk.
|
93
|
-
disk.partitions[2].size.
|
94
|
-
disk.partitions[2].start_sector.
|
95
|
-
disk.partitions[2].end_sector.
|
96
|
-
disk.partitions[2].partition_type.
|
97
|
-
disk.partitions[2].fs_type.
|
73
|
+
expect(disk).to receive(:run).and_return(double(:output => partitions))
|
74
|
+
|
75
|
+
expect(disk.partitions[0].id).to eq(1)
|
76
|
+
expect(disk.partitions[0].disk).to eq(disk)
|
77
|
+
expect(disk.partitions[0].size).to eq(80.5.gigabytes)
|
78
|
+
expect(disk.partitions[0].start_sector).to eq(1259.megabytes)
|
79
|
+
expect(disk.partitions[0].end_sector).to eq(81.8.gigabytes)
|
80
|
+
expect(disk.partitions[0].partition_type).to eq('primary')
|
81
|
+
expect(disk.partitions[0].fs_type).to eq('ntfs')
|
82
|
+
expect(disk.partitions[1].id).to eq(2)
|
83
|
+
expect(disk.partitions[1].disk).to eq(disk)
|
84
|
+
expect(disk.partitions[1].size).to eq(80.5.gigabytes)
|
85
|
+
expect(disk.partitions[1].start_sector).to eq(81.8.gigabytes)
|
86
|
+
expect(disk.partitions[1].end_sector).to eq(162.gigabytes)
|
87
|
+
expect(disk.partitions[1].partition_type).to eq('primary')
|
88
|
+
expect(disk.partitions[1].fs_type).to eq('ext4')
|
89
|
+
expect(disk.partitions[2].id).to eq(3)
|
90
|
+
expect(disk.partitions[2].disk).to eq(disk)
|
91
|
+
expect(disk.partitions[2].size).to eq(1074.megabytes)
|
92
|
+
expect(disk.partitions[2].start_sector).to eq(162.gigabytes)
|
93
|
+
expect(disk.partitions[2].end_sector).to eq(163.gigabytes)
|
94
|
+
expect(disk.partitions[2].partition_type).to eq('logical')
|
95
|
+
expect(disk.partitions[2].fs_type).to eq('linux-swap(v1)')
|
98
96
|
end
|
99
97
|
end
|
100
98
|
|
@@ -104,14 +102,14 @@ eos
|
|
104
102
|
end
|
105
103
|
|
106
104
|
it "dispatches to create_partition" do
|
107
|
-
@disk.
|
105
|
+
expect(@disk).to receive(:create_partition).with("primary", "0%", "50%")
|
108
106
|
@disk.create_partitions "primary", :start => "0%", :end => "50%"
|
109
107
|
end
|
110
108
|
|
111
109
|
context "multiple partitions specified" do
|
112
110
|
it "calls create_partition for each partition" do
|
113
|
-
@disk.
|
114
|
-
@disk.
|
111
|
+
expect(@disk).to receive(:create_partition).with("primary", "0%", "49%")
|
112
|
+
expect(@disk).to receive(:create_partition).with("primary", "50%", "100%")
|
115
113
|
@disk.create_partitions("primary", {:start => "0%", :end => "49%"},
|
116
114
|
{:start => "50%", :end => "100%"})
|
117
115
|
end
|
@@ -134,18 +132,18 @@ eos
|
|
134
132
|
@disk.instance_variable_set(:@partitions,
|
135
133
|
[LinuxAdmin::Partition.new(:id => 1,
|
136
134
|
:end_sector => 1024)])
|
137
|
-
@disk.
|
135
|
+
allow(@disk).to receive_messages(:has_partition_table? => true)
|
138
136
|
end
|
139
137
|
|
140
138
|
it "uses parted" do
|
141
139
|
params = ['--script', '/dev/hda', 'mkpart', '-a', 'opt', 'primary', 1024, 2048]
|
142
|
-
@disk.
|
140
|
+
expect(@disk).to receive(:run!).with(@disk.cmd(:parted), :params => { nil => params })
|
143
141
|
@disk.create_partition 'primary', 1024
|
144
142
|
end
|
145
143
|
|
146
144
|
it "accepts start/end params" do
|
147
145
|
params = ['--script', '/dev/hda', 'mkpart', '-a', 'opt', 'primary', "0%", "50%"]
|
148
|
-
@disk.
|
146
|
+
expect(@disk).to receive(:run!).with(@disk.cmd(:parted), :params => { nil => params })
|
149
147
|
@disk.create_partition 'primary', "0%", "50%"
|
150
148
|
end
|
151
149
|
|
@@ -162,34 +160,34 @@ eos
|
|
162
160
|
end
|
163
161
|
|
164
162
|
it "returns partition" do
|
165
|
-
@disk.
|
163
|
+
expect(@disk).to receive(:run!) # stub out call to parted
|
166
164
|
partition = @disk.create_partition 'primary', 1024
|
167
|
-
partition.
|
165
|
+
expect(partition).to be_an_instance_of(LinuxAdmin::Partition)
|
168
166
|
end
|
169
167
|
|
170
168
|
it "increments partition id" do
|
171
|
-
@disk.
|
169
|
+
expect(@disk).to receive(:run!) # stub out call to parted
|
172
170
|
partition = @disk.create_partition 'primary', 1024
|
173
|
-
partition.id.
|
171
|
+
expect(partition.id).to eq(2)
|
174
172
|
end
|
175
173
|
|
176
174
|
it "sets partition start to first unused sector on disk" do
|
177
|
-
@disk.
|
175
|
+
expect(@disk).to receive(:run!) # stub out call to parted
|
178
176
|
partition = @disk.create_partition 'primary', 1024
|
179
|
-
partition.start_sector.
|
177
|
+
expect(partition.start_sector).to eq(1024)
|
180
178
|
end
|
181
179
|
|
182
180
|
it "stores new partition locally" do
|
183
|
-
@disk.
|
184
|
-
|
181
|
+
expect(@disk).to receive(:run!) # stub out call to parted
|
182
|
+
expect {
|
185
183
|
@disk.create_partition 'primary', 1024
|
186
|
-
}.
|
184
|
+
}.to change{@disk.partitions.size}.by(1)
|
187
185
|
end
|
188
186
|
|
189
187
|
it "creates partition table if missing" do
|
190
|
-
@disk.
|
191
|
-
@disk.
|
192
|
-
@disk.
|
188
|
+
allow(@disk).to receive_messages(:has_partition_table? => false)
|
189
|
+
expect(@disk).to receive(:create_partition_table)
|
190
|
+
expect(@disk).to receive(:run!)
|
193
191
|
@disk.create_partition 'primary', 1024
|
194
192
|
end
|
195
193
|
end
|
@@ -197,39 +195,39 @@ eos
|
|
197
195
|
describe "#has_partition_table?" do
|
198
196
|
it "positive case" do
|
199
197
|
disk = LinuxAdmin::Disk.new :path => '/dev/hda'
|
200
|
-
disk.
|
201
|
-
disk.
|
198
|
+
expect(disk).to receive(:run).and_return(double(:output => "", :exit_status => 0))
|
199
|
+
expect(disk).to have_partition_table
|
202
200
|
end
|
203
201
|
|
204
202
|
it "negative case" do
|
205
203
|
disk = LinuxAdmin::Disk.new :path => '/dev/hda'
|
206
204
|
output = "\e[?1034h\r\rError: /dev/sdb: unrecognised disk label\n"
|
207
|
-
disk.
|
208
|
-
disk.
|
205
|
+
expect(disk).to receive(:run).and_return(double(:output => output, :exit_status => 1))
|
206
|
+
expect(disk).not_to have_partition_table
|
209
207
|
end
|
210
208
|
end
|
211
209
|
|
212
210
|
it "#create_partition_table" do
|
213
211
|
disk = LinuxAdmin::Disk.new :path => '/dev/hda'
|
214
212
|
options = {:params => {nil => %w(--script /dev/hda mklabel msdos)}}
|
215
|
-
disk.
|
213
|
+
expect(disk).to receive(:run!).with(disk.cmd(:parted), options)
|
216
214
|
disk.create_partition_table
|
217
215
|
end
|
218
216
|
|
219
217
|
describe "#clear!" do
|
220
218
|
it "clears partitions" do
|
221
219
|
disk = LinuxAdmin::Disk.new :path => '/dev/hda'
|
222
|
-
disk.
|
220
|
+
expect(disk).to receive(:run).and_return(double(:output => "")) # stub out call to cmds
|
223
221
|
disk.partitions << LinuxAdmin::Partition.new
|
224
222
|
|
225
|
-
disk.
|
223
|
+
expect(disk).to receive(:run!)
|
226
224
|
disk.clear!
|
227
|
-
disk.partitions.
|
225
|
+
expect(disk.partitions).to be_empty
|
228
226
|
end
|
229
227
|
|
230
228
|
it "uses dd to clear partition table" do
|
231
229
|
disk = LinuxAdmin::Disk.new :path => '/dev/hda'
|
232
|
-
disk.
|
230
|
+
expect(disk).to receive(:run!).
|
233
231
|
with(disk.cmd(:dd),
|
234
232
|
:params => {'if=' => '/dev/zero', 'of=' => '/dev/hda',
|
235
233
|
'bs=' => 512, 'count=' => 1})
|
@@ -238,8 +236,8 @@ eos
|
|
238
236
|
|
239
237
|
it "returns self" do
|
240
238
|
disk = LinuxAdmin::Disk.new :path => '/dev/hda'
|
241
|
-
disk.
|
242
|
-
disk.clear
|
239
|
+
allow(disk).to receive(:run!) # stub out call to dd
|
240
|
+
expect(disk.clear!).to eq(disk)
|
243
241
|
end
|
244
242
|
end
|
245
243
|
|