miab 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: ced57340f07efffc93c646a147121deb9a1fbb8d037aaa37ba2eb3203fc69573
4
- data.tar.gz: 3ff78cd963d512efa0528cbee9456b8efed970a943698db326bf3ff95717a60d
3
+ metadata.gz: a339ac7a434f6d8f59cfacb59a5f70e56c4cbe490712a9ec70bec7992cae9036
4
+ data.tar.gz: f44e1bf9f71fe2fc250841c9b69ae4eb62a69176bff014bc8293f23c17b6cf35
5
5
  SHA512:
6
- metadata.gz: 0ee3e715313c423032f22db63c8f9e8a21bd33877960abdcea64ba22b2ab44d5cd5de5519c485895af819d0590f79e0082d584d4cadf3ee88532ccbd605ab129
7
- data.tar.gz: a8aae9b45ea47714cc4ca79562d5c904ee1592b8daa73989191ae22500a8185af3c7bd611e618610d04fa037a3622d738e6b27e8bed3c2138ecf8aee7543b838
6
+ metadata.gz: 42d047bc15e959ff24b194063547065875d495f23ccd09f5e7d0f607f326f6a5f9aeef0894c9f90d5459bcc64453d1abdfe5d8031bb8e5389e68181343ef525c
7
+ data.tar.gz: c390aebd8577fcbba6569549a69358c673bd85e44ac1b1f5f49fcd904885af78084a0aa76b478796adfcf7a7097af48514b8d5a48ba5f9283473b0994914d3ed
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -14,6 +14,7 @@ require 'resolv'
14
14
 
15
15
  # available commands:
16
16
  #
17
+ # * backup - initiates rsync on the remote machine to be backed up
17
18
  # * date - returns the system date and time
18
19
  # * directory_exists? - returns true if the directory exists
19
20
  # * disk_space - returns the available disk space
@@ -53,6 +54,31 @@ class Miab
53
54
 
54
55
  protected
55
56
 
57
+ # backup
58
+ # e.g. from: /mnt/usbdisk/gem_src/.
59
+ # to: pi@192.168.4.158:backup2020/gem_src/.
60
+ #
61
+ def backup(from: nil, to: nil)
62
+
63
+ if @debug then
64
+ puts 'ready to perform backup'
65
+ puts "from: %s to: %s" % [from, to]
66
+ end
67
+
68
+ instructions = "rsync -akL -e ssh %s %s" % [from, to]
69
+
70
+ puts 'instructions: ' + instructions if @debug
71
+
72
+ # note: compression is not enabled since this is aimed at
73
+ # single board computers which have limited CPU capability
74
+
75
+ r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`
76
+ puts 'r: ' + r.inspect if @debug
77
+
78
+ # since it's running in the background, an empty string will be returned
79
+
80
+ end
81
+
56
82
  # return the local date and time
57
83
  #
58
84
  def date()
@@ -122,6 +148,15 @@ class Miab
122
148
 
123
149
  end
124
150
 
151
+ def exec_success?(instruction, expected)
152
+
153
+ r = @ssh ? @ssh.exec!(instruction) : `#{instruction}`
154
+ puts 'r: ' + r.inspect if @debug
155
+
156
+ @results[:exec_success?] = (r =~ /#{expected}/ ? true : r)
157
+
158
+ end
159
+
125
160
  def file_exists?(file)
126
161
 
127
162
  instructions = "test -f #{file}; echo $?"
@@ -276,6 +311,8 @@ class Miab
276
311
  @scroll, @debug, @dns = scroll, debug, dns
277
312
 
278
313
  puts '@dns: ' + @dns.inspect if @debug
314
+
315
+ target = [target] if target.is_a? String
279
316
 
280
317
  @nodes = if target then
281
318
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miab
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
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  9irKsAp/hZt3dTbQOtnSlc9XREZZdegwOgu1FEqBqviNIn9R28OR237HExiWXwmw
36
36
  HDTFIjk8XBqTunABuFUgr4qx
37
37
  -----END CERTIFICATE-----
38
- date: 2019-11-26 00:00:00.000000000 Z
38
+ date: 2020-08-27 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: net-ssh
@@ -43,20 +43,20 @@ dependencies:
43
43
  requirements:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 5.2.0
46
+ version: 6.1.0
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '5.2'
49
+ version: '6.1'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 5.2.0
56
+ version: 6.1.0
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '5.2'
59
+ version: '6.1'
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: c32
62
62
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file