https://www.vagrantup.com/docs/cli/cloud.htmlhtml
命令: vagrant cloud
json
這是用來管理與vagrant相關的任何東西的命令。安全
該命令的主要功能是經過子命令公開的:服務器
cloud auth命令用於處理與vagrant雲受權相關的全部事情。ide
格式:網站
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形成影響的,僅僅只是存儲到了本地磁盤
格式:
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.
果真成功退出了
格式:
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"}
命令: vagrant cloud box
格式:
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 打印幫助信息
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 打印幫助信息
格式:
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 打印幫助信息
格式:
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 打印幫助信息
命令: vagrant cloud provider
雲provider
命令用於管理vagrant雲上全部provider
實體的生命週期操做。
格式:
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文件。
格式:
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 打印幫助信息
格式:
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 打印幫助信息
格式:
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文件
格式:
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 打印幫助信息
格式:
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 打印幫助信息
例子:
命令: vagrant cloud version
雲version
命令用於管理vagrant雲上的一個box中的全部版本實體的生命週期操做。
格式:
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 打印幫助信息
格式:
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 打印幫助信息
格式:
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 打印幫助信息
格式:
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 打印幫助信息
格式:
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 打印幫助信息