Vagrant: Can't vagrant cloud search by username

Created on 11 Mar 2019  ·  4Comments  ·  Source: hashicorp/vagrant

The problem

Returns an error while searching the boxes on Vagrant Cloud by user name.

Basic env info

  • Vagrant version: Vagrant 2.2.4 (installed via HomeBrew Cask)
  • Host OS: Mac

    • macOS HighSierra (OSX 10.13.6)

    • macOS Mojave (OSX 10.14.3)

  • Guest OS: Any
  • Vagrantfile: n/a
  • Other ver info: Ruby v2.3.7, HomeBrew 2.0.3 Cask revision 589e1

Debug output

Expected behavior

Search results for boxes managed by a specific user/organization on Vagrant Cloud.

Actual behavior

$ vagrant cloud search -u hashicorp
/opt/vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/plugins/commands/cloud/search.rb:41:in `block (2 levels) in execute': undefined local variable or method `u' for #<VagrantPlugins::CloudCommand::Command::Search:0x0000000100961b20> (NameError)
    from /opt/vagrant/embedded/lib/ruby/2.4.0/optparse.rb:1584:in `block in parse_in_order'
    from /opt/vagrant/embedded/lib/ruby/2.4.0/optparse.rb:1538:in `catch'
    from /opt/vagrant/embedded/lib/ruby/2.4.0/optparse.rb:1538:in `parse_in_order'
    from /opt/vagrant/embedded/lib/ruby/2.4.0/optparse.rb:1532:in `order!'
    from /opt/vagrant/embedded/lib/ruby/2.4.0/optparse.rb:1626:in `permute!'
    from /opt/vagrant/embedded/lib/ruby/2.4.0/optparse.rb:1648:in `parse!'
    from /opt/vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/plugin/v2/command.rb:62:in `parse_options'
    from /opt/vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/plugins/commands/cloud/search.rb:46:in `execute'
    from /opt/vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/plugins/commands/cloud/root.rb:73:in `execute'
    from /opt/vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/cli.rb:66:in `execute'
    from /opt/vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/environment.rb:292:in `cli'
    from /opt/vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/bin/vagrant:182:in `<main>'

Steps to reproduce

  1. Search Vagrant Cloud boxes via vagrant command. User hashicorp for example.

    • vagrant cloud search -u hashicorp

References

$ vagrant cloud search --help
Usage: vagrant cloud search [options] query

Search for boxes managed by a specific
user/organization on Vagrant Cloud

Options:

    -j, --json                       Formats results in JSON
        --page PAGE                  The page to display Default: 1
    -s, --short                      Shows a simple list of box names
    -o, --order ORDER                Order to display results ('desc' or 'asc') Default: 'desc'
    -l, --limit LIMIT                Max number of search results Default: 25
    -p, --provider PROVIDER          Filter search results to a single provider. Defaults to all.
        --sort-by SORT               Field to sort results on (created, downloads, updated) Default: downloads
    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address
    -h, --help                       Print this help
bug documentation enhancement vagrant cloud cli

Most helpful comment

Hi @KEINOS - It looks like this option is a bit confusing. That option is specifically for signing into your Vagrant Cloud account to make an API request, and is not something used in your search.

We can update the wording around that option, and also make sure those stack traces are cleaned up a bit. Thanks!

All 4 comments

Even passing the query for the existing box such as "precise64" of "hashicorp" user gives me the same error.

$ vagrant cloud search -u hashicorp precise64
/opt/vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/plugins/commands/cloud/search.rb:41:in `block (2 levels) in execute': undefined local variable or method `u' for #<VagrantPlugins::CloudCommand::Command::Search:0x00000001018a4bc8> (NameError)
    from /opt/vagrant/embedded/lib/ruby/2.4.0/optparse.rb:1584:in `block in parse_in_order'
    from /opt/vagrant/embedded/lib/ruby/2.4.0/optparse.rb:1538:in `catch'
    from /opt/vagrant/embedded/lib/ruby/2.4.0/optparse.rb:1538:in `parse_in_order'
    from /opt/vagrant/embedded/lib/ruby/2.4.0/optparse.rb:1532:in `order!'
    from /opt/vagrant/embedded/lib/ruby/2.4.0/optparse.rb:1626:in `permute!'
    from /opt/vagrant/embedded/lib/ruby/2.4.0/optparse.rb:1648:in `parse!'
    from /opt/vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/plugin/v2/command.rb:62:in `parse_options'
    from /opt/vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/plugins/commands/cloud/search.rb:46:in `execute'
    from /opt/vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/plugins/commands/cloud/root.rb:73:in `execute'
    from /opt/vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/cli.rb:66:in `execute'
    from /opt/vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/environment.rb:292:

Without the option -u works:

$ vagrant cloud search hashicorp
| NAME                           | VERSION | DOWNLOADS | PROVIDERS                       |
+--------------------------------+---------+-----------+---------------------------------+
| hashicorp/precise64            | 1.1.0   | 6,722,607 | virtualbox,vmware_fusion,hyperv |
| hashicorp/precise32            | 1.0.0   | 2,270,528 | virtualbox                      |
| hashicorp/boot2docker          | 1.7.8   |    59,666 | vmware_desktop,virtualbox       |
| hashicorp/connect-vm           | 0.1.0   |     6,912 | vmware_desktop,virtualbox       |
| hashicorp/vagrant-share        | 0.1.0   |     3,968 | vmware_desktop,virtualbox       |
| hashicorp-vagrant/ubuntu-16.04 | 1.0.1   |     1,930 | virtualbox,vmware_desktop       |
| hashicorp-vagrant/centos-7.4   | 1.0.2   |       973 | vmware_desktop,virtualbox       |
| hashicorp/tools                | 0.2.0   |       774 | virtualbox                      |
| project10lab/lucid64           | 1.0.0   |       274 | virtualbox                      |
| rcgenova/hashicorp-sandbox     | 0.5     |       233 | virtualbox                      |
+--------------------------------+---------+-----------+---------------------------------+

Hi @KEINOS - It looks like this option is a bit confusing. That option is specifically for signing into your Vagrant Cloud account to make an API request, and is not something used in your search.

We can update the wording around that option, and also make sure those stack traces are cleaned up a bit. Thanks!

@briancain

That option is specifically for signing into your Vagrant Cloud account to make an API request

A-ha! So that option is needed to search boxes such as private ones, I assume.
That makes sense. Understood! 💡

Thanks for the lightning-fast response and action! 👍

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings