vagrant-iijgp 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.ja.md CHANGED
@@ -35,7 +35,7 @@ $ vagrant up --provider=iijgp
35
35
  まず、はじめにダミーの box を任意の名前で追加します:
36
36
 
37
37
  ~~~~ {.shell}
38
- $ vagrant box add dummy https://...
38
+ $ vagrant box add dummy https://github.com/iij/vagrant-iijgp/raw/master/dummy.box
39
39
  ....
40
40
  ~~~~
41
41
 
@@ -75,6 +75,17 @@ SSH と provisioning が行なわれます。
75
75
  export VAGRANT_DEFAULT_PROVIDER=iijgp
76
76
  ~~~~
77
77
 
78
+ ## Commands
79
+
80
+ - `gc-list`:
81
+ Vagrantfile 内で設定されている仮想サーバの一覧を、IP アドレスや仮想サーバの品目などとあわせて表示します。
82
+
83
+ ~~~~ {.shell}
84
+ $ vagrant gc-list
85
+ gpXXXXXXXX gcYYYYYYYY V240 CentOS6_64_U L XXX.XXX.XX.XX XX.XXX.XX.XX label
86
+ ~~~~
87
+
88
+
78
89
  ## Box Format
79
90
 
80
91
  全ての Vagrant provider は、それ用にカスタムの box を導入する必要があります。
data/README.md CHANGED
@@ -77,6 +77,16 @@ export VAGRANT_DEFAULT_PROVIDER=iijgp
77
77
  ~~~~
78
78
  then you can simply run `vagrant up` with iijgp provider.
79
79
 
80
+ ## Commands
81
+
82
+ - `gc-list`:
83
+ List all VMs known in Vagrantfile. It also displays their IP addresses, VM Type, and Labels.
84
+
85
+ ~~~~ {.shell}
86
+ $ vagrant gc-list
87
+ gpXXXXXXXX gcYYYYYYYY V240 CentOS6_64_U L XXX.XXX.XX.XX XX.XXX.XX.XX label
88
+ ~~~~
89
+
80
90
  ## Box Format
81
91
 
82
92
  Every provider in Vagrant must introduce a custom box format.
@@ -90,6 +90,15 @@ module VagrantPlugins
90
90
  end
91
91
  end
92
92
 
93
+ def self.action_gc_list
94
+ Vagrant::Action::Builder.new.tap do |b|
95
+ b.use ConfigValidate
96
+ b.use PrepareIIJAPI
97
+ b.use DescribeVirtualMachine
98
+ b.use GcList
99
+ end
100
+ end
101
+
93
102
  def self.action_read_ssh_info
94
103
  Vagrant::Action::Builder.new.tap do |b|
95
104
  b.use ConfigValidate
@@ -170,6 +179,8 @@ module VagrantPlugins
170
179
  autoload :MessageNotCreated, action_root.join("message_not_created")
171
180
  autoload :MessageWillNotDestroy, action_root.join("message_will_not_destroy")
172
181
  autoload :PrepareIIJAPI, action_root.join("prepare_iijapi")
182
+ autoload :DescribeVirtualMachine, action_root.join("describe_virtual_machine")
183
+ autoload :GcList, action_root.join("gc_list")
173
184
  autoload :ReadSSHInfo, action_root.join("read_ssh_info")
174
185
  autoload :ReadState, action_root.join("read_state")
175
186
  autoload :SetLabel, action_root.join("set_label")
@@ -0,0 +1,22 @@
1
+ module VagrantPlugins
2
+ module ProviderIijGp
3
+ module Action
4
+ class DescribeVirtualMachine
5
+ def initialize(app, env)
6
+ @app = app
7
+ @logger = Log4r::Logger.new("vagrant_iijgp::action::describe_virtual_machine")
8
+ end
9
+
10
+ def call(env)
11
+ env[:describe_virtual_machine_info] = read_info(env[:iijapi], env[:machine])
12
+
13
+ @app.call(env)
14
+ end
15
+
16
+ def read_info(cli, machine)
17
+ cli.gp(machine.provider_config.gp_service_code).gc(machine.id).info
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,31 @@
1
+ module VagrantPlugins
2
+ module ProviderIijGp
3
+ module Action
4
+ class GcList
5
+ def initialize(app, env)
6
+ @app = app
7
+ @logger = Log4r::Logger.new("vagrant_iijgp::action::gc_list")
8
+ end
9
+
10
+ def call(env)
11
+ info = env[:describe_virtual_machine_info]
12
+ puts [
13
+ env[:machine].provider_config.gp_service_code,
14
+ info['GcServiceCode'],
15
+ info['VirtualMachineType'],
16
+ info['OS'],
17
+ info['Location'],
18
+ info['GlobalAddress']['IPv4Address'],
19
+ info['PrivateAddress']['IPv4Address'],
20
+ info['Label']
21
+ ].join("\t")
22
+
23
+ @app.call(env)
24
+ end
25
+
26
+ def show(env, gc)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,11 @@
1
+ module VagrantPlugins
2
+ module ProviderIijGp
3
+ class GcListCommand < Vagrant.plugin(2, :command)
4
+ def execute
5
+ with_target_vms(nil, :provider => "iijgp") do |vm|
6
+ vm.action(:gc_list)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -23,6 +23,11 @@ module VagrantPlugins
23
23
  Provider
24
24
  end
25
25
 
26
+ command(:'gc-list') do
27
+ require_relative "command"
28
+ GcListCommand
29
+ end
30
+
26
31
  def self.setup_logging
27
32
  require "log4r"
28
33
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module ProviderIijGp
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-iijgp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-13 00:00:00.000000000 Z
12
+ date: 2014-02-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: iij-sakagura
@@ -129,7 +129,9 @@ files:
129
129
  - lib/vagrant-iijgp/action/boot.rb
130
130
  - lib/vagrant-iijgp/action/check_running.rb
131
131
  - lib/vagrant-iijgp/action/create_vm.rb
132
+ - lib/vagrant-iijgp/action/describe_virtual_machine.rb
132
133
  - lib/vagrant-iijgp/action/destroy.rb
134
+ - lib/vagrant-iijgp/action/gc_list.rb
133
135
  - lib/vagrant-iijgp/action/is_created.rb
134
136
  - lib/vagrant-iijgp/action/is_stopped.rb
135
137
  - lib/vagrant-iijgp/action/message_already_running.rb
@@ -143,6 +145,7 @@ files:
143
145
  - lib/vagrant-iijgp/action/stop_virtual_machine.rb
144
146
  - lib/vagrant-iijgp/action/sync_folders.rb
145
147
  - lib/vagrant-iijgp/action/vagrant_tweaks.rb
148
+ - lib/vagrant-iijgp/command.rb
146
149
  - lib/vagrant-iijgp/config.rb
147
150
  - lib/vagrant-iijgp/errors.rb
148
151
  - lib/vagrant-iijgp/plugin.rb
@@ -177,3 +180,4 @@ signing_key:
177
180
  specification_version: 3
178
181
  summary: Vagrant plugin for IIJ GIO Hosting Package service
179
182
  test_files: []
183
+ has_rdoc: