vagrant-mos 0.9.18 → 0.9.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 784f71fc016d8c9be71b9c2c5522708542f95065
4
- data.tar.gz: 09aafe282fde376e8cceb5b30b5b2aea101fef5f
3
+ metadata.gz: 9bae12df04b93f0f02bdae078f6d1f10760f4933
4
+ data.tar.gz: e92c667ebe41e4d81e39e4c85db93d51f71409a3
5
5
  SHA512:
6
- metadata.gz: 02a4459b70ddaa33e2e27f26c11d16e096fdbbc405fe5ec96bed03a6294a5868ccb1aa8610f73c2a5c8405ecc7b0f77aa0fa40c487c683d43d4ae953817b7198
7
- data.tar.gz: 088eb638e34750542c8c72ce432f9568afd1ffefbce83721283de21019d92864640ab8312bdb894abb48d9b308660441ee03a6c200445bc02fd369256b8a40fb
6
+ metadata.gz: a24f9f4a9ee686d2879bb96db22c813cc169405cd83497dee46be0b54de6cf30a70e6bd27eee6de9f9251063f523ce4253d387671347e74a3e3820bbf21ca5c8
7
+ data.tar.gz: 97a607b2d35f4786f88e6fcfc1fc816414d90ba5059f60818083a1f89ec12c642981b98767271129410a97b820d5b56c2dd1f1692ae1ac3e7de304f5512f05ba
data/README.md CHANGED
@@ -8,25 +8,23 @@
8
8
  [gem]: https://rubygems.org/gems/vagrant-mos
9
9
  [gemnasium]: https://gemnasium.com/mitchellh/vagrant-mos
10
10
 
11
- This is a [Vagrant](http://www.vagrantup.com) 1.2+ plugin that adds an [MOS](http://cloud.sankuai.com/)
12
- provider to Vagrant, allowing Vagrant to control and provision machines in
13
- MOS.
11
+ 该版本的[Vagrant](http://www.vagrantup.com) 1.2+ plugin现在支持[MOS](http://cloud.sankuai.com/)
12
+ provider,从而使得Vagrant可以像管理VirtualBox那样管理美团云主机。
14
13
 
15
- **NOTE:** This plugin requires Vagrant 1.2+,
14
+ **NOTE:** 该版本的plugin要求Vagrant版本为 1.2+,而且最好是最新版本
16
15
 
17
- ## Features
16
+ ## 主要功能
18
17
 
19
- * Boot MOS instances.
20
- * SSH into the instances.
21
- * Provision the instances with any built-in Vagrant provisioner.
22
- * Minimal synced folder support via `rsync`.
23
- * Manage MOS machine's status through `vagrant status`.
18
+ * 支持Vagrant常用命令 `up`, `status`, `destroy`, `halt`, `reload` 以及 `ssh`
19
+ * 创建 MOS 主机实例
20
+ * SSH连接已创建的主机
21
+ * 支持通过`rsync`命令同步文件夹
22
+ * 通过`vagrant status`命令管理已创建的MOS主机
23
+ * 通过`vagrant mos-templates`查看可使用的镜像.
24
24
 
25
- ## Usage
25
+ ## 安装使用
26
26
 
27
- Install using standard Vagrant 1.2+ plugin installation methods. After
28
- installing, `vagrant up` and specify the `mos` provider. An example is
29
- shown below.
27
+ 按照安装Vagrant 1.2+ plugin的标准步骤安装即可。**在完成plugin以及MOS box安装后**,通过`vagrant up` 即可创建Vagrant MOS主机实例。下面是样例。
30
28
 
31
29
  ```
32
30
  $ vagrant plugin install vagrant-mos
@@ -35,23 +33,23 @@ $ vagrant up --provider=mos
35
33
  ...
36
34
  ```
37
35
 
38
- Of course prior to doing this, you'll need to obtain an MOS-compatible
39
- box file for Vagrant.
36
+ ## 快速入门
40
37
 
41
- ## Quick Start
42
-
43
- After installing the plugin (instructions above), the quickest way to get
44
- started is to actually use a MOS box and specify all the details
45
- manually within a `config.vm.provider` block. So first, add the
46
- box using any name you want:
38
+ 在按照上述步骤完成vagrant plugin安装后,要想快速使用vagrant MOS创建主机,首先要有MOS box。用户可以执行下面的命令安装MOS box。
47
39
 
48
40
  ```
49
41
  $ vagrant box add mos_box https://github.com/yangcs2009/vagrant-mos/raw/master/mos.box
50
42
  ...
51
43
  ```
52
44
 
53
- And then make a Vagrantfile that looks like the following, filling in
54
- your information where necessary.
45
+ 完成以上工作后,就可以开始创建MOS主机了,首先创建一个工作目录,然后创建一份Vagrant配置文档。
46
+
47
+ ```
48
+ $ mkdir vagrant_workplace
49
+ $ cd vagrant_workplace
50
+ $ vagrant init
51
+ ```
52
+ 然后就会发现在该目录下新生成一个Vagrantfile文档,编辑该文档如下:
55
53
 
56
54
  ```
57
55
  Vagrant.configure("2") do |config|
@@ -63,7 +61,7 @@ Vagrant.configure("2") do |config|
63
61
  mos.secret_access_url = "YOUR MOS ACCESS URL"
64
62
  mos.keypair_name = "KEYPAIR NAME"
65
63
 
66
- mos.ami = "fa1026fe-c082-4ead-8458-802bf65ca64c"
64
+ mos.template_id = "fa1026fe-c082-4ead-8458-802bf65ca64c"
67
65
 
68
66
  override.ssh.username = "root"
69
67
  override.ssh.private_key_path = "PATH TO YOUR PRIVATE KEY"
@@ -71,53 +69,33 @@ Vagrant.configure("2") do |config|
71
69
  end
72
70
  ```
73
71
 
74
- And then run `vagrant up --provider=mos`.
75
-
76
- This will start an Ubuntu 12.04 instance in the us-east-1 region within
77
- your account. And assuming your SSH information was filled in properly
78
- within your Vagrantfile, SSH and provisioning will work as well.
72
+ 完成后保存,然后执行 `vagrant up --provider=mos`就可以创建MOS主机了。
79
73
 
80
- Note that normally a lot of this boilerplate is encoded within the box
81
- file, but the box file used for the quick start, the "dummy" box, has
82
- no preconfigured defaults.
74
+ 当然这一切都是假定你的ssh配置信息已经完成,如何设置ssh信息请参见[美团云秘钥](http://cloud.sankuai.com/console/#keypairs)。
83
75
 
84
- If you have issues with SSH connecting, make sure that the instances
85
- are being launched with a security group that allows SSH access.
76
+ ## Box设置
86
77
 
87
- ## Box Format
78
+ 不同的vagrant provider都必须使用符合响应要求的box来创建新主机。我们样例采用的是MOS的box `mos`。用户可以查看[example_box](https://github.com/yangcs2009/vagrant-mos/tree/master/example_box),从中还可以学习如何设置自己的boxes。
88
79
 
89
- Every provider in Vagrant must introduce a custom box format. This
90
- provider introduces `mos` boxes. You can view an example box in
91
- the [example_box/ directory](https://github.com/mitchellh/vagrant-mos/tree/master/example_box).
92
- That directory also contains instructions on how to build a box.
93
80
 
94
- The box format is basically just the required `metadata.json` file
95
- along with a `Vagrantfile` that does default settings for the
96
- provider-specific configuration for this provider.
81
+ ## 配置文档
97
82
 
98
- ## Configuration
83
+ MOS provider设置了若干参数,主要参数说明如下:
99
84
 
100
- This provider exposes quite a few provider-specific configuration options:
85
+ * `access_key_id` - 访问美团云的key
86
+ * `secret_access_key` - 访问美团云的secret
87
+ * `secret_access_url` -访问美团云的url
88
+ * `region` - 创建主机的region,例如 "us-east-1"
89
+ * `template_id` - 创建美团云主机的镜像,例如 "fa1026fe-c082-4ead-8458-802bf65ca64c",用户可以使用`vagrant mos-templates`查看可以使用的镜像
90
+ * `instance_ready_timeout` - 等待MOS主机创建成功最长时间,单位为秒。默认为120s。
91
+ * `instance_name` - 创建的MOS主机名称,例如 "ubuntu007"。
92
+ * `instance_type` - 创建的MOS主机类型,例如"C1_M1". 默认配置为 "C1_M2".
93
+ * `keypair_name` - 用户使用的秘钥名称。通过使用秘钥,用户登录该创建的主机时就不需要在输入繁琐的密码了
94
+ * `use_iam_profile` - 如果该参数设置,则使用[IAM profiles](http://docs.mos.amazon.com/IAM/latest/UserGuide/instance-profiles.html)认证。
101
95
 
102
- * `access_key_id` - The access key for accessing MOS
103
- * `ami` - The image id to boot, such as "fa1026fe-c082-4ead-8458-802bf65ca64c"
104
- * `instance_ready_timeout` - The number of seconds to wait for the instance
105
- to become "ready" in MOS. Defaults to 120 seconds.
106
- * `instance_name` - The name of instance to be created, such as "ubuntu01". The default
107
- value of this if not specified is 'default'.
108
- * `instance_type` - The type of instance, such as "C1_M1". The default
109
- value of this if not specified is "C1_M2".
110
- * `keypair_name` - The name of the keypair to use to bootstrap images
111
- which support it.
112
- * `secret_access_url` - The accee url for accessing MOS
113
- * `region` - The region to start the instance in, such as "us-east-1"
114
- * `secret_access_key` - The secret access key for accessing MOS
115
- * `use_iam_profile` - If true, will use [IAM profiles](http://docs.mos.amazon.com/IAM/latest/UserGuide/instance-profiles.html)
116
- for credentials.
96
+ 一个典型的配置文档如下所示:
117
97
 
118
- These can be set like typical provider-specific configuration:
119
-
120
- ```ruby
98
+ ```
121
99
  Vagrant.configure("2") do |config|
122
100
  # ... other stuff
123
101
 
@@ -129,76 +107,30 @@ Vagrant.configure("2") do |config|
129
107
  end
130
108
  ```
131
109
 
132
- In addition to the above top-level configs, you can use the `region_config`
133
- method to specify region-specific overrides within your Vagrantfile. Note
134
- that the top-level `region` config must always be specified to choose which
135
- region you want to actually use, however. This looks like this:
110
+ ## 网络
136
111
 
137
- ```ruby
138
- Vagrant.configure("2") do |config|
139
- # ... other stuff
112
+ MOS的网络功能 `config.vm.network` 暂时不支持。如果用户指定相关参数的话,vagrant会给出警告。
140
113
 
141
- config.vm.provider :mos do |mos|
142
- mos.access_key_id = "foo"
143
- mos.secret_access_key = "bar"
144
- mos.region = "us-east-1"
145
-
146
- # Simple region config
147
- mos.region_config "us-east-1", :ami => "ami-12345678"
148
-
149
- # More comprehensive region config
150
- mos.region_config "us-west-2" do |region|
151
- region.ami = "ami-87654321"
152
- region.keypair_name = "company-west"
153
- end
154
- end
155
- end
156
- ```
157
-
158
- The region-specific configurations will override the top-level
159
- configurations when that region is used. They otherwise inherit
160
- the top-level configurations, as you would probably expect.
161
-
162
- ## Networks
163
-
164
- Networking features in the form of `config.vm.network` are not
165
- supported with `vagrant-mos`, currently. If any of these are
166
- specified, Vagrant will emit a warning, but will otherwise boot
167
- the MOS machine.
114
+ ## 文件夹同步
168
115
 
169
- ## Synced Folders
116
+ MOS 支持文件夹同步。通过使用`rsync` 命令来指定。
170
117
 
171
- There is minimal support for synced folders. Upon `vagrant up`,
172
- `vagrant reload`, and `vagrant provision`, the MOS provider will use
173
- `rsync` (if available) to uni-directionally sync the folder to
174
- the remote machine over SSH.
118
+ 具体内容可以参见 [Vagrant Synced folders: rsync](https://docs.vagrantup.com/v2/synced-folders/rsync.html)
175
119
 
176
- See [Vagrant Synced folders: rsync](https://docs.vagrantup.com/v2/synced-folders/rsync.html)
177
120
 
121
+ ## 自定义开发
178
122
 
179
- ## Development
180
-
181
- To work on the `vagrant-mos` plugin, clone this repository out, and use
182
- [Bundler](http://gembundler.com) to get the dependencies:
123
+ 如果用户需要在 `vagrant-mos` plugin基础上实现自己的功能,克隆该工程,然后使用
124
+ [Bundler](http://gembundler.com)获得依赖:
183
125
 
184
126
  ```
185
127
  $ bundle
186
128
  ```
187
129
 
188
- Once you have the dependencies, verify the unit tests pass with `rake`:
130
+ 完成后,使用`rake`测试:
189
131
 
190
132
  ```
191
133
  $ bundle exec rake
192
134
  ```
193
135
 
194
- If those pass, you're ready to start developing the plugin. You can test
195
- the plugin without installing it into your Vagrant environment by just
196
- creating a `Vagrantfile` in the top level of this directory (it is gitignored)
197
- and add the following line to your `Vagrantfile`
198
- ```ruby
199
- Vagrant.require_plugin "vagrant-mos"
200
- ```
201
- Use bundler to execute Vagrant:
202
- ```
203
- $ bundle exec vagrant up --provider=mos
204
- ```
136
+ 如果以上步骤没有问题的话,用户就可以开始自己的开发工作了。
data/README_en.md ADDED
@@ -0,0 +1,202 @@
1
+ # Vagrant MOS Provider
2
+
3
+ <span class="badges">
4
+ [![Gem Version](https://badge.fury.io/rb/vagrant-mos.png)][gem]
5
+ [![Dependency Status](https://gemnasium.com/mitchellh/vagrant-mos.png)][gemnasium]
6
+ </span>
7
+
8
+ [gem]: https://rubygems.org/gems/vagrant-mos
9
+ [gemnasium]: https://gemnasium.com/mitchellh/vagrant-mos
10
+
11
+ This is a [Vagrant](http://www.vagrantup.com) 1.2+ plugin that adds an [MOS](http://cloud.sankuai.com/)
12
+ provider to Vagrant, allowing Vagrant to control and provision machines in
13
+ MOS.
14
+
15
+ **NOTE:** This plugin requires Vagrant 1.2+,
16
+
17
+ ## Features
18
+
19
+ * Support for Vagrant's `up`, `status`, `destroy`, `halt`, `reload` and `ssh` commands
20
+ * Boot MOS instances.
21
+ * SSH into the instances.
22
+ * Provision the instances with any built-in Vagrant provisioner.
23
+ * Minimal synced folder support via `rsync`.
24
+ * Manage MOS machine's status through `vagrant status`.
25
+
26
+ ## Usage
27
+
28
+ Install using standard Vagrant 1.2+ plugin installation methods. After
29
+ installing, `vagrant up` and specify the `mos` provider. An example is
30
+ shown below.
31
+
32
+ ```
33
+ $ vagrant plugin install vagrant-mos
34
+ ...
35
+ $ vagrant up --provider=mos
36
+ ...
37
+ ```
38
+
39
+ Of course prior to doing this, you'll need to obtain an MOS-compatible
40
+ box file for Vagrant.
41
+
42
+ ## Quick Start
43
+
44
+ After installing the plugin (instructions above), the quickest way to get
45
+ started is to actually use a MOS box and specify all the details
46
+ manually within a `config.vm.provider` block. So first, add the
47
+ box using any name you want:
48
+
49
+ ```
50
+ $ vagrant box add mos_box https://github.com/yangcs2009/vagrant-mos/raw/master/mos.box
51
+ ...
52
+ ```
53
+
54
+ And then make a Vagrantfile that looks like the following, filling in
55
+ your information where necessary.
56
+
57
+ ```
58
+ Vagrant.configure("2") do |config|
59
+ config.vm.box = "mos_box"
60
+ config.vm.provider :mos do |mos, override|
61
+ mos.access_key_id = "YOUR KEY"
62
+ mos.secret_access_key = "YOUR SECRET KEY"
63
+ mos.secret_access_url = "YOUR MOS ACCESS URL"
64
+ mos.keypair_name = "KEYPAIR NAME"
65
+ mos.template_id = "fa1026fe-c082-4ead-8458-802bf65ca64c"
66
+ override.ssh.username = "root"
67
+ override.ssh.private_key_path = "PATH TO YOUR PRIVATE KEY"
68
+ end
69
+ end
70
+ ```
71
+
72
+ And then run `vagrant up --provider=mos`.
73
+
74
+ This will start an Ubuntu 12.04 instance in the us-east-1 region within
75
+ your account. And assuming your SSH information was filled in properly
76
+ within your Vagrantfile, SSH and provisioning will work as well.
77
+
78
+ Note that normally a lot of this boilerplate is encoded within the box
79
+ file, but the box file used for the quick start, the "dummy" box, has
80
+ no preconfigured defaults.
81
+
82
+ If you have issues with SSH connecting, make sure that the instances
83
+ are being launched with a security group that allows SSH access.
84
+
85
+ ## Box Format
86
+
87
+ Every provider in Vagrant must introduce a custom box format. This
88
+ provider introduces `mos` boxes. You can view an example box in
89
+ the [example_box/ directory](https://github.com/mitchellh/vagrant-mos/tree/master/example_box).
90
+ That directory also contains instructions on how to build a box.
91
+
92
+ The box format is basically just the required `metadata.json` file
93
+ along with a `Vagrantfile` that does default settings for the
94
+ provider-specific configuration for this provider.
95
+
96
+ ## Configuration
97
+
98
+ This provider exposes quite a few provider-specific configuration options:
99
+
100
+ * `access_key_id` - The access key for accessing MOS
101
+ * `template_id` - The image id to boot, such as "fa1026fe-c082-4ead-8458-802bf65ca64c"
102
+ * `instance_ready_timeout` - The number of seconds to wait for the instance
103
+ to become "ready" in MOS. Defaults to 120 seconds.
104
+ * `instance_name` - The name of instance to be created, such as "ubuntu01". The default
105
+ value of this if not specified is 'default'.
106
+ * `instance_type` - The type of instance, such as "C1_M1". The default
107
+ value of this if not specified is "C1_M2".
108
+ * `keypair_name` - The name of the keypair to use to bootstrap images.
109
+ which support it.
110
+ * `secret_access_url` - The accee url for accessing MOS
111
+ * `region` - The region to start the instance in, such as "us-east-1"
112
+ * `secret_access_key` - The secret access key for accessing MOS
113
+ * `use_iam_profile` - If true, will use [IAM profiles](http://docs.mos.amazon.com/IAM/latest/UserGuide/instance-profiles.html)
114
+ for credentials.
115
+
116
+ These can be set like typical provider-specific configuration:
117
+
118
+ ```ruby
119
+ Vagrant.configure("2") do |config|
120
+ # ... other stuff
121
+
122
+ config.vm.provider :mos do |mos|
123
+ mos.access_key_id = "your_key"
124
+ mos.secret_access_key = "your_secret"
125
+ mos.secret_access_url = "your_access_url"
126
+ end
127
+ end
128
+ ```
129
+
130
+ In addition to the above top-level configs, you can use the `region_config`
131
+ method to specify region-specific overrides within your Vagrantfile. Note
132
+ that the top-level `region` config must always be specified to choose which
133
+ region you want to actually use, however. This looks like this:
134
+
135
+ ```ruby
136
+ Vagrant.configure("2") do |config|
137
+ # ... other stuff
138
+
139
+ config.vm.provider :mos do |mos|
140
+ mos.access_key_id = "foo"
141
+ mos.secret_access_key = "bar"
142
+ mos.region = "us-east-1"
143
+
144
+ # Simple region config
145
+ mos.region_config "us-east-1", :template_id => "template_id-12345678"
146
+
147
+ # More comprehensive region config
148
+ mos.region_config "us-west-2" do |region|
149
+ region.template_id = "template_id-87654321"
150
+ region.keypair_name = "company-west"
151
+ end
152
+ end
153
+ end
154
+ ```
155
+
156
+ The region-specific configurations will override the top-level
157
+ configurations when that region is used. They otherwise inherit
158
+ the top-level configurations, as you would probably expect.
159
+
160
+ ## Networks
161
+
162
+ Networking features in the form of `config.vm.network` are not
163
+ supported with `vagrant-mos`, currently. If any of these are
164
+ specified, Vagrant will emit a warning, but will otherwise boot
165
+ the MOS machine.
166
+
167
+ ## Synced Folders
168
+
169
+ There is minimal support for synced folders. Upon `vagrant up`,
170
+ `vagrant reload`, and `vagrant provision`, the MOS provider will use
171
+ `rsync` (if available) to uni-directionally sync the folder to
172
+ the remote machine over SSH.
173
+
174
+ See [Vagrant Synced folders: rsync](https://docs.vagrantup.com/v2/synced-folders/rsync.html)
175
+
176
+
177
+ ## Development
178
+
179
+ To work on the `vagrant-mos` plugin, clone this repository out, and use
180
+ [Bundler](http://gembundler.com) to get the dependencies:
181
+
182
+ ```
183
+ $ bundle
184
+ ```
185
+
186
+ Once you have the dependencies, verify the unit tests pass with `rake`:
187
+
188
+ ```
189
+ $ bundle exec rake
190
+ ```
191
+
192
+ If those pass, you're ready to start developing the plugin. You can test
193
+ the plugin without installing it into your Vagrant environment by just
194
+ creating a `Vagrantfile` in the top level of this directory (it is gitignored)
195
+ and add the following line to your `Vagrantfile`
196
+ ```ruby
197
+ Vagrant.require_plugin "vagrant-mos"
198
+ ```
199
+ Use bundler to execute Vagrant:
200
+ ```
201
+ $ bundle exec vagrant up --provider=mos
202
+ ```
@@ -3,6 +3,6 @@
3
3
 
4
4
  Vagrant.configure("2") do |config|
5
5
  config.vm.provider :mos do |mos|
6
- mos.ami = "fa1026fe-c082-4ead-8458-802bf65ca64c"
6
+ mos.template_id = "fa1026fe-c082-4ead-8458-802bf65ca64c"
7
7
  end
8
8
  end
@@ -26,7 +26,7 @@ module VagrantPlugins
26
26
 
27
27
  # Get the configs
28
28
  region_config = env[:machine].provider_config.get_region_config(region)
29
- ami = region_config.ami
29
+ template_id = region_config.template_id
30
30
  name = region_config.name
31
31
  instance_type = region_config.instance_type
32
32
  keypair = region_config.keypair_name
@@ -41,22 +41,22 @@ module VagrantPlugins
41
41
  env[:ui].info(I18n.t("vagrant_mos.launching_instance"))
42
42
  env[:ui].info(" -- Name: #{name}") if name
43
43
  env[:ui].info(" -- Type: #{instance_type}")
44
- env[:ui].info(" -- AMI: #{ami}")
45
- env[:ui].info(" -- Region: #{region}")
44
+ env[:ui].info(" -- Template_id: #{template_id}")
45
+ #env[:ui].info(" -- Region: #{region}")
46
46
  env[:ui].info(" -- Keypair: #{keypair}") if keypair
47
47
  env[:ui].info(" -- Terminate On Shutdown: #{terminate_on_shutdown}")
48
48
 
49
49
  options = {
50
50
  :flavor_id => instance_type,
51
51
  :name => name,
52
- :image_id => ami,
52
+ :template_id => template_id,
53
53
  :key_name => keypair,
54
54
  :instance_initiated_shutdown_behavior => terminate_on_shutdown == true ? "terminate" : nil,
55
55
  }
56
56
 
57
57
  begin
58
58
  # create a handler to access MOS
59
- server = env[:mos_compute].create_instance(options[:image_id], options[:flavor_id], nil, options[:name], options[:key_name], datadisk=9, bandwidth=2)
59
+ server = env[:mos_compute].create_instance(options[:template_id], options[:flavor_id], nil, options[:name], options[:key_name], datadisk=9, bandwidth=2)
60
60
  rescue Exception => e
61
61
  raise Errors::MosError, :message => e.message
62
62
  end
@@ -5,8 +5,6 @@ module VagrantPlugins
5
5
  module MOS
6
6
  class Command < Vagrant.plugin(2, :command)
7
7
  def execute
8
- puts "Hello!"
9
-
10
8
  machine = @env.machine(:default, :mos)
11
9
  region = machine.provider_config.region
12
10
 
@@ -11,7 +11,7 @@ module VagrantPlugins
11
11
  # The ID of the image to use.
12
12
  #
13
13
  # @return [String]
14
- attr_accessor :ami
14
+ attr_accessor :template_id
15
15
 
16
16
  # The name of the instance to create.
17
17
  #
@@ -76,7 +76,7 @@ module VagrantPlugins
76
76
 
77
77
  def initialize(region_specific=false)
78
78
  @access_key_id = UNSET_VALUE
79
- @ami = UNSET_VALUE
79
+ @template_id = UNSET_VALUE
80
80
  @instance_ready_timeout = UNSET_VALUE
81
81
  @name = UNSET_VALUE
82
82
  @instance_type = UNSET_VALUE
@@ -99,10 +99,10 @@ module VagrantPlugins
99
99
 
100
100
  # Allows region-specific overrides of any of the settings on this
101
101
  # configuration object. This allows the user to override things like
102
- # AMI and keypair name for regions. Example:
102
+ # template_id and keypair name for regions. Example:
103
103
  #
104
104
  # mos.region_config "us-east-1" do |region|
105
- # region.ami = "ami-12345678"
105
+ # region.template_id = "template_id-12345678"
106
106
  # region.keypair_name = "company-east"
107
107
  # end
108
108
  #
@@ -161,8 +161,8 @@ module VagrantPlugins
161
161
  @secret_access_key = ENV['MOS_SECRET_KEY'] if @secret_access_key == UNSET_VALUE
162
162
  @secret_access_url = ENV['MOS_SECRET_URL'] if @secret_access_url == UNSET_VALUE
163
163
 
164
- # AMI must be nil, since we can't default that
165
- @ami = nil if @ami == UNSET_VALUE
164
+ # Template_id must be nil, since we can't default that
165
+ @template_id = nil if @template_id == UNSET_VALUE
166
166
 
167
167
  # Default instance name is nil
168
168
  @name = nil if @name == UNSET_VALUE
@@ -234,7 +234,7 @@ module VagrantPlugins
234
234
  config.secret_access_url.nil?
235
235
  end
236
236
 
237
- errors << I18n.interpolate("vagrant_mos.config.ami_required", :region => @region) if config.ami.nil?
237
+ errors << I18n.interpolate("vagrant_mos.config.template_id_required", :region => @region) if config.template_id.nil?
238
238
  end
239
239
 
240
240
  { "MOS Provider" => errors }
@@ -24,7 +24,7 @@ module VagrantPlugins
24
24
  Config
25
25
  end
26
26
 
27
- command "images" do
27
+ command "mos-templates" do
28
28
  require_relative "command"
29
29
  Command
30
30
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module MOS
3
- VERSION = '0.9.18'
3
+ VERSION = '0.9.20'
4
4
  end
5
5
  end
data/locales/en.yml CHANGED
@@ -41,8 +41,8 @@ en:
41
41
  config:
42
42
  access_key_id_required: |-
43
43
  An access key ID must be specified via "access_key_id"
44
- ami_required: |-
45
- An AMI must be configured via "ami" (region: #{region})
44
+ template_id_required: |-
45
+ An template_id must be configured via "template_id" (region: #{region})
46
46
  private_key_missing: |-
47
47
  The specified private key for MOS could not be found
48
48
  region_required: |-
data/mos.box CHANGED
Binary file
@@ -16,7 +16,7 @@ describe VagrantPlugins::MOS::Config do
16
16
  end
17
17
 
18
18
  its("access_key_id") { should be_nil }
19
- its("ami") { should be_nil }
19
+ its("template_id") { should be_nil }
20
20
  its("instance_ready_timeout") { should == 120 }
21
21
  its("name") { should be_nil }
22
22
  its("instance_type") { should == "C1_M2" }
@@ -34,7 +34,7 @@ describe VagrantPlugins::MOS::Config do
34
34
  # simple boilerplate test, so I cut corners here. It just sets
35
35
  # each of these attributes to "foo" in isolation, and reads the value
36
36
  # and asserts the proper result comes back out.
37
- [:access_key_id, :ami, :instance_ready_timeout,:name,
37
+ [:access_key_id, :template_id, :instance_ready_timeout,:name,
38
38
  :instance_type, :keypair_name, :ssh_host_attribute,
39
39
  :region, :secret_access_key, :secret_access_url, :terminate_on_shutdown,
40
40
  :use_iam_profile].each do |attribute|
@@ -86,7 +86,7 @@ describe VagrantPlugins::MOS::Config do
86
86
 
87
87
  describe "region config" do
88
88
  let(:config_access_key_id) { "foo" }
89
- let(:config_ami) { "foo" }
89
+ let(:config_template_id) { "foo" }
90
90
  let(:config_instance_type) { "foo" }
91
91
  let(:config_name) { "foo" }
92
92
  let(:config_keypair_name) { "foo" }
@@ -96,7 +96,7 @@ describe VagrantPlugins::MOS::Config do
96
96
 
97
97
  def set_test_values(instance)
98
98
  instance.access_key_id = config_access_key_id
99
- instance.ami = config_ami
99
+ instance.template_id = config_template_id
100
100
  instance.instance_type = config_instance_type
101
101
  instance.name = config_name
102
102
  instance.keypair_name = config_keypair_name
@@ -123,7 +123,7 @@ describe VagrantPlugins::MOS::Config do
123
123
  end
124
124
 
125
125
  its("access_key_id") { should == config_access_key_id }
126
- its("ami") { should == config_ami }
126
+ its("template_id") { should == config_template_id }
127
127
  its("instance_type") { should == config_instance_type }
128
128
  its("name") { should == config_name }
129
129
  its("keypair_name") { should == config_keypair_name }
@@ -149,7 +149,7 @@ describe VagrantPlugins::MOS::Config do
149
149
  end
150
150
 
151
151
  its("access_key_id") { should == config_access_key_id }
152
- its("ami") { should == config_ami }
152
+ its("template_id") { should == config_template_id }
153
153
  its("instance_type") { should == config_instance_type }
154
154
  its("name") { should == config_name }
155
155
  its("keypair_name") { should == config_keypair_name }
@@ -164,12 +164,12 @@ describe VagrantPlugins::MOS::Config do
164
164
  subject do
165
165
  # Set the values on a specific region
166
166
  instance.region_config region_name do |config|
167
- config.ami = "child"
167
+ config.template_id = "child"
168
168
  end
169
169
 
170
170
  # Set some top-level values
171
171
  instance.access_key_id = "parent"
172
- instance.ami = "parent"
172
+ instance.template_id = "parent"
173
173
 
174
174
  # Finalize and get the region
175
175
  instance.finalize!
@@ -177,18 +177,18 @@ describe VagrantPlugins::MOS::Config do
177
177
  end
178
178
 
179
179
  its("access_key_id") { should == "parent" }
180
- its("ami") { should == "child" }
180
+ its("template_id") { should == "child" }
181
181
  end
182
182
 
183
183
  describe "shortcut configuration" do
184
184
  subject do
185
185
  # Use the shortcut configuration to set some values
186
- instance.region_config "us-east-1", :ami => "child"
186
+ instance.region_config "us-east-1", :template_id => "child"
187
187
  instance.finalize!
188
188
  instance.get_region_config("us-east-1")
189
189
  end
190
190
 
191
- its("ami") { should == "child" }
191
+ its("template_id") { should == "child" }
192
192
  end
193
193
 
194
194
  describe "merging" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-mos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.18
4
+ version: 0.9.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - yangcs2009
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-29 00:00:00.000000000 Z
11
+ date: 2015-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mos-sdk
@@ -90,6 +90,7 @@ files:
90
90
  - CHANGELOG.md
91
91
  - Gemfile
92
92
  - README.md
93
+ - README_en.md
93
94
  - Vagrantfile
94
95
  - example_box/README.md
95
96
  - example_box/Vagrantfile
@@ -97,7 +98,6 @@ files:
97
98
  - lib/vagrant-mos.rb
98
99
  - lib/vagrant-mos/action.rb
99
100
  - lib/vagrant-mos/action/connect_mos.rb
100
- - lib/vagrant-mos/action/describe_templates.rb
101
101
  - lib/vagrant-mos/action/is_created.rb
102
102
  - lib/vagrant-mos/action/is_stopped.rb
103
103
  - lib/vagrant-mos/action/message_already_created.rb
@@ -1,40 +0,0 @@
1
- require "log4r"
2
-
3
- module VagrantPlugins
4
- module MOS
5
- module Action
6
- # This action reads the state of the machine and puts it in the
7
- # `:machine_state_id` key in the environment.
8
- class DescribeTemplates
9
- def initialize(app, env)
10
- @app = app
11
- @logger = Log4r::Logger.new("vagrant_mos::action::read_state")
12
- puts 1
13
- end
14
-
15
- def call(env)
16
- env[:machine_state_id] = read_state(env[:mos_compute], env[:machine])
17
- puts 2
18
- @app.call(env)
19
- end
20
-
21
- def describe_templates(mos, machine)
22
- return :not_created if machine.id.nil?
23
-
24
- # Find the templates
25
- server = (mos.describe_templates())
26
- puts 4
27
- if server.nil? || [:"deleting"].include?(server["status"])
28
- # The machine can't be found
29
- @logger.info("Machine not found or terminated, assuming it got destroyed.")
30
- machine.id = nil
31
- return :not_created
32
- end
33
- puts 5
34
- puts server["Template"]
35
-
36
- end
37
- end
38
- end
39
- end
40
- end