floatyhelper 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/floatyhelper/floaty.rb +13 -26
- data/lib/floatyhelper/version.rb +1 -1
- data/lib/floatyhelper/vm.rb +4 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1829fb78be42701872cbbc6e8960ab3e3ebcd8c20b4b5983a32111e5ee2a7b1c
|
4
|
+
data.tar.gz: 551dfec7ca2c9f64d1f975b6c202882de69b8e09f4cd06d66a50e55623a5d680
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5300396a677ea5076639329b4d7fc5cf5ec07c267ad59c840d782f4f997484a704b0e4cfdccfb1b64c1c6ef1937a58d287ce1832936ed6cfeb71d5403e0a335b
|
7
|
+
data.tar.gz: 91aec17eede5c0241b47e96653556580d476ebe17bdd8d0caae7df0b8f51094917b484f5b3e8c504b8b6669929da333f4bbdde7c1c3c9809965c487d3bce446b
|
data/lib/floatyhelper/floaty.rb
CHANGED
@@ -127,37 +127,24 @@ class Floaty
|
|
127
127
|
if use_pty
|
128
128
|
output = ''
|
129
129
|
status = nil
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
line
|
135
|
-
|
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
|
data/lib/floatyhelper/version.rb
CHANGED
data/lib/floatyhelper/vm.rb
CHANGED
@@ -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('- ')
|
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
|
+
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-
|
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
|
-
|
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.
|