kanrisuru 0.8.0 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f5fe692ff53ac4de87ca38181765a63cf88f0beab4e44145c780ba9af934ede
4
- data.tar.gz: 58acc02d34aff916670ab26c9659f7e40205d31492ec5f043ea51487df33cb62
3
+ metadata.gz: f7548306bf7e81fd29f475dfef82c4b8f0973448f22f3cb8882518ace8e70389
4
+ data.tar.gz: c069633d4408c38333cd3dacfade92678f0309a1b53e435238d6f0814598ec73
5
5
  SHA512:
6
- metadata.gz: e2b8134ef2351a86f88286a7ed50a1f768510c75f65ecbf9d9684f376606b46ea023f1b78723ae550183c7606e230d7152614d263b19f1a31c6bf6fe0cfa2cc3
7
- data.tar.gz: f7382ab716a20185ec071f96b6793afa7fcc1e11d32a0dd3174455cb7a5ba19d3fb61aa0fbb7d5574f26af36d983b3fae4ee9ec5757f16ef2a21edc43d5d83cd
6
+ metadata.gz: fbd31bc19b021a3d904b8a9c3d167921a47c709ca05b0590fa1dab5d0032181d454b7da0572760cfebe36286456e3a10547bb14bd6fb60c71413de533daa48a8
7
+ data.tar.gz: '0710940fec60fab2802a9810d6b5a6bb48f575c8ef8661c2447fbe8dc445ac68a3fb174ed1dd6413689439303983ee229e2ebb08cc1b1c0e68007db3346c2219'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## Kanrisuru 0.8.4 (August 20, 2021) ##
2
+ * Convert `fsize` field to an `integer` for du disk module command.
3
+
4
+ ## Kanrisuru 0.8.3 (August 20, 2021) ##
5
+ * Fix bug with disk usage, `du` command by escaping the awk variables in the command.
6
+ * Update `du` command to execute with shell user.
7
+
8
+ ## Kanrisuru 0.8.2 (August 19, 2021) ##
9
+ * Convert `major` and `minor` device field values to an `integer` in lsblk disk module.
10
+
11
+ ## Kanrisuru 0.8.1 (August 19, 2021) ##
12
+ * Fix `nodeps` flag value for `lsblk` command in disk module.
13
+
1
14
  ## Kanrisuru 0.8.0 (August 18, 2021) ##
2
15
  * Add last / lastb implementation in system core module.
3
16
 
@@ -31,9 +31,9 @@ module Kanrisuru
31
31
 
32
32
  command = Kanrisuru::Command.new('du')
33
33
  command.append_arg('-s', path)
34
- command | "awk '{print $1, $2}'"
34
+ command | "awk '{print \\$1, \\$2}'"
35
35
 
36
- execute(command)
36
+ execute_shell(command)
37
37
 
38
38
  Kanrisuru::Result.new(command) do |cmd|
39
39
  string = cmd.to_s
@@ -41,7 +41,8 @@ module Kanrisuru
41
41
 
42
42
  rows.map do |row|
43
43
  values = row.split
44
- size = convert ? Kanrisuru::Util::Bits.convert_bytes(values[0], :byte, convert) : values[0]
44
+ size = values[0].to_i
45
+ size = convert ? Kanrisuru::Util::Bits.convert_bytes(size, :byte, convert) : size
45
46
 
46
47
  DiskUsage.new(size, values[1])
47
48
  end
@@ -144,7 +145,7 @@ module Kanrisuru
144
145
 
145
146
  command.append_flag('-a', all)
146
147
  command.append_flag('-p', paths)
147
- command.append_flag('-p', nodeps)
148
+ command.append_flag('-d', nodeps)
148
149
 
149
150
  command.append_arg('-o', 'NAME,FSTYPE,MAJ:MIN,MOUNTPOINT,SIZE,UUID,RO,RM,OWNER,GROUP,MODE,TYPE')
150
151
  execute(command)
@@ -244,8 +245,8 @@ module Kanrisuru
244
245
  current_device.fs_type = value
245
246
  when 'MAJ:MIN'
246
247
  maj, min = value.split(':')
247
- current_device.maj_dev = maj
248
- current_device.min_dev = min
248
+ current_device.maj_dev = maj ? maj.to_i : nil
249
+ current_device.min_dev = min ? min.to_i : nil
249
250
  when 'MOUNTPOINT'
250
251
  current_device.mount_point = value
251
252
  when 'SIZE'
@@ -281,8 +282,8 @@ module Kanrisuru
281
282
 
282
283
  LsblkDevice.new(
283
284
  device['name'],
284
- maj_min ? maj_min.split(':')[0] : nil,
285
- maj_min ? maj_min.split(':')[1] : nil,
285
+ maj_min ? maj_min.split(':')[0].to_i : nil,
286
+ maj_min ? maj_min.split(':')[1].to_i : nil,
286
287
  device['rm'],
287
288
  device['ro'],
288
289
  device['owner'],
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kanrisuru
4
- VERSION = '0.8.0'
4
+ VERSION = '0.8.4'
5
5
  end
@@ -65,6 +65,13 @@ RSpec.describe Kanrisuru::Core::Disk do
65
65
  expect(result[0].path).to eq("#{host_json['home']}/.bashrc")
66
66
  end
67
67
 
68
+ it 'gets disk usage root' do
69
+ host.su('root')
70
+ result = host.du(path: '/etc')
71
+ expect(result).to be_success
72
+ expect(result[0].path).to eq("/etc")
73
+ end
74
+
68
75
  it 'gets disk free for system' do
69
76
  expect(host.df.data).to be_instance_of(Array)
70
77
  expect(host.df(inodes: true).data).to be_instance_of(Array)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kanrisuru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Mammina
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-18 00:00:00.000000000 Z
11
+ date: 2021-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec