Initial network Pike updates
- Switched default linter to cookstyle - Renamed rake tasks to better conform with Chef conventions Change-Id: I5dd1971392fdf282d0f214dfce9dcbecc18542a8
This commit is contained in:
		@@ -1,5 +1,3 @@
 | 
			
		||||
inherit_from: .rubocop_todo.yml
 | 
			
		||||
 | 
			
		||||
AllCops:
 | 
			
		||||
  Include:
 | 
			
		||||
    - metadata.rb
 | 
			
		||||
 
 | 
			
		||||
@@ -1,27 +0,0 @@
 | 
			
		||||
# This configuration was generated by
 | 
			
		||||
# `rubocop --auto-gen-config`
 | 
			
		||||
# on 2017-08-17 14:16:15 +0200 using RuboCop version 0.47.1.
 | 
			
		||||
# The point is for the user to remove these configuration records
 | 
			
		||||
# one by one as the offenses are removed from the code base.
 | 
			
		||||
# Note that changes in the inspected code, or installation of new
 | 
			
		||||
# versions of RuboCop, may require this file to be generated again.
 | 
			
		||||
 | 
			
		||||
# Offense count: 42
 | 
			
		||||
# Configuration parameters: CountComments, ExcludedMethods.
 | 
			
		||||
Metrics/BlockLength:
 | 
			
		||||
  Max: 122
 | 
			
		||||
 | 
			
		||||
# Offense count: 9
 | 
			
		||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
 | 
			
		||||
# SupportedStyles: nested, compact
 | 
			
		||||
Style/ClassAndModuleChildren:
 | 
			
		||||
  Exclude:
 | 
			
		||||
    - 'recipes/_bridge_config_example.rb'
 | 
			
		||||
    - 'recipes/default.rb'
 | 
			
		||||
    - 'recipes/fwaas.rb'
 | 
			
		||||
    - 'recipes/identity_registration.rb'
 | 
			
		||||
    - 'recipes/l3_agent.rb'
 | 
			
		||||
    - 'recipes/lbaas.rb'
 | 
			
		||||
    - 'recipes/ml2_openvswitch.rb'
 | 
			
		||||
    - 'recipes/server.rb'
 | 
			
		||||
    - 'recipes/vpnaas.rb'
 | 
			
		||||
							
								
								
									
										14
									
								
								Rakefile
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								Rakefile
									
									
									
									
									
								
							@@ -1,20 +1,20 @@
 | 
			
		||||
task default: ["test"]
 | 
			
		||||
 | 
			
		||||
task :test => [:lint, :style, :unit]
 | 
			
		||||
task :test => [:syntax, :lint, :unit]
 | 
			
		||||
 | 
			
		||||
desc "Vendor the cookbooks in the Berksfile"
 | 
			
		||||
task :berks_prep do
 | 
			
		||||
  sh %{chef exec berks vendor}
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
desc "Run FoodCritic (lint) tests"
 | 
			
		||||
task :lint do
 | 
			
		||||
  sh %{chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .}
 | 
			
		||||
desc "Run FoodCritic (syntax) tests"
 | 
			
		||||
task :syntax do
 | 
			
		||||
  sh %{chef exec foodcritic --exclude spec -f any .}
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
desc "Run RuboCop (style) tests"
 | 
			
		||||
task :style do
 | 
			
		||||
  sh %{chef exec rubocop}
 | 
			
		||||
desc "Run RuboCop (lint) tests"
 | 
			
		||||
task :lint do
 | 
			
		||||
  sh %{chef exec cookstyle}
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
desc "Run RSpec (unit) tests"
 | 
			
		||||
 
 | 
			
		||||
@@ -67,6 +67,6 @@ service 'neutron-dhcp-agent' do
 | 
			
		||||
    'template[/etc/neutron/neutron.conf]',
 | 
			
		||||
    'template [/etc/neutron/dnsmasq.conf]',
 | 
			
		||||
    "template[#{node['openstack']['network_dhcp']['config_file']}]",
 | 
			
		||||
    'rpm_package[dnsmasq]'
 | 
			
		||||
    'rpm_package[dnsmasq]',
 | 
			
		||||
  ]
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ auth_url = ::URI.decode identity_admin_endpoint.to_s
 | 
			
		||||
interfaces = {
 | 
			
		||||
  public: { url: public_endpoint('network') },
 | 
			
		||||
  internal: { url: internal_endpoint('network') },
 | 
			
		||||
  admin: { url: admin_endpoint('network') }
 | 
			
		||||
  admin: { url: admin_endpoint('network') },
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
service_pass = get_password 'service', 'openstack-network'
 | 
			
		||||
@@ -58,7 +58,7 @@ connection_params = {
 | 
			
		||||
  openstack_username:     admin_user,
 | 
			
		||||
  openstack_api_key:      admin_pass,
 | 
			
		||||
  openstack_project_name: admin_project,
 | 
			
		||||
  openstack_domain_name:    admin_domain
 | 
			
		||||
  openstack_domain_name:    admin_domain,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Register Network Service
 | 
			
		||||
 
 | 
			
		||||
@@ -64,7 +64,7 @@ service 'neutron-l3-agent' do
 | 
			
		||||
    action [:enable, :start]
 | 
			
		||||
    subscribes :restart, [
 | 
			
		||||
      'template[/etc/neutron/neutron.conf]',
 | 
			
		||||
      "template[#{node['openstack']['network_fwaas']['config_file']}]"
 | 
			
		||||
      "template[#{node['openstack']['network_fwaas']['config_file']}]",
 | 
			
		||||
    ]
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -65,6 +65,6 @@ service 'neutron-metadata-agent' do
 | 
			
		||||
  action [:enable, :start]
 | 
			
		||||
  subscribes :restart, [
 | 
			
		||||
    'template[/etc/neutron/neutron.conf]',
 | 
			
		||||
    "template[#{node['openstack']['network_metadata']['config_file']}]"
 | 
			
		||||
    "template[#{node['openstack']['network_metadata']['config_file']}]",
 | 
			
		||||
  ]
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -46,6 +46,6 @@ service 'neutron-metering-agent' do
 | 
			
		||||
  action [:enable, :start]
 | 
			
		||||
  subscribes :restart, [
 | 
			
		||||
    'template[/etc/neutron/neutron.conf]',
 | 
			
		||||
    "template[#{node['openstack']['network_metering']['config_file']}]"
 | 
			
		||||
    "template[#{node['openstack']['network_metering']['config_file']}]",
 | 
			
		||||
  ]
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -45,6 +45,6 @@ service 'neutron-openvswitch-agent' do
 | 
			
		||||
  action [:enable, :start]
 | 
			
		||||
  subscribes :restart, [
 | 
			
		||||
    'template[/etc/neutron/neutron.conf]',
 | 
			
		||||
    "template[#{plugin_file_path}]"
 | 
			
		||||
    "template[#{plugin_file_path}]",
 | 
			
		||||
  ]
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -103,7 +103,7 @@ service 'neutron-server' do
 | 
			
		||||
  subscribes :restart, [
 | 
			
		||||
    plugin_templates,
 | 
			
		||||
    'template[/etc/neutron/neutron.conf]',
 | 
			
		||||
    'remote_file[/etc/neutron/policy.json]'
 | 
			
		||||
    'remote_file[/etc/neutron/policy.json]',
 | 
			
		||||
  ].flatten
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -69,6 +69,6 @@ service 'neutron-vpn-agent' do
 | 
			
		||||
  subscribes :restart, [
 | 
			
		||||
    'template[/etc/neutron/neutron.conf]',
 | 
			
		||||
    "template[#{node['openstack']['network_vpnaas']['config_file']}]",
 | 
			
		||||
    "template[#{node['openstack']['network_fwaas']['config_file']}]"
 | 
			
		||||
    "template[#{node['openstack']['network_fwaas']['config_file']}]",
 | 
			
		||||
  ]
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ describe 'openstack-network' do
 | 
			
		||||
        %r{^exec_dirs = /sbin,/usr/sbin,/bin,/usr/bin$},
 | 
			
		||||
        /^use_syslog = false$/,
 | 
			
		||||
        /^syslog_log_facility = syslog$/,
 | 
			
		||||
        /^syslog_log_level = ERROR$/
 | 
			
		||||
        /^syslog_log_level = ERROR$/,
 | 
			
		||||
      ].each do |line|
 | 
			
		||||
        it do
 | 
			
		||||
          expect(chef_run).to render_config_file(file.name)
 | 
			
		||||
@@ -72,7 +72,7 @@ describe 'openstack-network' do
 | 
			
		||||
        /^core_plugin = ml2$/,
 | 
			
		||||
        %r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$},
 | 
			
		||||
        /^bind_host = 127\.0\.0\.1$/,
 | 
			
		||||
        /^bind_port = 9696$/
 | 
			
		||||
        /^bind_port = 9696$/,
 | 
			
		||||
      ].each do |line|
 | 
			
		||||
        it do
 | 
			
		||||
          expect(chef_run).to render_config_file(file.name)
 | 
			
		||||
@@ -80,7 +80,7 @@ describe 'openstack-network' do
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
      [
 | 
			
		||||
        %r{^root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf$}
 | 
			
		||||
        %r{^root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf$},
 | 
			
		||||
      ].each do |line|
 | 
			
		||||
        it do
 | 
			
		||||
          expect(chef_run).to render_config_file(file.name)
 | 
			
		||||
@@ -94,7 +94,7 @@ describe 'openstack-network' do
 | 
			
		||||
        /^project_domain_name = Default/,
 | 
			
		||||
        %r{^auth_url = http://127\.0\.0\.1:5000/v3$},
 | 
			
		||||
        /^password = neutron-pass$/,
 | 
			
		||||
        /^auth_type = v3password$/
 | 
			
		||||
        /^auth_type = v3password$/,
 | 
			
		||||
      ].each do |line|
 | 
			
		||||
        it do
 | 
			
		||||
          expect(chef_run).to render_config_file(file.name)
 | 
			
		||||
@@ -108,7 +108,7 @@ describe 'openstack-network' do
 | 
			
		||||
        /^username = nova$/,
 | 
			
		||||
        /^user_domain_name = Default/,
 | 
			
		||||
        /^project_domain_name = Default/,
 | 
			
		||||
        /^project_name = service$/
 | 
			
		||||
        /^project_name = service$/,
 | 
			
		||||
      ].each do |line|
 | 
			
		||||
        it do
 | 
			
		||||
          expect(chef_run).to render_config_file(file.name)
 | 
			
		||||
@@ -116,7 +116,7 @@ describe 'openstack-network' do
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
      [
 | 
			
		||||
        %(connection = mysql+pymysql://neutron:neutron@127.0.0.1:3306/neutron?charset=utf8)
 | 
			
		||||
        %(connection = mysql+pymysql://neutron:neutron@127.0.0.1:3306/neutron?charset=utf8),
 | 
			
		||||
      ].each do |line|
 | 
			
		||||
        it do
 | 
			
		||||
          expect(chef_run).to render_config_file(file.name)
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ describe 'openstack-network::identity_registration' do
 | 
			
		||||
      openstack_username: 'admin',
 | 
			
		||||
      openstack_api_key: 'admin-pass',
 | 
			
		||||
      openstack_project_name: 'admin',
 | 
			
		||||
      openstack_domain_name: 'default'
 | 
			
		||||
      openstack_domain_name: 'default',
 | 
			
		||||
    }
 | 
			
		||||
    service_name = 'neutron'
 | 
			
		||||
    service_type = 'network'
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ describe 'openstack-network::lbaas' do
 | 
			
		||||
          /^periodic_interval = 10$/,
 | 
			
		||||
          /^ovs_use_veth = false$/,
 | 
			
		||||
          /^interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver$/,
 | 
			
		||||
          /^device_driver = neutron_lbaas.drivers.haproxy.namespace_driver.HaproxyNSDriver$/
 | 
			
		||||
          /^device_driver = neutron_lbaas.drivers.haproxy.namespace_driver.HaproxyNSDriver$/,
 | 
			
		||||
        ].each do |line|
 | 
			
		||||
          expect(chef_run).to render_file(file.name).with_content(line)
 | 
			
		||||
        end
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@ describe 'openstack-network::metering_agent' do
 | 
			
		||||
      it do
 | 
			
		||||
        [
 | 
			
		||||
          /^interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver$/,
 | 
			
		||||
          /^driver = neutron.services.metering.drivers.iptables.iptables_driver.IptablesMeteringDriver$/
 | 
			
		||||
          /^driver = neutron.services.metering.drivers.iptables.iptables_driver.IptablesMeteringDriver$/,
 | 
			
		||||
        ].each do |line|
 | 
			
		||||
          expect(chef_run).to render_file(file.name).with_content(line)
 | 
			
		||||
        end
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@ describe 'openstack-network::ml2_linuxbridge' do
 | 
			
		||||
        chef_run.template('/etc/neutron/plugins/ml2/linuxbridge_agent.ini')
 | 
			
		||||
      end
 | 
			
		||||
      [
 | 
			
		||||
        /^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/
 | 
			
		||||
        /^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/,
 | 
			
		||||
      ].each do |line|
 | 
			
		||||
        it do
 | 
			
		||||
          expect(chef_run).to render_config_file(file.name)
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,7 @@ describe 'openstack-network::ml2_linuxbridge' do
 | 
			
		||||
        chef_run.template('/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini')
 | 
			
		||||
      end
 | 
			
		||||
      [
 | 
			
		||||
        /^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/
 | 
			
		||||
        /^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/,
 | 
			
		||||
      ].each do |line|
 | 
			
		||||
        it do
 | 
			
		||||
          expect(chef_run).to render_config_file(file.name)
 | 
			
		||||
 
 | 
			
		||||
@@ -102,7 +102,7 @@ describe 'openstack-network::server' do
 | 
			
		||||
            %r{^exec_dirs = /sbin,/usr/sbin,/bin,/usr/bin$},
 | 
			
		||||
            /^use_syslog = false$/,
 | 
			
		||||
            /^syslog_log_facility = syslog$/,
 | 
			
		||||
            /^syslog_log_level = ERROR$/
 | 
			
		||||
            /^syslog_log_level = ERROR$/,
 | 
			
		||||
          ].each do |line|
 | 
			
		||||
            expect(chef_run).to render_file(file.name).with_content(line)
 | 
			
		||||
          end
 | 
			
		||||
 
 | 
			
		||||
@@ -11,17 +11,17 @@ LOG_LEVEL = :fatal
 | 
			
		||||
REDHAT_OPTS = {
 | 
			
		||||
  platform: 'redhat',
 | 
			
		||||
  version: '7.1',
 | 
			
		||||
  log_level: LOG_LEVEL
 | 
			
		||||
  log_level: LOG_LEVEL,
 | 
			
		||||
}.freeze
 | 
			
		||||
UBUNTU_OPTS = {
 | 
			
		||||
  platform: 'ubuntu',
 | 
			
		||||
  version: '16.04',
 | 
			
		||||
  log_level: LOG_LEVEL
 | 
			
		||||
  log_level: LOG_LEVEL,
 | 
			
		||||
}.freeze
 | 
			
		||||
CENTOS_OPTS = {
 | 
			
		||||
  platform: 'centos',
 | 
			
		||||
  version: '7.2.1511',
 | 
			
		||||
  log_level: LOG_LEVEL
 | 
			
		||||
  log_level: LOG_LEVEL,
 | 
			
		||||
}.freeze
 | 
			
		||||
 | 
			
		||||
shared_context 'neutron-stubs' do
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user