takelage 0.28.24 → 0.28.26

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: 1a283a1e76877049cf7645c703c6bf2b17dcc3c7c13c1a5cac363441202f91b1
4
- data.tar.gz: a53eb5c037d97b88d99e8bc4b9e9d5db17a2eb30b15fa993ac6a70924d5f9a36
3
+ metadata.gz: c5b24cafbddb28d0bc465c9b464a02d6d08c14639dfe5c58cc891828680143dc
4
+ data.tar.gz: 7743c6e2f629e35838820ab439c72a6b659c674f852fe7a114e9016d771011af
5
5
  SHA512:
6
- metadata.gz: '05921e675c4136d159cf1e3e4e3774ea0e39a23bd4add0d4a0ce955b6e34806577ab63ddc9d14797799439e4abdde303b86471ef94c6a98ad24e196194e65416'
7
- data.tar.gz: f0eb22800596daaefc3e6a8b2ccd9ea8df1d17e3ec547165bd795c98eedf06f02f310339406d6afb0164390b4fed7c88bc4b8b804b8f13c0db68f9665e33f3aa
6
+ metadata.gz: 4135b0857fbbff72ce697309745232b1433352cd7b3a884486044aa761b9a66f15b29ab896a5406cabab35c1b8c941fed2c91c0d2344bd604cbde99ef22fbb5f
7
+ data.tar.gz: 773c9fdfa99690acc118f837ddbdc343e51f1962f05bd740c312ae7b125713734eb1b591c2f411499f76728e009bc4b175ec128747319a53b614ff88b5c7e071
@@ -77,6 +77,19 @@ module SystemModule
77
77
  stdout_str
78
78
  end
79
79
 
80
+ # Run a command and return the standard output
81
+ # the standard error and the exit status
82
+ # @return [[String, String, Integer]] array of
83
+ # stdout, stderr, exitstatus of command
84
+ def run_and_capture(command)
85
+ log.debug "Running amd capturing command \"#{command}\""
86
+ stdout_str, stderr_str, status = Open3.capture3 command
87
+ log.debug "Command \"#{command}\" has stdout:\n\"\"\"\n#{stdout_str}\"\"\""
88
+ log.debug "Command \"#{command}\" has stderr:\n\"\"\"\n#{stderr_str}\"\"\""
89
+ log.debug "Command \"#{command}\" has exit status: \"#{status.exitstatus}\""
90
+ [stdout_str, stderr_str, status.exitstatus]
91
+ end
92
+
80
93
  # Use Kernel#exec to replace the ruby process with a command.
81
94
  def run_and_exit(command)
82
95
  log.debug "Running command \"#{command}\" and exiting afterwards"
@@ -41,14 +41,28 @@ module MutagenCheckDaemon
41
41
  private
42
42
 
43
43
  # Check mutagen host connection
44
+ # rubocop:disable Metrics/MethodLength
44
45
  def _mutagen_check_daemon_host_connection
45
46
  check_host_connection = format(
46
47
  config.active['cmd_mutagen_check_daemon_host_connection'],
47
48
  hostlabel: @hostlabel
48
49
  )
49
- host_connection = try check_host_connection
50
- host_connection.exitstatus.zero?
50
+ stdout, _, exitstatus = run_and_capture check_host_connection
51
+
52
+ unless exitstatus.zero?
53
+ log.debug 'There is no mutagen forward connection to the host'
54
+ return false
55
+ end
56
+
57
+ unless stdout.include? 'Status: Forwarding connections'
58
+ log.debug 'The mutagen forward connection to the host ' \
59
+ 'is not forwarding connections'
60
+ return false
61
+ end
62
+
63
+ true
51
64
  end
65
+ # rubocop:enable Metrics/MethodLength
52
66
 
53
67
  # Check mutagen version
54
68
  def _mutagen_check_daemon_version
data/lib/takelage/version CHANGED
@@ -1 +1 @@
1
- 0.28.24
1
+ 0.28.26
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: takelage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.24
4
+ version: 0.28.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geospin