virtualbox+vagrant学习-2(command cli)-2-vagrant cloud命令--有问题

Cloud

https://www.vagrantup.com/docs/cli/cloud.htmlhtml

命令: vagrant cloudjson

这是用来管理与vagrant相关的任何东西的命令。安全

该命令的主要功能是经过子命令公开的:服务器

1)Cloud Auth

cloud auth命令用于处理与vagrant云受权相关的全部事情。ide

1》Cloud Auth Login

格式:网站

vagrant cloud auth login [options]

登陆命令用于对HashiCorp的vagrant云服务器进行身份验证。只有在访问受保护的boxes时才须要登陆。this

使用Vagrant不须要登陆。绝大多数vagrant使用者不须要登陆。只有在使用某些特性,如使用受保护的boxes时须要登陆。url

userdeMBP:~ user$ vagrant cloud auth login -h
Usage: vagrant cloud auth login [options]

Options:

    -c, --check                      Checks if currently logged in 查看目前是否已经登陆
    -d, --description DESCRIPTION    Set description for the Vagrant Cloud token 设置vagrant云令牌的描述,将会改变用户此时的token值 -k, --logout                     Logout from Vagrant Cloud  从vagrant云退出
    -t, --token TOKEN                Set the Vagrant Cloud token 设置vagrant云令牌,将其存储在本地磁盘上 -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address vagrant云用户名或邮箱地址
    -h, --help                       Print this help 打印帮助信息

例子:spa

1>使用用户名和密码安全认证到vagrant云:vagrant

userdeMBP:~ user$ vagrant cloud auth login
In a moment we will ask for your username and password to HashiCorp's Vagrant Cloud. After authenticating, we will store an access token locally on disk. Your login details will be transmitted over a secure connection, and
are never stored on disk locally.

If you do not have an Vagrant Cloud account, sign up at
https://www.vagrantcloud.com

Vagrant Cloud username or email:

由于我尚未注册,因此应该先到https://www.vagrantcloud.com 进行注册

成功建立了一个帐户后再使用login:

userdeMBP:~ user$ vagrant cloud auth login
In a moment we will ask for your username and password to HashiCorp's
Vagrant Cloud. After authenticating, we will store an access token locally on
disk. Your login details will be transmitted over a secure connection, and
are never stored on disk locally.

If you do not have an Vagrant Cloud account, sign up at
https://www.vagrantcloud.com

Vagrant Cloud username or email: Garcia-user
Password (will be hidden): 
Token description (Defaults to "Vagrant login from userdeMacBook-Pro.local"): 
You are now logged in.

2>检查当前用户是否通过身份验证

userdeMBP:~ user$ vagrant cloud auth login -c
You are already logged in.

3>使用令牌对vagrant云进行安全身份验证:

由于在上面的login过程当中,在Token description 中没有输入内容,因此其默认为Vagrant login from userdeMacBook-Pro.local

userdeMBP:~ user$ vagrant cloud auth login -t Vagrant login from userdeMacBook-Pro.local
The token was successfully saved.
Invalid token. Please try again.

而后我又从新login了一遍,将Token description 值内容设置为firsttime-login

1.下面使用的-t标签的做用是将firsttime-login token值存储在你本地的磁盘中

userdeMBP:~ user$ vagrant cloud auth login -t firsttime-login
The token was successfully saved.
Invalid token. Please try again.

2.使用-d标签,经过token的描述来生成一个token,其实过程和login是同样的:

userdeMBP:~ user$ vagrant cloud auth login -d firsttime-login
In a moment we will ask for your username and password to HashiCorp's Vagrant Cloud. After authenticating, we will store an access token locally on disk. Your login details will be transmitted over a secure connection, and
are never stored on disk locally.

If you do not have an Vagrant Cloud account, sign up at
https://www.vagrantcloud.com

Vagrant Cloud username or email: Garcia-user
Password (will be hidden): 
Token description: firsttime-login
You are now logged in.

 

而后咱们在网站上能够看见:

有三个token信息,是上面的两个login和一个-d生成的

 若是这个时候我运行:

userdeMBP:~ user$ vagrant cloud auth login -t secondtime-login
The token was successfully saved.
Invalid token. Please try again.

发现上面图示的页面不会有什么变化,因此-t标签是不会对用户token形成影响的,仅仅只是存储到了本地磁盘

 

2》Cloud Auth Logout

格式:

vagrant cloud auth logout [options]

当你已经登陆时用来退出。若是你已经退出了,这个命令将不会作什么。若是你已经退出,运行这个命令是不会出现什么错误的

userdeMBP:~ user$ vagrant cloud auth logout -h
Usage: vagrant cloud auth logout [options]

Log out of Vagrant Cloud

Options:

    -u, --username USERNAME_OR_EMAIL     Vagrant Cloud username or email address  Vagrant云的用户名或邮箱地址
    -h, --help                           Print this help 打印帮助信息

例子:

userdeMBP:~ user$ vagrant cloud auth logout
In a moment we will ask for your username and password to HashiCorp's
Vagrant Cloud. After authenticating, we will store an access token locally on
disk. Your login details will be transmitted over a secure connection, and
are never stored on disk locally.

If you do not have an Vagrant Cloud account, sign up at
https://www.vagrantcloud.com

Vagrant Cloud username or email: Garcia-user
Password (will be hidden): 
Token description (Defaults to "Vagrant login from userdeMacBook-Pro.local"): firsttime-logout
You are now logged in.
You are logged out.

查看login状态:

userdeMBP:~ user$ vagrant cloud auth login -c
You are not currently logged in. Please run `vagrant login` and provide your login information to authenticate.

果真成功退出了

 

3》Cloud Auth Whoami

格式:

vagrant cloud auth whoami [options] [token]

这个命令将验证你的vagrant云令牌,并打印它所属的用户。若是传入一个令牌值,它将尝试验证它,而不是将其存储在磁盘上。

userdeMBP:~ user$ vagrant cloud auth whoami -h
Usage: vagrant cloud auth whoami [options] [token]

Display currently logged in user

Options:

    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address Vagrant云的用户名或邮箱地址
    -h, --help                       Print this help  打印帮助信息

例子:

userdeMBP:~ user$ vagrant cloud auth logout
You are logged out.
userdeMBP:
~ user$ vagrant cloud auth whoami //由于以前退出过,因此调用whoami前要先登陆才行 In a moment we will ask for your username and password to HashiCorp's Vagrant Cloud. After authenticating, we will store an access token locally on disk. Your login details will be transmitted over a secure connection, and are never stored on disk locally. If you do not have an Vagrant Cloud account, sign up at https://www.vagrantcloud.com Vagrant Cloud username or email: Garcia-user Password (will be hidden): Token description (Defaults to "Vagrant login from userdeMBP.lan"): secondtime-login //从新设置此次新登陆的新token描述 You are now logged in. Currently logged in as Garcia-user userdeMBP:~ user$ vagrant cloud auth whoami //可是直接调用whoami就可以获得你登陆的信息 Currently logged in as Garcia-user

可是若是想要将token添加进去验证时,就会报错:?????????

没能解决,有解决该问题的小伙伴请告知,谢谢

userdeMBP:~ user$ vagrant cloud auth whoami secondtime-login
Failed to read organization 
401 Unauthorized - {"message"=>"Bad credentials"} 

userdeMBP:~ user$ vagrant cloud auth whoami -u Garcia-user //若是仅仅指明用户名,又不会出错
Currently logged in as Garcia-user

userdeMBP:~ user$ vagrant cloud auth whoami -u Garcia-user secondtime-login
Failed to read organization 
401 Unauthorized - {"message"=>"Bad credentials"}

 

 

2)Cloud Box

命令: vagrant cloud box

1》Cloud Box Create

格式:

vagrant cloud box create [options] organization/box-name

box create命令用于在Vagrant云上建立一个新的box条目

userdeMacBook-Pro:~ user$ vagrant cloud box create -h
Usage: vagrant cloud box create [options] organization/box-name

Creates an empty box entry on Vagrant Cloud

Options:

    -d, --description DESCRIPTION    Full description of the box 该box的详细描述信息
    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address vagrant云的用户名或邮箱地址
    -s DESCRIPTION,                  Short description of the box  该box的简短描述信息
        --short-description
    -p, --private                    Makes box private 私有化box,仅本身可见
    -h, --help                       Print this help 打印帮助信息


2》Cloud Box Delete

格式:

vagrant cloud box delete [options] organization/box-name

删除vagrant云上的某box条目

userdeMacBook-Pro:~ user$ vagrant cloud box delete -h
Usage: vagrant cloud box delete [options] organization/box-name

Deletes box entry on Vagrant Cloud 删除vagrant云上的某box条目

Options:

    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email addressvagrant云的用户名或邮箱地址
    -h, --help                       Print this help 打印帮助信息


3》Cloud Box Show

格式:

vagrant cloud box show [options] organization/box-name
显示vagrant云上某box的属性
userdeMacBook-Pro:~ user$ vagrant cloud box show -h
Usage: vagrant cloud box show [options] organization/box-name

Displays a boxes attributes on Vagrant Cloud 显示vagrant云上某box的属性

Options:

    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address  vagrant云的用户名或邮箱地址
        --versions VERSION           Display box information for a specific version 显示指定版本的box的信息
    -h, --help                       Print this help 打印帮助信息

 

4》Cloud Box Update

格式:

vagrant cloud box update [options] organization/box-name
更新vagrant云上的box条目
userdeMacBook-Pro:~ user$ vagrant cloud box update -h
Usage: vagrant cloud box update [options] organization/box-name

Updates a box entry on Vagrant Cloud 更新vagrant云上的box条目

Options:

    -d, --description DESCRIPTION    Full description of the box 该box的详细描述信息
    -u, --username                   The username of the organization that will own the box 拥有该box的组织的用户名
    -s DESCRIPTION,                  Short description of the box  该box的简短描述信息
        --short-description
    -p, --private                    Makes box private 私有化box,仅本身可见
    -h, --help                       Print this help 打印帮助信息

 

 

3)Cloud Provider

命令: vagrant cloud provider

provider命令用于管理vagrant云上全部provider实体的生命周期操做。

1》Cloud Provider Create

格式:

vagrant cloud provider create [options] organization/box-name provider-name version [url]
在vagrant云上建立一个provider条目
userdeMacBook-Pro:~ user$ vagrant cloud provider create -h
Usage: vagrant cloud provider create [options] organization/box-name provider-name version [url]

Creates a provider entry on Vagrant Cloud 在vagrant云上建立一个provider条目

Options:

    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address vagrant云的用户名或邮箱地址
    -h, --help                       Print this help 打印帮助信息

[url]参数应该是一个远程url,vagrant云可使用它来下载provider。若是没有指定url,之后可使用url更新提供provider条目,或者使用upload命令上传vagrant box文件。

2》Cloud Provider Delete

格式:

vagrant cloud provider delete [options] organization/box-name provider-name version

删除vagrant云上的某provider条目

userdeMacBook-Pro:~ user$ vagrant cloud provider delete -h
Usage: vagrant cloud provider delete [options] organization/box-name provider-name version

Deletes a provider entry on Vagrant Cloud 删除vagrant云上的某provider条目

Options:

    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address   vagrant云的用户名或邮箱地址
    -h, --help                       Print this help    打印帮助信息

 

3》Cloud Provider Update

格式:

vagrant cloud provider update [options] organization/box-name provider-name version url
更新vagrant云上的某个provider条目
userdeMacBook-Pro:~ user$ vagrant cloud provider update -h
Usage: vagrant cloud provider update [options] organization/box-name provider-name version url

Updates a provider entry on Vagrant Cloud 更新vagrant云上的某个provider条目
 
Options:

    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address  vagrant云的用户名或邮箱地址
    -h, --help                       Print this help  打印帮助信息

 

4》Cloud Provider Upload

格式:

vagrant cloud provider upload [options] organization/box-name provider-name version box-file
上传指定provider的box文件到vagrant云中
userdeMacBook-Pro:~ user$ vagrant cloud provider upload -h
Usage: vagrant cloud provider upload [options] organization/box-name provider-name version box-file

Uploads a box file to Vagrant Cloud for a specific provider 上传指定provider的box文件到vagrant云中

Options:

    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address  vagrant云的用户名或邮箱地址
    -h, --help                       Print this help   打印帮助信息

provider上传命令将向vagrant云上传指定版本和provider的vagrant box文件

 

4)Cloud Publish

格式:

vagrant cloud publish ORGANIZATION/BOX-NAME VERSION PROVIDER-NAME [PROVIDER-FILE]

在vagrant云上建立和公布一个新的vagrant box

userdeMacBook-Pro:~ user$ vagrant cloud publish -h
Usage: vagrant cloud publish [options] organization/box-name version provider-name [provider-file]

Create and release a new Vagrant Box on Vagrant Cloud  在vagrant云上建立和公布一个新的vagrant box

Options:

        --box-version VERSION        Version of box to create 建立的box的版本
        --url URL                    Remote URL to download this provider 下载这个provider的远程URL
    -d, --description DESCRIPTION    Full description of box 该box的详细描述信息
        --version-description DESCRIPTION     Description of the version to create 该建立版本的描述
    -f, --force                      Disables confirmation to create or update box  取消建立和更新box时的确认,即强制执行
    -p, --private                    Makes box private  私有化box,仅本身可见
    -r, --release                    Releases box 公布box
    -s DESCRIPTION,                  Short description of the box  该box的简短描述信息
        --short-description
    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address   vagrant云的用户名或邮箱地址
    -h, --help                       Print this help  打印帮助信息

 

5)Cloud Search

格式:

vagrant cloud search [options] query

经过指定的user/organization名字来在vagrant云上搜索boxes

userdeMacBook-Pro:~ user$ vagrant cloud search -h
Usage: vagrant cloud search [options] query

Search for boxes managed by a specific user/organization on Vagrant Cloud。经过指定的user/organization名字来在vagrant云上搜索boxes

Options:

    -j, --json                       Formats results in JSON  将结果格式化成JSON格式
        --page PAGE                  The page to display Default: 1  默认显示一页的内容
    -s, --short                      Shows a simple list of box names  只显示box名字的简单列表
    -o, --order ORDER                Order to display results ('desc' or 'asc') Default: 'desc'  显示结果的顺序(逆向或正向),默认为逆向
    -l, --limit LIMIT                Max number of search results Default: 25  搜索结果的最大数量,默认为25
    -p, --provider PROVIDER          Filter search results to a single provider. Defaults to all.  使用provider来过滤搜索结果。默认是获得全部provider类型
        --sort-by SORT               Field to sort results on (created, downloads, updated) Default: downloads  
                                     指定用于对结果进行排序的字断(created, downloads, updated),默认使用的是downloads(即下载数量)
    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address vagrant云的用户名或邮箱地址
    -h, --help                       Print this help 打印帮助信息

例子:

 

 

6)Cloud Version

命令: vagrant cloud version

version命令用于管理vagrant云上的一个box中的全部版本实体的生命周期操做。


1》Cloud Version Create

格式:

vagrant cloud version create [options] organization/box-name version

在vagrant云上建立版本条目

userdeMacBook-Pro:~ user$ vagrant cloud version create -h
Usage: vagrant cloud version create [options] organization/box-name version

Creates a version entry on Vagrant Cloud 在vagrant云上建立版本条目

Options:

    -d, --description DESCRIPTION    A description for this version  对该版本的详细描述
    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address vagrant云的用户名或邮箱地址
    -h, --help                       Print this help 打印帮助信息

 

2》Cloud Version Delete

格式:

vagrant cloud version delete [options] organization/box-name version

从vagrant云中删除一个版本条目

userdeMacBook-Pro:~ user$ vagrant cloud version delete -h
Usage: vagrant cloud version delete [options] organization/box-name version

Deletes a version entry on Vagrant Cloud 从vagrant云中删除一个版本条目

Options:

    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address vagrant云的用户名或邮箱地址
    -h, --help                       Print this help 打印帮助信息

 

3》Cloud Version Release

格式:

vagrant cloud version release [options] organization/box-name version

在vagrant云上发布版本条目

userdeMacBook-Pro:~ user$ vagrant cloud version release -h
Usage: vagrant cloud version release [options] organization/box-name version

Releases a version entry on Vagrant Cloud 在vagrant云上发布版本条目

Options:

    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address   vagrant云的用户名或邮箱地址
    -h, --help                       Print this help   打印帮助信息

 

4》Cloud Version Revoke

格式:

vagrant cloud version revoke [options] organization/box-name version
从vagrant云上撤销一个版本条目
userdeMacBook-Pro:~ user$ vagrant cloud version revoke -h
Usage: vagrant cloud version revoke [options] organization/box-name version

Revokes a version entry on Vagrant Cloud 从vagrant云上撤销一个版本条目

Options:

    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address  vagrant云的用户名或邮箱地址
    -h, --help                       Print this help  打印帮助信息

 

5》Cloud Version Update

格式:

vagrant cloud version update [options] organization/box-name version

更新在vagrant云上的版本条目

userdeMacBook-Pro:~ user$ vagrant cloud version update -h
Usage: vagrant cloud version update [options] organization/box-name version

Updates a version entry on Vagrant Cloud  更新在vagrant云上的版本条目

Options:

    -d, --description DESCRIPTION    A description for this version 对该版本的详细描述
    -u, --username USERNAME_OR_EMAIL Vagrant Cloud username or email address    vagrant云的用户名或邮箱地址
    -h, --help                       Print this help  打印帮助信息
相关文章
相关标签/搜索