seiso-import_master 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTcxYjBhNzczYjI0YmEyMGRjYjQ5NjVmYWE5NzIzYWQyODhhOTc1Zg==
4
+ NjdmMzQyNjc3ZTI5YTdmNGM4MGUxZDA4NzYwOTU4YzhmNjBkY2RlYQ==
5
5
  data.tar.gz: !binary |-
6
- ZTgwZTZlY2Y4ZTFiNGZhOGFkMDEzYzRmNjYyOWZhMDE4YWI3OTUwMw==
6
+ ZTgzMjBmOTNhMjhmZDA3ZmYzYzUzNTdmNTQzZGI4MThmOWNlMjc5Mg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2MwZTkxNzhiYTY0ZWIwOWI4OGJhYTFmODU4MmQ5YjU3ZGFkY2I3Y2NmMWUw
10
- MmM5OThmY2M1OGY1Yzg1M2U4NTU4ZjcwOGVkYjBmNmNmNGZiNzZlMGQxMDBi
11
- ZjNiNGNjZTg0OGQzOGU1MTJhY2MyODFlODQ0MmYwMGE5ODJlZTM=
9
+ ZThiZGYwODM2ZmQyNGUwNjcxYThlNWJiNjE2ZDhmODE1MzJiMDcwYjU3YmEx
10
+ MWQ5OGY0NTY0NDE0Mjg1ZTBjMzUyMTRiMjllZmZiYzM0MTRlMmU4OTQzZmM5
11
+ ZTkwMmNhYTU4OWU1MjdiMWJjZjc3YzU1ZDY3YWI2NjU0ZWVjNDc=
12
12
  data.tar.gz: !binary |-
13
- ZGJkOWQyZGNlNmUwNTIxNGE2NDYwYTFmYjFhMDEwNGM4OTBhMGJkM2JjYWY5
14
- MTczZDA2YTFjY2VhNjIzZTkwMjNiYjIyMjZjZmQzOTZjYjFhNTllOWRmMjM3
15
- NWJjNmJkMGJmZTA4ODIwYjZkNDAyMGRjM2UzYzYxNzFiNWYzMjc=
13
+ ZDk2YTQxZmFlZGU3MjFmYTQ1MTlhMzA0YTNhMmQyZjk3Mjg0YjM0ZWZmMTQy
14
+ N2IzMDU1ZmE1YzgxMTZjZjg1ZDE2MGU5MWMyYmZjNDQ2YWE3Y2I5YTU4NjE3
15
+ OWI2MjJhNmQxYmQ3Y2E3NGFlNjY2MDk1MDZkMGRiM2FhN2NjZGE=
data/.gitignore CHANGED
@@ -13,3 +13,4 @@
13
13
  *.o
14
14
  *.a
15
15
  mkmf.log
16
+ /.project
@@ -11,6 +11,7 @@ module Seiso
11
11
  def initialize
12
12
  @mappers = {
13
13
  'data-centers' => data_center_mapper,
14
+ 'doc-links' => doc_link_mapper,
14
15
  'environments' => environment_mapper,
15
16
  'health-statuses' => health_status_mapper,
16
17
  'infrastructure-providers' => infrastructure_provider_mapper,
@@ -66,6 +67,16 @@ module Seiso
66
67
  }
67
68
  end
68
69
 
70
+ def doc_link_mapper
71
+ ->(dl) {
72
+ {
73
+ 'title' => dl['title'],
74
+ 'href' => dl['href'],
75
+ 'description' => dl['description']
76
+ }
77
+ }
78
+ end
79
+
69
80
  def environment_mapper
70
81
  ->(e) {
71
82
  {
@@ -60,7 +60,10 @@ module Seiso
60
60
 
61
61
  # There are some special cases
62
62
  if type == 'nodes'
63
- do_import_nodes master_items
63
+ si_key = doc['serviceInstance']
64
+ do_import_nodes(si_key, master_items)
65
+ elsif type == 'services'
66
+ do_import_services master_items
64
67
  elsif type == 'service-instances'
65
68
  do_import_service_instances master_items
66
69
  else
@@ -76,12 +79,22 @@ module Seiso
76
79
  end
77
80
 
78
81
  # Imports the nodes, along with their associated IP addresses.
79
- def do_import_nodes(nodes)
82
+ def do_import_nodes(si_key, nodes)
80
83
  nips = detach_children(nodes, 'node', 'name', 'ipAddresses')
84
+ nodes.each do |n|
85
+ n['serviceInstance'] = si_key
86
+ end
81
87
  do_import_items('nodes', nodes)
82
88
  do_import_items('node-ip-addresses', nips)
83
89
  end
84
90
 
91
+ def do_import_services(services)
92
+ doc_links = detach_children(services, 'service', 'key', 'docLinks')
93
+ do_import_items('services', services)
94
+ # do_import_items('doc-links', docLinks)
95
+ doc_links.each { |dl| puts dl.to_json }
96
+ end
97
+
85
98
  # Imports the service instances, along with their associated ports and IP address roles.
86
99
  def do_import_service_instances(service_instances)
87
100
  ports = detach_children(service_instances, 'serviceInstance', 'key', 'ports')
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "seiso-import_master"
7
- spec.version = "0.0.5"
7
+ spec.version = "0.0.6"
8
8
  spec.authors = ["Willie Wheeler"]
9
9
  spec.email = ["wwheeler@expedia.com"]
10
10
  spec.summary = "Imports Seiso data master files into Seiso."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seiso-import_master
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willie Wheeler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-25 00:00:00.000000000 Z
11
+ date: 2015-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  requirements: []
96
96
  rubyforge_project:
97
- rubygems_version: 2.4.4
97
+ rubygems_version: 2.4.6
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: Imports Seiso data master files into Seiso.