Remove broken checks from providers

The latest python-neutronclient doesn't show confirmation messages anymore,
errors will be caught anyway as the client will return non-zero code

Change-Id: Id291e158f7181adede1c3876b412132a63188f83
This commit is contained in:
Sergey Kolekonov 2016-03-09 17:15:07 +03:00
parent 7fa9aaac49
commit 0402147fe0
5 changed files with 66 additions and 93 deletions

View File

@ -102,23 +102,19 @@ Puppet::Type.type(:neutron_network).provide(
results = auth_neutron('net-create', '--format=shell', results = auth_neutron('net-create', '--format=shell',
network_opts, resource[:name]) network_opts, resource[:name])
if results =~ /Created a new network:/ attrs = self.class.parse_creation_output(results)
attrs = self.class.parse_creation_output(results) @property_hash = {
@property_hash = { :ensure => :present,
:ensure => :present, :name => resource[:name],
:name => resource[:name], :id => attrs['id'],
:id => attrs['id'], :admin_state_up => attrs['admin_state_up'],
:admin_state_up => attrs['admin_state_up'], :provider_network_type => attrs['provider:network_type'],
:provider_network_type => attrs['provider:network_type'], :provider_physical_network => attrs['provider:physical_network'],
:provider_physical_network => attrs['provider:physical_network'], :provider_segmentation_id => attrs['provider:segmentation_id'],
:provider_segmentation_id => attrs['provider:segmentation_id'], :router_external => attrs['router:external'],
:router_external => attrs['router:external'], :shared => attrs['shared'],
:shared => attrs['shared'], :tenant_id => attrs['tenant_id'],
:tenant_id => attrs['tenant_id'], }
}
else
fail("did not get expected message on network creation, got #{results}")
end
end end
def destroy def destroy

View File

@ -88,24 +88,20 @@ Puppet::Type.type(:neutron_port).provide(
resource[:network_name] resource[:network_name]
) )
if results =~ /Created a new port:/ attrs = self.class.parse_creation_output(results)
attrs = self.class.parse_creation_output(results) @property_hash = {
@property_hash = { :ensure => :present,
:ensure => :present, :name => resource[:name],
:name => resource[:name], :id => attrs["id"],
:id => attrs["id"], :status => attrs["status"],
:status => attrs["status"], :tenant_id => attrs["tenant_id"],
:tenant_id => attrs["tenant_id"], :network_id => attrs["network_id"],
:network_id => attrs["network_id"], :admin_state_up => attrs["admin_state_up"],
:admin_state_up => attrs["admin_state_up"], :network_name => resource[:network_name],
:network_name => resource[:network_name], :subnet_name => resource[:subnet_name],
:subnet_name => resource[:subnet_name], :subnet_id => self.class.parse_subnet_id(attrs["fixed_ips"]),
:subnet_id => self.class.parse_subnet_id(attrs["fixed_ips"]), :ip_address => self.class.parse_ip_address(attrs["fixed_ips"])
:ip_address => self.class.parse_ip_address(attrs["fixed_ips"]) }
}
else
fail("did not get expected message on port creation, got #{results}")
end
end end
def destroy def destroy

View File

@ -86,36 +86,25 @@ Puppet::Type.type(:neutron_router).provide(
results = auth_neutron("router-create", '--format=shell', results = auth_neutron("router-create", '--format=shell',
opts, resource[:name]) opts, resource[:name])
if results =~ /Created a new router:/ attrs = self.class.parse_creation_output(results)
attrs = self.class.parse_creation_output(results) @property_hash = {
@property_hash = { :ensure => :present,
:ensure => :present, :name => resource[:name],
:name => resource[:name], :id => attrs['id'],
:id => attrs['id'], :admin_state_up => attrs['admin_state_up'],
:admin_state_up => attrs['admin_state_up'], :external_gateway_info => attrs['external_gateway_info'],
:external_gateway_info => attrs['external_gateway_info'], :status => attrs['status'],
:status => attrs['status'], :tenant_id => attrs['tenant_id'],
:tenant_id => attrs['tenant_id'], }
}
if @resource[:gateway_network_name] if @resource[:gateway_network_name]
results = auth_neutron('router-gateway-set', results = auth_neutron('router-gateway-set',
@resource[:name], @resource[:name],
@resource[:gateway_network_name]) @resource[:gateway_network_name])
if results =~ /Set gateway for router/ attrs = self.class.get_neutron_resource_attrs('router',
attrs = self.class.get_neutron_resource_attrs('router', @resource[:name])
@resource[:name]) @property_hash[:external_gateway_info] = \
@property_hash[:external_gateway_info] = \ attrs['external_gateway_info']
attrs['external_gateway_info']
else
fail(<<-EOT
did not get expected message on setting router gateway, got #{results}
EOT
)
end
end
else
fail("did not get expected message on router creation, got #{results}")
end end
end end

View File

@ -67,14 +67,10 @@ Puppet::Type.type(:neutron_router_interface).provide(
end end
results = auth_neutron(args) results = auth_neutron(args)
if results =~ /Added interface.* to router/ @property_hash = {
@property_hash = { :ensure => :present,
:ensure => :present, :name => resource[:name],
:name => resource[:name], }
}
else
fail("did not get expected message on interface addition, got #{results}")
end
end end
def router_name def router_name

View File

@ -168,27 +168,23 @@ Puppet::Type.type(:neutron_subnet).provide(
results = auth_neutron('subnet-create', '--format=shell', results = auth_neutron('subnet-create', '--format=shell',
opts, resource[:cidr]) opts, resource[:cidr])
if results =~ /Created a new subnet:/ attrs = self.class.parse_creation_output(results)
attrs = self.class.parse_creation_output(results) @property_hash = {
@property_hash = { :ensure => :present,
:ensure => :present, :name => resource[:name],
:name => resource[:name], :id => attrs['id'],
:id => attrs['id'], :cidr => attrs['cidr'],
:cidr => attrs['cidr'], :ip_version => attrs['ip_version'],
:ip_version => attrs['ip_version'], :ipv6_ra_mode => attrs['ipv6_ra_mode'],
:ipv6_ra_mode => attrs['ipv6_ra_mode'], :ipv6_address_mode => attrs['ipv6_address_mode'],
:ipv6_address_mode => attrs['ipv6_address_mode'], :gateway_ip => self.class.parse_gateway_ip(attrs['gateway_ip']),
:gateway_ip => self.class.parse_gateway_ip(attrs['gateway_ip']), :allocation_pools => self.class.parse_allocation_pool(attrs['allocation_pools']),
:allocation_pools => self.class.parse_allocation_pool(attrs['allocation_pools']), :host_routes => self.class.parse_host_routes(attrs['host_routes']),
:host_routes => self.class.parse_host_routes(attrs['host_routes']), :dns_nameservers => self.class.parse_dns_nameservers(attrs['dns_nameservers']),
:dns_nameservers => self.class.parse_dns_nameservers(attrs['dns_nameservers']), :enable_dhcp => attrs['enable_dhcp'],
:enable_dhcp => attrs['enable_dhcp'], :network_id => attrs['network_id'],
:network_id => attrs['network_id'], :tenant_id => attrs['tenant_id'],
:tenant_id => attrs['tenant_id'], }
}
else
fail("did not get expected message on subnet creation, got #{results}")
end
end end
def destroy def destroy