vm_shepherd 0.6.1 → 0.6.2

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c82c7eed07583a424d08e6842d8a9f2e45b20d4
4
- data.tar.gz: 090fc9d93efdb780673d12029f51215f75fe261d
3
+ metadata.gz: 5e0041fdb5de68db4a89d35a6ac7d63c3527ee5e
4
+ data.tar.gz: 52c115a847e444db37c319fae1c3ce3fd0da8f94
5
5
  SHA512:
6
- metadata.gz: 7ac89a80088fbea22fe0bfd0121ed26a38739c1c62e48bd7eed65b0d6c66db3b9737a72bb60f458cf9949ca812528495f672d85bb3f777a0eece4fe2d666a837
7
- data.tar.gz: a3f96ba965202ea3ebf8a52e771424f33c4181d359ccb2ebb6a630f5d3592d0b078f783e067f6c9188627d8c4e14c78fc1ee1701e4e0f26a918f680db33cb0c0
6
+ metadata.gz: 77ee7563d67a92c965926d267764054427045c13b63e2af4a589f7e804f04ca742a4f002e96122c4a19a8077b23ab9f0dc13ecf65ab34f986e56cc0166f87a9c
7
+ data.tar.gz: 06e1848574c06035f8bf608fe4bba5f3c8fa2777e0bca913094c930cf323a10e527c7d423308157ca368a2dc1333bd5af33fdd9e2eeb65ee2b22c8d8a414e666
@@ -136,6 +136,7 @@ module VmShepherd
136
136
  dns: vm.dns,
137
137
  ntp: vm.ntp,
138
138
  catalog: settings.vm_shepherd.vdc.catalog,
139
+ network: settings.vm_shepherd.vdc.network,
139
140
  }
140
141
  end
141
142
 
@@ -59,34 +59,43 @@ module VmShepherd
59
59
  end
60
60
 
61
61
  def deploy_vapp(ovf_dir, vapp_config)
62
+ vapp_name = vapp_config.fetch(:name)
63
+ catalog = vapp_config.fetch(:catalog)
64
+ network = vapp_config.fetch(:network)
62
65
  # setup the catalog
63
- client.delete_catalog_by_name(vapp_config[:catalog]) if client.catalog_exists?(vapp_config[:catalog])
64
- catalog = client.create_catalog(vapp_config[:catalog])
66
+ client.delete_catalog_by_name(catalog) if client.catalog_exists?(catalog)
67
+ catalog = client.create_catalog(catalog)
65
68
 
66
69
  # upload template and instantiate vapp
67
- catalog.upload_vapp_template(@vdc_name, vapp_config[:name], ovf_dir)
70
+ catalog.upload_vapp_template(@vdc_name, vapp_name, ovf_dir)
68
71
 
69
72
  # instantiate template
70
- network_config = VCloudSdk::NetworkConfig.new(vapp_config[:network], 'Network 1')
71
- catalog.instantiate_vapp_template(
72
- vapp_config[:name], @vdc_name, vapp_config[:name], nil, nil, network_config)
73
+ network_config = VCloudSdk::NetworkConfig.new(network, 'Network 1')
74
+ catalog.instantiate_vapp_template(vapp_name, @vdc_name, vapp_name, nil, nil, network_config)
73
75
  rescue => e
74
76
  @logger.error(e.http_body) if e.respond_to?(:http_body)
75
77
  raise e
76
78
  end
77
79
 
78
80
  def reconfigure_vm(vapp, vapp_config)
79
- vm = vapp.find_vm_by_name(vapp_config[:name])
80
- vm.product_section_properties = build_properties(vapp_config)
81
+ vapp_name = vapp_config.fetch(:name)
82
+ gateway = vapp_config.fetch(:gateway)
83
+ dns = vapp_config.fetch(:dns)
84
+ ntp = vapp_config.fetch(:ntp)
85
+ ip = vapp_config.fetch(:ip)
86
+ netmask = vapp_config.fetch(:netmask)
87
+
88
+ vm = vapp.find_vm_by_name(vapp_name)
89
+ vm.product_section_properties = build_properties(gateway: gateway, dns: dns, ntp: ntp, ip: ip, netmask: netmask)
81
90
  vm
82
91
  end
83
92
 
84
- def build_properties(vapp_config)
93
+ def build_properties(gateway:, dns:, ntp:, ip:, netmask:)
85
94
  [
86
95
  {
87
96
  'type' => 'string',
88
97
  'key' => 'gateway',
89
- 'value' => vapp_config[:gateway],
98
+ 'value' => gateway,
90
99
  'password' => 'false',
91
100
  'userConfigurable' => 'true',
92
101
  'Label' => 'Default Gateway',
@@ -95,7 +104,7 @@ module VmShepherd
95
104
  {
96
105
  'type' => 'string',
97
106
  'key' => 'DNS',
98
- 'value' => vapp_config[:dns],
107
+ 'value' => dns,
99
108
  'password' => 'false',
100
109
  'userConfigurable' => 'true',
101
110
  'Label' => 'DNS',
@@ -104,7 +113,7 @@ module VmShepherd
104
113
  {
105
114
  'type' => 'string',
106
115
  'key' => 'ntp_servers',
107
- 'value' => vapp_config[:ntp],
116
+ 'value' => ntp,
108
117
  'password' => 'false',
109
118
  'userConfigurable' => 'true',
110
119
  'Label' => 'NTP Servers',
@@ -122,7 +131,7 @@ module VmShepherd
122
131
  {
123
132
  'type' => 'string',
124
133
  'key' => 'ip0',
125
- 'value' => vapp_config[:ip],
134
+ 'value' => ip,
126
135
  'password' => 'false',
127
136
  'userConfigurable' => 'true',
128
137
  'Label' => 'IP Address',
@@ -131,7 +140,7 @@ module VmShepherd
131
140
  {
132
141
  'type' => 'string',
133
142
  'key' => 'netmask0',
134
- 'value' => vapp_config[:netmask],
143
+ 'value' => netmask,
135
144
  'password' => 'false',
136
145
  'userConfigurable' => 'true',
137
146
  'Label' => 'Netmask',
@@ -1,3 +1,3 @@
1
1
  module VmShepherd
2
- VERSION = '0.6.1'.freeze
2
+ VERSION = '0.6.2'.freeze
3
3
  end
@@ -35,6 +35,7 @@ module VmShepherd
35
35
  dns: settings.vm_shepherd.vapp.dns,
36
36
  ntp: settings.vm_shepherd.vapp.ntp,
37
37
  catalog: settings.vm_shepherd.vdc.catalog,
38
+ network: settings.vm_shepherd.vdc.network,
38
39
  }
39
40
  )
40
41
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vm_shepherd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ops Manager Team