floatyhelper 2.0.4 → 2.0.5

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: 4b180846de407899145d32783fbab1321b931441adc29303fc6f6652dcf074a9
4
- data.tar.gz: 0470b598bae65a844467a8a873f16fb02540637aea45f74b6c45526d6ae7c069
3
+ metadata.gz: 1829fb78be42701872cbbc6e8960ab3e3ebcd8c20b4b5983a32111e5ee2a7b1c
4
+ data.tar.gz: 551dfec7ca2c9f64d1f975b6c202882de69b8e09f4cd06d66a50e55623a5d680
5
5
  SHA512:
6
- metadata.gz: 67131dfaa118a90be128166ff43d67bb3e2315c3012058d74b4d8e46431877a9113a9be88c0fc48caab6e5b6427c516f41e6d9325b8f230eaca186cf8f03c27d
7
- data.tar.gz: 4373c7403986df1fdf8e02b196996ef403beefd9180ea786d9adbc9906dc6d008b449dfca49870460df6db360e56e3ff2afc4ccc449e71d3c317d5ba938b3ef8
6
+ metadata.gz: 5300396a677ea5076639329b4d7fc5cf5ec07c267ad59c840d782f4f997484a704b0e4cfdccfb1b64c1c6ef1937a58d287ce1832936ed6cfeb71d5403e0a335b
7
+ data.tar.gz: 91aec17eede5c0241b47e96653556580d476ebe17bdd8d0caae7df0b8f51094917b484f5b3e8c504b8b6669929da333f4bbdde7c1c3c9809965c487d3bce446b
@@ -127,37 +127,24 @@ class Floaty
127
127
  if use_pty
128
128
  output = ''
129
129
  status = nil
130
- PTY.spawn("/usr/bin/env floaty #{command}") do |read, write, pid|
131
- write.close
132
- while status.nil?
133
- begin
134
- line = read.gets
135
- unless line.nil?
136
- puts line
137
- output += line
138
- end
139
- rescue EOFError, Errno::EIO
140
- # GNU/Linux raises EIO on read operation when pty is closed - see pty.rb docs
141
- # Ensure child process finishes and then pass through to ensure below to get status
142
- nil
143
- rescue IO::WaitReadable, IO::WaitWritable
144
- retry
145
- ensure
146
- status ||= PTY.check(pid)
130
+ IO.popen("/usr/bin/env floaty #{command}", :err => [:child, :out]) do |io|
131
+ while !Process.waitpid(io.pid, Process::WNOHANG)
132
+ line = io.gets
133
+ unless line.nil?
134
+ puts line
135
+ output += line
147
136
  end
148
137
  end
149
-
150
- Process.waitall
151
- # Double check we have the status
152
- status ||= PTY.check(pid)
153
138
  end
139
+ # Need to check exit status
140
+ output
154
141
  else
155
142
  output, status = Open3.capture2e("/usr/bin/env floaty #{command}")
143
+ if !status.exitstatus.zero? && !ignore_error
144
+ puts "Error running 'floaty #{command}': #{output}".red
145
+ exit status.exitstatus
146
+ end
147
+ output
156
148
  end
157
- if !status.exitstatus.zero? && !ignore_error
158
- puts "Error running 'floaty #{command}': #{output}".red
159
- exit status.exitstatus
160
- end
161
- output
162
149
  end
163
150
  end
@@ -1,3 +1,3 @@
1
1
  module FloatyhelperVersion
2
- VERSION = '2.0.4'.freeze
2
+ VERSION = '2.0.5'.freeze
3
3
  end
@@ -162,7 +162,10 @@ class VM
162
162
  def self.get_vm(platform: 'centos-7-x86_64', force_abs: false)
163
163
  if !find_pooled_platforms.include?(platform.gsub('-pixa4','')) || force_abs
164
164
  response = Floaty.floaty_cmd("get #{platform} --service abs --priority 1", use_pty: true)
165
- response.chomp.split('- ')[1].split[0].split('.')[0]
165
+ vmlinesplit = response.chomp.split('- ')
166
+ # When use_pty is true, we've already printed stderr/stdout, so no need to do so again.
167
+ raise "Error obtaining a VM" if vmlinesplit.count == 1
168
+ vmlinesplit[1].split[0].split('.')[0]
166
169
  else
167
170
  response = Floaty.floaty_cmd("get #{platform} --service vmpooler")
168
171
  raise "Error obtaining a VM: #{response}" if response.include?('error')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: floatyhelper
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Burgan-Illig
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-09 00:00:00.000000000 Z
11
+ date: 2021-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -203,8 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
203
  - !ruby/object:Gem::Version
204
204
  version: '0'
205
205
  requirements: []
206
- rubyforge_project:
207
- rubygems_version: 2.7.6
206
+ rubygems_version: 3.1.2
208
207
  signing_key:
209
208
  specification_version: 4
210
209
  summary: CLI tool for manipulating Puppet's vmpooler VMs with Vmfloaty.