pec 0.2.4 → 0.2.5
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 +4 -4
- data/lib/pec/configure/user_data.rb +2 -2
- data/lib/pec/director/helper.rb +2 -2
- data/lib/pec/director/make_director.rb +1 -2
- data/lib/pec/network/port.rb +7 -7
- data/lib/pec/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff9692ce800f020d84648166b9b0efd0dd706850
|
4
|
+
data.tar.gz: 1bc2f21a9975f5b961e6a7546a1bfc39047b79aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 516b5d1eb608325daa9896903b29998c8475b69455336bc5872ca67877774a9a7f4b2a2e47c1a6b64535014e55e0b066affbdc703b52840f75a01ded22aeff57
|
7
|
+
data.tar.gz: d279871aacbbde8bdf9f7df4994531c755abca182486e3c8fd55d3cbadfd1e34c5eab43b75514328e0ad06d41b665cf7e5f294fea2ff0445d0787c98b7a2d59f
|
@@ -28,14 +28,14 @@ module Pec
|
|
28
28
|
ifcfg_content["type"] = ether.options['type'] ||'Ethernet'
|
29
29
|
ifcfg_content["onboot"] = ether.options['onboot'] || 'yes'
|
30
30
|
ifcfg_content["hwaddr"] = ether.find_port(ports).mac_address
|
31
|
-
path = ether.options['path'] || "/etc/sysconfig/network-scripts/ifcfg-#{ether.name}"
|
32
|
-
|
33
31
|
if ether.bootproto == "static"
|
34
32
|
ifcfg_content["netmask"] = ether.find_port(ports).netmask
|
35
33
|
ifcfg_content["ipaddr"] = ether.find_port(ports).ip_address
|
36
34
|
end
|
35
|
+
|
37
36
|
ifcfg_content.merge!(ether.options)
|
38
37
|
|
38
|
+
path = ether.options['path'] || "/etc/sysconfig/network-scripts/ifcfg-#{ether.name}"
|
39
39
|
{
|
40
40
|
'content' => ifcfg_content.map {|k,v| "#{k.upcase}=#{v}"}.join("\n"),
|
41
41
|
'owner' => "root:root",
|
data/lib/pec/director/helper.rb
CHANGED
@@ -22,8 +22,8 @@ module Pec
|
|
22
22
|
end if host.networks
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
{ 'nics' => ports.map { |port| { port_id: port.id } }}
|
25
|
+
def set_nics(options, ports)
|
26
|
+
ports ? options.merge({ 'nics' => ports.map { |port| { port_id: port.id } } }) : options
|
27
27
|
end
|
28
28
|
|
29
29
|
def get_security_group_id(security_groups)
|
@@ -20,8 +20,7 @@ module Pec
|
|
20
20
|
flavor_ref = Pec::Compute::Flavor.get_ref(host.flavor)
|
21
21
|
image_ref = Pec::Compute::Image.get_ref(host.image)
|
22
22
|
options = { "user_data" => Pec::Configure::UserData.make(host, ports) }
|
23
|
-
|
24
|
-
options.merge!(Pec::Director::Helper.get_nics(ports))
|
23
|
+
options = Pec::Director::Helper.set_nics(options, ports)
|
25
24
|
|
26
25
|
Pec::Compute::Server.create(host.name, image_ref, flavor_ref, options)
|
27
26
|
end
|
data/lib/pec/network/port.rb
CHANGED
@@ -21,14 +21,9 @@ module Pec
|
|
21
21
|
Pec::Network::PortState.new(name, assign_port)
|
22
22
|
end
|
23
23
|
|
24
|
-
def get_free_port_ip(ip, subnet)
|
25
|
-
port = fetch_free_port(subnet)
|
26
|
-
port ? IP.new("#{port["fixed_ips"][0]["ip_address"]}/#{ip.pfxlen}") : ip
|
27
|
-
end
|
28
|
-
|
29
24
|
def create(ip, subnet, security_group_ids)
|
30
|
-
options
|
31
|
-
options
|
25
|
+
options = set_security_group(security_group_ids)
|
26
|
+
options = set_fixed_ip(options, subnet, ip)
|
32
27
|
response = Pec::Resource.get.create_port(subnet["network_id"], options)
|
33
28
|
|
34
29
|
raise(Pec::Errors::Port, "ip:#{ip.to_addr} is not created!") unless response
|
@@ -45,6 +40,11 @@ module Pec
|
|
45
40
|
ip.to_s != subnet["cidr"] ? options.merge({ fixed_ips: [{ subnet_id: subnet["id"], ip_address: ip.to_addr}]}) : options
|
46
41
|
end
|
47
42
|
|
43
|
+
def get_free_port_ip(ip, subnet)
|
44
|
+
port = fetch_free_port(subnet)
|
45
|
+
port ? IP.new("#{port["fixed_ips"][0]["ip_address"]}/#{ip.pfxlen}") : ip
|
46
|
+
end
|
47
|
+
|
48
48
|
def delete(ip)
|
49
49
|
target_port = fetch_by_ip(ip.to_addr)
|
50
50
|
response = Pec::Resource.get.delete_port(target_port["id"]) if target_port
|
data/lib/pec/version.rb
CHANGED