This commit is contained in:
Gene Liverman 2021-03-10 20:04:57 +01:00 committed by GitHub
commit 9e8645ac6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 63 additions and 0 deletions

View file

@ -14,6 +14,7 @@ require 'vmfloaty/utils'
require 'vmfloaty/service'
require 'vmfloaty/ssh'
require 'vmfloaty/logger'
require 'vmfloaty/otel'
class Vmfloaty
include Commander::Methods
@ -50,6 +51,8 @@ class Vmfloaty
use_token = !options.notoken
force = options.force
Otel.configure_tracing(service)
if args.empty?
FloatyLogger.error 'No operating systems provided to obtain. See `floaty get --help` for more information on how to get VMs.'
exit 1
@ -107,6 +110,8 @@ class Vmfloaty
service = Service.new(options, config)
filter = args[0]
Otel.configure_tracing(service)
if options.active
# list active vms
if service.type == "ABS"
@ -155,6 +160,8 @@ class Vmfloaty
service = Service.new(options, config)
hostname = args[0]
Otel.configure_tracing(service)
query_req = service.query(verbose, hostname)
pp query_req
end
@ -180,6 +187,8 @@ class Vmfloaty
hostname = args[0]
modify_all = options.all
Otel.configure_tracing(service)
if hostname.nil? && !modify_all
FloatyLogger.error 'ERROR: Provide a hostname or specify --all.'
exit 1
@ -250,6 +259,8 @@ class Vmfloaty
delete_all = options.all
force = options.f
Otel.configure_tracing(service)
failures = []
successes = []
@ -338,6 +349,8 @@ class Vmfloaty
service = Service.new(options, config)
hostname = args[0]
Otel.configure_tracing(service)
begin
snapshot_req = service.snapshot(verbose, hostname)
rescue TokenError, ModifyError => e
@ -366,6 +379,8 @@ class Vmfloaty
hostname = args[0]
snapshot_sha = args[1] || options.snapshot
Otel.configure_tracing(service)
FloatyLogger.info "Two snapshot arguments were given....using snapshot #{snapshot_sha}" if args[1] && options.snapshot
begin
@ -395,6 +410,9 @@ class Vmfloaty
FloatyLogger.setlevel = options.loglevel
end
service = Service.new(options, config)
Otel.configure_tracing(service)
if options.json
pp service.status(verbose)
else
@ -415,6 +433,8 @@ class Vmfloaty
verbose = options.verbose || config['verbose']
service = Service.new(options, config)
Otel.configure_tracing(service)
summary = service.summary(verbose)
pp summary
exit 0
@ -436,6 +456,8 @@ class Vmfloaty
service = Service.new(options, config)
action = args.first
Otel.configure_tracing(service)
begin
case action
when 'get'
@ -480,6 +502,8 @@ class Vmfloaty
service = Service.new(options, config)
use_token = !options.notoken
Otel.configure_tracing(service)
if args.empty?
FloatyLogger.error 'No operating systems provided to obtain. See `floaty ssh --help` for more information on how to get VMs.'
exit 1