kanrisuru 0.3.2 → 0.4.0

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: 11e237cfa6bdcf5f231733fab93be901be7a6d53ed673eb2feeb54ae4baf2b14
4
- data.tar.gz: 79e61aafc54f47534a79600ac60a93ec0b9dd82033a2875f84d6ee339ae8fec1
3
+ metadata.gz: 5d0fc79a97a3eebddc661982ea4a728af94aded3dbcf5bd5d7d8b0c03e9f5aaf
4
+ data.tar.gz: a37a3d8a00941a4842f3ce0502a1e88fe9ff50343c095f55094dc528f4bddfa4
5
5
  SHA512:
6
- metadata.gz: f762e2d07da08086f33ff878652d3f459a5cfcc7e76fdaeebfbfc0c37d827953ba20536bb6e714b751809505961ebd657716bde47af6d2c0975852d5772d6f03
7
- data.tar.gz: b4a05943b967a4ddddcc0b29c2036a50997463279dee649831efb64f775aabdf0fa384f03732fa06d0cbcb07e061f59c9046b4e812b1e8faed218a12677b36ad
6
+ metadata.gz: 34521c6c7ed22da194e55037a4c9653717176e1b6526e79c272107fe57c711e5ffbd8a377c48df8008492910297bbe102d21713c41e5c33635264f32c3c5c231
7
+ data.tar.gz: f620bb3a94944cee7c08f0634d43c7b00a4bf00e9c3b64ac13a0934cf8afe01af3439b67dd2d563cecb5134084b2eb9b8845835e22959d00a3639251ffb15f1e
@@ -6,12 +6,13 @@ module Kanrisuru
6
6
  attr_writer :remote_user, :remote_shell, :remote_path, :remote_env
7
7
 
8
8
  def initialize(command)
9
+ @valid_exit_codes = [0]
9
10
  @raw_command = command
10
11
  @raw_result = []
11
12
  end
12
13
 
13
14
  def success?
14
- @exit_status&.zero?
15
+ @valid_exit_codes.include?(@exit_status)
15
16
  end
16
17
 
17
18
  def failure?
@@ -45,8 +46,7 @@ module Kanrisuru
45
46
  end
46
47
 
47
48
  env = @remote_env && !@remote_env.empty? ? "#{@remote_env} " : ''
48
-
49
- "#{env}sudo -u #{@remote_user} #{@remote_shell} -c -l \"#{evaluate}\""
49
+ "#{env}sudo -u #{@remote_user} #{@remote_shell} -c \"#{evaluate}\""
50
50
  else
51
51
  @raw_command
52
52
  end
@@ -95,5 +95,10 @@ module Kanrisuru
95
95
  def append_flag(arg, boolean = 'true')
96
96
  @raw_command = Kanrisuru::Util.present?(boolean) ? "#{@raw_command} #{arg}" : @raw_command
97
97
  end
98
+
99
+ def append_valid_exit_code(code)
100
+ @valid_exit_codes << code if code.instance_of?(Integer)
101
+ @valid_exit_codes.concat(code) if code.instance_of?(Array)
102
+ end
98
103
  end
99
104
  end
@@ -44,7 +44,6 @@ module Kanrisuru
44
44
  date = DateTime.parse("#{values[6]} #{values[7]} #{values[8]}")
45
45
 
46
46
  type = values[1].include?('d') ? 'directory' : 'file'
47
-
48
47
  items <<
49
48
  if id
50
49
  FileInfoId.new(
@@ -99,6 +99,10 @@ module Kanrisuru
99
99
  @cpu_architecture.virtualization_type
100
100
  end
101
101
 
102
+ def flags
103
+ @cpu_architecture.flags
104
+ end
105
+
102
106
  def hyperthreading?
103
107
  threads_per_core > 1
104
108
  end
@@ -16,7 +16,7 @@ module Kanrisuru
16
16
  @username = opts[:username]
17
17
  @login_user = @username
18
18
 
19
- @port = opts[:port]
19
+ @port = opts[:port] || 22
20
20
  @password = opts[:password] if opts[:password]
21
21
  @keys = opts[:keys] if opts[:keys]
22
22
  @shell = opts[:shell] || '/bin/bash'
@@ -84,7 +84,7 @@ module Kanrisuru
84
84
  end
85
85
 
86
86
  def ssh
87
- @ssh ||= Net::SSH.start(@host, @username, keys: @keys, password: @password)
87
+ @ssh ||= Net::SSH.start(@host, @username, keys: @keys, password: @password, port: @port)
88
88
  end
89
89
 
90
90
  def ping?
@@ -186,7 +186,7 @@ module Kanrisuru
186
186
  model: 'open_source',
187
187
  state: 'current',
188
188
  type: 'distribution'
189
- },
189
+ }
190
190
  }
191
191
 
192
192
  def self.family_include_distribution?(family, dist)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kanrisuru
4
- VERSION = '0.3.2'
4
+ VERSION = '0.4.0'
5
5
  end
@@ -24,7 +24,7 @@ RSpec.describe Kanrisuru::Remote::Os do
24
24
 
25
25
  case os_name
26
26
  when 'opensuse'
27
- expect(host.os.release).to eq('opensuse-leap')
27
+ expect(host.os.release).to eq('opensuse_leap')
28
28
  else
29
29
  expect(host.os.release).to eq(os_name)
30
30
  end
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.3.2
4
+ version: 0.4.0
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-07-23 00:00:00.000000000 Z
11
+ date: 2021-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec