Skip to content

(maint) Fix using ABS service without a .vmfloaty.yml file#88

Merged
mattkirby merged 1 commit into
puppetlabs:masterfrom
cthorn42:maint/master/no_config_file_non_vmpooler_service_fix
Aug 20, 2020
Merged

(maint) Fix using ABS service without a .vmfloaty.yml file#88
mattkirby merged 1 commit into
puppetlabs:masterfrom
cthorn42:maint/master/no_config_file_non_vmpooler_service_fix

Conversation

@cthorn42

Copy link
Copy Markdown

If you do not use a config file, and define everything on the command line,
previously the service always defaulted to vmpooler. Even if you requested ABS.
This PR fixes that, now we'll see if the config has no service defined and we
defined on the command line a service, we'll use that service.

Reviewers

@puppetlabs/dio
@highb
@briancain

@cthorn42 cthorn42 requested review from a team, briancain and highb as code owners August 20, 2020 16:34
@cthorn42

cthorn42 commented Aug 20, 2020

Copy link
Copy Markdown
Author

With current vmfloaty trying to use ABS and no config file fails:

floaty get --service=abs --user=chirstopher.thorn --token=<cut out> centos-7-x86_64 --url=https://cinext-abs.delivery.puppetlabs.net/api/v2 --trace

WARNING: There was no config file at /Users/cthorn/.vmfloaty.yml
Traceback (most recent call last):
	11: from /Users/cthorn/repo/vmfloaty/bin/floaty:8:in `<main>'
	10: from /Users/cthorn/repo/vmfloaty/lib/vmfloaty.rb:462:in `run'
	 9: from /Users/cthorn/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/commander-4.5.2/lib/commander/delegates.rb:15:in `run!'
	 8: from /Users/cthorn/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/commander-4.5.2/lib/commander/runner.rb:68:in `run!'
	 7: from /Users/cthorn/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/commander-4.5.2/lib/commander/runner.rb:452:in `run_active_command'
	 6: from /Users/cthorn/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/commander-4.5.2/lib/commander/command.rb:155:in `run'
	 5: from /Users/cthorn/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/commander-4.5.2/lib/commander/command.rb:184:in `call'
	 4: from /Users/cthorn/repo/vmfloaty/lib/vmfloaty.rb:68:in `block (2 levels) in run'
	 3: from /Users/cthorn/repo/vmfloaty/lib/vmfloaty/service.rb:81:in `retrieve'
	 2: from /Users/cthorn/repo/vmfloaty/lib/vmfloaty/pooler.rb:44:in `retrieve'
	 1: from /Users/cthorn/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/json-2.3.1/lib/json/common.rb:263:in `parse'
/Users/cthorn/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/json-2.3.1/lib/json/common.rb:263:in `parse': 784: unexpected token at 'POST /api/v2/vm/centos-7-x86_64' (JSON::ParserError)

Note in the stack trace on line 2, we're using pooler.rb, where we should be using abs.rb.

With this PR I can now checkout a vm with ABS:

floaty get --service=abs --user=chirstopher.thorn --token=<cut out> centos-7-x86_64 --url=https://cinext-abs.delivery.puppetlabs.net/api/v2

WARNING: There was no config file at /Users/cthorn/.vmfloaty.yml
Requesting VMs with job_id: 1597940546886.  Will retry for up to an hour.
<cutting out 16 attempts>
Waiting 10 seconds to check if ABS request has been filled.  Queue Position: 383... (x17)
- key-hollowware.delivery.puppetlabs.net (centos-7-x86_64)

Comment thread lib/vmfloaty/utils.rb Outdated
If you do not use a config file, and define everything on the command line,
previously the service always defaulted to vmpooler. Even if you requested ABS.
This PR fixes that, now we'll see if the config has no service defined and we
defined on the command line a service, we'll use that service.
@cthorn42 cthorn42 force-pushed the maint/master/no_config_file_non_vmpooler_service_fix branch from 664ee47 to 7015348 Compare August 20, 2020 18:37

@briancain briancain left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes @cthorn42 ! :) 👍

@mattkirby mattkirby merged commit 5436f54 into puppetlabs:master Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants