sakurraform 0.4.0 → 0.4.1.dev

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: a3cce78309426bf6755b1fbf2d3cfca419611c7a
4
- data.tar.gz: eea0d179c2a9f170c40ad87b8be7f0f221fbc76a
3
+ metadata.gz: 438da9159bf1065cf6e482ae108b7d2c016072e6
4
+ data.tar.gz: d67ea9981d097fd0caa9153d7f3cb3b6511ba242
5
5
  SHA512:
6
- metadata.gz: 17348e6c25ad8d48838ef40361c5724dc59283da47a23f77da8af73210106a54615c9b5c093333e6532b09d11132e446e467c5624f85df54ddb38595fded94b8
7
- data.tar.gz: 8f856f4d79dbf7420a690786359c570ff7213d2eaaad2e0c1792e67040da569293ac1cdbe835dd9d18be61066216b902aaf82751ca7f7a923ba2da1524236842
6
+ metadata.gz: cdefbd6bd789eb2e878149e047479c991c0e7eb58b9c3df6e90fd13dde33c1ab4e8bce42ad476535b5d3082ec13830c1255e6e8318f6f3632b8e860e0b142240
7
+ data.tar.gz: 7362c603bc1a1d0503161c1270ee7a90147dc9a901de1cdd2ecefa9c032b515d5d456a5eb48699b8953d0d03d42014a0a5449398c2540d03f0ca9746057e3498
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Not release or WIP
4
4
 
5
+ - Cleanup configuration of resource. (use first by default)
6
+
7
+ ## v0.4.1
8
+
9
+ - Set hostname from name
10
+
5
11
  ## v0.4.0
6
12
 
7
13
  - Support Simple L2 Switch
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source 'https://rubygems.org'
2
- gem 'fog-sakuracloud', path: '../../fog/fog-sakuracloud/'
3
2
 
4
3
  gemspec
data/README.md CHANGED
@@ -7,7 +7,6 @@ Manage Infrastructure from Code with Sakura no Cloud and Object Storage.
7
7
 
8
8
  ## TODO
9
9
 
10
- - delete resources.
11
10
  - update resources if detect diff.
12
11
 
13
12
 
@@ -122,17 +121,17 @@ $ ./bin/sakurraform status
122
121
  +----------------+-----------------------------------------------------+--------------+--------------------+-----------------+
123
122
  | defaultrouter | defaultrouter-d9805cd0-295c-0132-62c1-38e8563c85ec | 112600778154 | 133.242.242.192/28 | 133.242.242.193 |
124
123
  +----------------+-----------------------------------------------------+--------------+--------------------+-----------------+
125
- | defaultrouter2 | defaultrouter2-e2368190-295c-0132-62c1-38e8563c85ec | 112600778157 | 133.242.242.208/28 | 133.242.242.209 |
124
+ | localswitch1 | localswitch1-e2368190-295c-0132-62c1-38e8563c85ec | 112600778157 | | |
126
125
  +----------------+-----------------------------------------------------+--------------+--------------------+-----------------+
127
126
 
128
127
  Server resources
129
- +---------+----------------------------------------------+--------------+-----------------+--------+---------------------------+
130
- | name | sakurraform_name | sakura_id | ipaddress | status | last_state_changed |
131
- +---------+----------------------------------------------+--------------+-----------------+--------+---------------------------+
132
- | server1 | server1-ed6ea720-295c-0132-62c1-38e8563c85ec | 112600778159 | 133.242.242.194 | up | 2014-09-29T01:47:57+09:00 |
133
- +---------+----------------------------------------------+--------------+-----------------+--------+---------------------------+
134
- | server2 | server2-1f9f9b40-295d-0132-62c1-38e8563c85ec | 112600778162 | 133.242.242.195 | up | 2014-09-29T01:49:22+09:00 |
135
- +---------+----------------------------------------------+--------------+-----------------+--------+---------------------------+
128
+ +---------+----------------------------------------------+--------------+-----------------+----------------------------------+--------+---------------------------+
129
+ | name | sakurraform_name | sakura_id | ipaddress | network | status | last_state_changed |
130
+ +---------+----------------------------------------------+--------------+-----------------+----------------------------------+--------+---------------------------+
131
+ | server1 | server1-ed6ea720-295c-0132-62c1-38e8563c85ec | 112600778159 | 133.242.242.194 | ["112600778154", "112600778157"] | up | 2014-09-29T01:47:57+09:00 |
132
+ +---------+----------------------------------------------+--------------+-----------------+----------------------------------+--------+---------------------------+
133
+ | server2 | server2-1f9f9b40-295d-0132-62c1-38e8563c85ec | 112600778162 | 133.242.242.195 | ["112600778154", "112600778157"] | up | 2014-09-29T01:49:22+09:00 |
134
+ +---------+----------------------------------------------+--------------+-----------------+----------------------------------+--------+---------------------------+
136
135
 
137
136
  ```
138
137
 
@@ -150,17 +149,17 @@ $ sakurraform plan destroy
150
149
  +---------------+----------------------------------------------------+--------------+--------------------+-----------------+
151
150
 
152
151
  Server resources
153
- +----------+-----------------------------------------------+--------------+-----------------+--------+---------------------------+
154
- | name | sakurraform_name | sakura_id | ipaddress | status | last_state_changed |
155
- +----------+-----------------------------------------------+--------------+-----------------+--------+---------------------------+
156
- | master | master-3e88cfc0-38ed-0133-a63c-38e8563c85ec | 112700768736 | 153.120.161.244 | up | 2015-09-09T15:54:35+09:00 |
157
- +----------+-----------------------------------------------+--------------+-----------------+--------+---------------------------+
158
- | minion-1 | minion-1-8e060590-38ed-0133-a63c-38e8563c85ec | 112700768742 | 153.120.161.245 | up | 2015-09-09T15:57:53+09:00 |
159
- +----------+-----------------------------------------------+--------------+-----------------+--------+---------------------------+
160
- | minion-2 | minion-2-0420bc90-38ee-0133-a63c-38e8563c85ec | 112700768750 | 153.120.161.246 | up | 2015-09-09T16:01:46+09:00 |
161
- +----------+-----------------------------------------------+--------------+-----------------+--------+---------------------------+
162
- | minion-3 | minion-3-8f796470-38ee-0133-a63c-38e8563c85ec | 112700768763 | 153.120.161.247 | up | 2015-09-09T16:05:01+09:00 |
163
- +----------+-----------------------------------------------+--------------+-----------------+--------+---------------------------+
152
+ +----------+-----------------------------------------------+--------------+-----------------+------------------+------------------------------------+
153
+ | name | sakurraform_name | sakura_id | ipaddress | network | status | last_state_changed |
154
+ +----------+-----------------------------------------------+--------------+-----------------+------------------+------------------------------------+
155
+ | master | master-3e88cfc0-38ed-0133-a63c-38e8563c85ec | 112700768736 | 153.120.161.244 | ["112700768733"] | up | 2015-09-09T15:54:35+09:00 |
156
+ +----------+-----------------------------------------------+--------------+-----------------+------------------+------------------------------------+
157
+ | minion-1 | minion-1-8e060590-38ed-0133-a63c-38e8563c85ec | 112700768742 | 153.120.161.245 | ["112700768733"] | up | 2015-09-09T15:57:53+09:00 |
158
+ +----------+-----------------------------------------------+--------------+-----------------+---------------------------+---------------------------+
159
+ | minion-2 | minion-2-0420bc90-38ee-0133-a63c-38e8563c85ec | 112700768750 | 153.120.161.246 | ["112700768733"] | up | 2015-09-09T16:01:46+09:00 |
160
+ +----------+-----------------------------------------------+--------------+-----------------+------------------+------------------------------------+
161
+ | minion-3 | minion-3-8f796470-38ee-0133-a63c-38e8563c85ec | 112700768763 | 153.120.161.247 | ["112700768733"] | up | 2015-09-09T16:05:01+09:00 |
162
+ +----------+-----------------------------------------------+--------------+-----------------+---------------------------+---------------------------+
164
163
  This operation removes all resources from Sakura no Cloud.
165
164
  Are you sure (Type 'Yes')? Yes
166
165
  Send stop to master-3e88cfc0-38ed-0133-a63c-38e8563c85ec
@@ -26,7 +26,7 @@ module SakurraForm
26
26
  col_networks.resources.each do |net|
27
27
  unless net.resource_id
28
28
  net.resource_id = name_plus_uuid(net.name)
29
- options = net.configuration.first.merge({'name' => net.resource_id})
29
+ options = net.configuration.merge({'name' => net.resource_id})
30
30
  say("Create new #{net.mode} #{net.name}")
31
31
  case net.mode
32
32
  when 'router'
@@ -54,8 +54,8 @@ module SakurraForm
54
54
  col_servers.resources.each do |sv|
55
55
  unless sv.resource_id
56
56
  sv.resource_id = name_plus_uuid(sv.name)
57
- switch_id = resolve_sakura_id_by_combined(sv.configuration.first["switch"])
58
- options = sv.configuration.first.merge(
57
+ switch_id = resolve_sakura_id_by_combined(sv.configuration["switch"])
58
+ options = sv.configuration.merge(
59
59
  {
60
60
  "name" => sv.resource_id,
61
61
  "switch" => switch_id
@@ -65,7 +65,7 @@ module SakurraForm
65
65
  server = compute.servers.create(options)
66
66
 
67
67
  sv_network = (col_networks.resources.find {|n| n.cached_state[:id] == switch_id}).cached_state[:subnets].first
68
- sv_ipaddress = get_offset_address(sv_network["DefaultRoute"], sv.configuration.first["meta"]["network_offset"])
68
+ sv_ipaddress = get_offset_address(sv_network["DefaultRoute"], sv.configuration["meta"]["network_offset"])
69
69
  subnet ={
70
70
  :ipaddress => sv_ipaddress,
71
71
  :networkmasklen => sv_network["NetworkMaskLen"],
@@ -75,10 +75,12 @@ module SakurraForm
75
75
  disk_id = server.disks.first['ID']
76
76
  say("Associate #{sv_ipaddress} to #{sv.name}")
77
77
  volume.associate_ip_to_disk(disk_id, subnet)
78
+ say("Carve #{sv.name} as Hostname...")
79
+ volume.carve_hostname_on_disk(disk_id, sv.name)
78
80
 
79
81
  ## Regist Interfaces
80
- if sv.configuration.first["interfaces"]
81
- ifs = sv.configuration.first["interfaces"]
82
+ if sv.configuration["interfaces"]
83
+ ifs = sv.configuration["interfaces"]
82
84
  c_switches = ifs.map do |target_sw|
83
85
  say("Creating interface connected to #{target_sw}...")
84
86
  resolve_sakura_id_by_combined(target_sw)
@@ -8,7 +8,7 @@ module SakurraForm
8
8
  type = self.class.to_s.split('::').last.downcase
9
9
  @name = name
10
10
  @resource_id = resolve_id_by_name(type, name)
11
- @configuration = SakurraForm::Plans[type.to_sym].select {|a| a.name == name}
11
+ @configuration = (SakurraForm::Plans[type.to_sym].select {|a| a.name == name}).first
12
12
  @cached_state = @resource_id ? collect_cached_state(type) : nil
13
13
  enable_remote = false unless @cached_state
14
14
  @remote_state = enable_remote ? collect_remote_state : nil
@@ -4,7 +4,7 @@ module SakurraForm
4
4
  attr_reader :mode
5
5
  def initialize(name, enable_remote = false)
6
6
  super
7
- if @configuration.first.has_key?(:networkmasklen)
7
+ if @configuration.has_key?(:networkmasklen)
8
8
  @mode = 'router'
9
9
  else
10
10
  @mode = 'switch'
@@ -1,3 +1,3 @@
1
1
  module SakurraForm
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1.dev"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sakurraform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1.dev
5
5
  platform: ruby
6
6
  authors:
7
7
  - sawanoboly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-22 00:00:00.000000000 Z
11
+ date: 2015-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -187,9 +187,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
187
187
  version: '0'
188
188
  required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  requirements:
190
- - - ">="
190
+ - - ">"
191
191
  - !ruby/object:Gem::Version
192
- version: '0'
192
+ version: 1.3.1
193
193
  requirements: []
194
194
  rubyforge_project:
195
195
  rubygems_version: 2.4.8