diff --git a/Rakefile b/Rakefile index fad9b80..75a18f7 100644 --- a/Rakefile +++ b/Rakefile @@ -24,7 +24,7 @@ end # We cannot run Test Kitchen on Travis CI yet... namespace :travis do desc 'Run tests on Travis' - task ci: %w[style unit] + task ci: %w(style unit) end # The default rake task should just run it all diff --git a/libraries/_helper.rb b/libraries/_helper.rb index e3e3f3c..75aa9ca 100644 --- a/libraries/_helper.rb +++ b/libraries/_helper.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/libraries/_junos_api_client.rb b/libraries/_junos_api_client.rb index 9f0097a..257ecfa 100644 --- a/libraries/_junos_api_client.rb +++ b/libraries/_junos_api_client.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ class ApiClient ip_ports: ::Junos::Ez::IPports, vlans: ::Junos::Ez::Vlans, lag_ports: ::Junos::Ez::LAGports, - group: ::Junos::Ez::Group + group: ::Junos::Ez::Group, }.freeze KNOWN_RESOURCES.each_pair do |resource, provider_module| @@ -62,12 +62,14 @@ def initialize(resource_name) # The `Junos::Ez` providers expect certain values # to be symbolized or requests will fail. - VALUES_TO_SYMBOLIZE = %w[auto up down half full active passive disabled].freeze + VALUES_TO_SYMBOLIZE = %w(auto up down half full active passive disabled).freeze attr_reader :resource_type attr_reader :resource_name - def initialize(resource_type, resource_name) + resource_name resource_name + + def initialize(resource_type, _resource_name) unless KNOWN_RESOURCES.keys.include?(resource_type) error_message = "Invalid resource type :#{resource_type}." error_message << " Try one of: :#{KNOWN_RESOURCES.keys.join(', :')}" @@ -75,7 +77,6 @@ def initialize(resource_type, resource_name) end @resource_type = resource_type - @resource_name = resource_name end # Writes managed resource to the candidate configuration. @@ -144,9 +145,9 @@ def updated_changed_properties(new_values, current_values) def managed_resource @managed_resource ||= begin transport.send(resource_type)[resource_name] - rescue Netconf::RpcError => e - Chef::Log.debug("Managed Resource #{resource_name} not found: #{e}") - nil + rescue Netconf::RpcError => e + Chef::Log.debug("Managed Resource #{resource_name} not found: #{e}") + nil end end @@ -217,7 +218,7 @@ def format_rpc_error(rpc_error) # fall back to ugly xml end - error_msg = <<-MSG + <<-MSG JUNOS XML REQUEST: @@ -227,8 +228,6 @@ def format_rpc_error(rpc_error) #{response.to_xml} MSG - - error_msg end end end diff --git a/libraries/_junos_api_transaction_handler.rb b/libraries/_junos_api_transaction_handler.rb index 9939689..8af883d 100644 --- a/libraries/_junos_api_transaction_handler.rb +++ b/libraries/_junos_api_transaction_handler.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ class JunosCommitTransactionHandler < Chef::Handler def report # Ensure handler is no-op in why-run mode and non-Junos platforms. - if (node['platform'] == 'junos' || (node['platform_version'].include? 'JNPR')) && !Chef::Config[:why_run] + if (platform?('junos') || (node['platform_version'].include? 'JNPR')) && !Chef::Config[:why_run] begin # on successful Chef-runs commit the transaction if success? diff --git a/libraries/_junos_api_transport.rb b/libraries/_junos_api_transport.rb index 5122bf7..3edcac2 100644 --- a/libraries/_junos_api_transport.rb +++ b/libraries/_junos_api_transport.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/libraries/platform_provider_mapping.rb b/libraries/platform_provider_mapping.rb index c385d9c..bd42ec8 100644 --- a/libraries/platform_provider_mapping.rb +++ b/libraries/platform_provider_mapping.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/libraries/provider_group_junos.rb b/libraries/provider_group_junos.rb index d074b0b..83d21fa 100644 --- a/libraries/provider_group_junos.rb +++ b/libraries/provider_group_junos.rb @@ -1,8 +1,8 @@ # -# Cookbook Name:: netdev +# Cookbook:: netdev # Provider:: group # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,9 +31,6 @@ class Provider::NetdevGroup::Junos < Provider # # This provider supports why-run mode. # - def whyrun_supported? - true - end def load_current_resource @current_resource = Chef::Resource::NetdevGroup.new(new_resource.name) @@ -74,7 +71,7 @@ def action_create @new_values[:path] = @file_path format = @new_values[:template_path].split('/')[-1].split('.') if format[1] != 'erb' - unless %w[xml text set].include? format[1] + unless %w(xml text set).include? format[1] failure_msg = "Invalid format #{format[1]} in #{@new_values[:template_path]}. Valid format values: 'xml', 'text', 'set'.\n\n" Chef::Log.fatal(failure_msg) raise(failure_msg) diff --git a/libraries/provider_interface_eos.rb b/libraries/provider_interface_eos.rb index c277d9c..cc73474 100644 --- a/libraries/provider_interface_eos.rb +++ b/libraries/provider_interface_eos.rb @@ -1,8 +1,8 @@ # -# Cookbook Name:: netdev +# Cookbook:: netdev # Provider:: interface # -# Copyright 2013, Arista Networks +# Copyright:: 2013, Arista Networks # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,9 +30,6 @@ class Provider::NetdevInterface::EOS < Provider # # This provider supports why-run mode. # - def whyrun_supported? - true - end def load_current_resource @current_resource = Chef::Resource::NetdevInterface.new(@new_resource.name) diff --git a/libraries/provider_interface_junos.rb b/libraries/provider_interface_junos.rb index 6a580cb..9e7610a 100644 --- a/libraries/provider_interface_junos.rb +++ b/libraries/provider_interface_junos.rb @@ -1,8 +1,8 @@ # -# Cookbook Name:: netdev +# Cookbook:: netdev # Provider:: interface # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,9 +31,6 @@ class Provider::NetdevInterface::Junos < Provider # # This provider supports why-run mode. # - def whyrun_supported? - true - end def load_current_resource @current_resource = Chef::Resource::NetdevInterface.new(new_resource.name) diff --git a/libraries/provider_l2_interface_eos.rb b/libraries/provider_l2_interface_eos.rb index ba72bd5..37d27d2 100644 --- a/libraries/provider_l2_interface_eos.rb +++ b/libraries/provider_l2_interface_eos.rb @@ -1,8 +1,8 @@ # -# Cookbook Name:: netdev +# Cookbook:: netdev # Provider:: l2_interface # -# Copyright 2013, Arista Networks +# Copyright:: 2013, Arista Networks # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,9 +30,6 @@ class Provider::NetdevL2Interface::EOS < Provider # # This provider supports why-run mode. # - def whyrun_supported? - true - end def load_current_resource @current_resource = Chef::Resource::NetdevL2Interface.new(new_resource.name) diff --git a/libraries/provider_l2_interface_junos.rb b/libraries/provider_l2_interface_junos.rb index ad07b69..4422509 100644 --- a/libraries/provider_l2_interface_junos.rb +++ b/libraries/provider_l2_interface_junos.rb @@ -1,8 +1,8 @@ # -# Cookbook Name:: netdev +# Cookbook:: netdev # Provider:: l2_interface # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,9 +31,6 @@ class Provider::NetdevL2Interface::Junos < Provider # # This provider supports why-run mode. # - def whyrun_supported? - true - end def load_current_resource @current_resource = Chef::Resource::NetdevL2Interface.new(new_resource.name) diff --git a/libraries/provider_lag_eos.rb b/libraries/provider_lag_eos.rb index 997e864..bf5b4e2 100644 --- a/libraries/provider_lag_eos.rb +++ b/libraries/provider_lag_eos.rb @@ -1,8 +1,8 @@ # -# Cookbook Name:: netdev +# Cookbook:: netdev # Provider:: lag # -# Copyright 2013, Arista Networks +# Copyright:: 2013, Arista Networks # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,9 +30,6 @@ class Provider::NetdevLinkAggregationGroup::EOS < Provider # # This provider supports why-run mode. # - def whyrun_supported? - true - end def load_current_resource @current_resource = Chef::Resource::NetdevLinkAggregationGroup.new(new_resource.name) diff --git a/libraries/provider_lag_junos.rb b/libraries/provider_lag_junos.rb index 1a8982a..32b22d4 100644 --- a/libraries/provider_lag_junos.rb +++ b/libraries/provider_lag_junos.rb @@ -1,8 +1,8 @@ # -# Cookbook Name:: netdev +# Cookbook:: netdev # Provider:: lag # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,9 +31,6 @@ class Provider::NetdevLinkAggregationGroup::Junos < Provider # # This provider supports why-run mode. # - def whyrun_supported? - true - end def load_current_resource @current_resource = Chef::Resource::NetdevLinkAggregationGroup.new(new_resource.name) diff --git a/libraries/provider_vlan_eos.rb b/libraries/provider_vlan_eos.rb index ef52fe7..17f6aa9 100644 --- a/libraries/provider_vlan_eos.rb +++ b/libraries/provider_vlan_eos.rb @@ -1,8 +1,8 @@ # -# Cookbook Name:: netdev +# Cookbook:: netdev # Provider:: vlan # -# Copyright 2013, Arista Networks +# Copyright:: 2013, Arista Networks # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,9 +30,6 @@ class Provider::NetdevVirtualLAN::EOS < Provider # # This provider supports why-run mode. # - def whyrun_supported? - true - end def load_current_resource @current_resource = Chef::Resource::NetdevVirtualLAN.new(new_resource.name) diff --git a/libraries/provider_vlan_junos.rb b/libraries/provider_vlan_junos.rb index 1b81d01..60824e8 100644 --- a/libraries/provider_vlan_junos.rb +++ b/libraries/provider_vlan_junos.rb @@ -1,8 +1,8 @@ # -# Cookbook Name:: netdev +# Cookbook:: netdev # Provider:: vlan # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,9 +31,6 @@ class Provider::NetdevVirtualLAN::Junos < Provider # # This provider supports why-run mode. # - def whyrun_supported? - true - end def load_current_resource @current_resource = Chef::Resource::NetdevVirtualLAN.new(new_resource.name) diff --git a/libraries/resource_group.rb b/libraries/resource_group.rb index b75d3a7..4dbdd0d 100644 --- a/libraries/resource_group.rb +++ b/libraries/resource_group.rb @@ -1,9 +1,9 @@ # -# Cookbook Name:: netdev +# Cookbook:: netdev # Resource:: JUNOS apply group # -# Copyright 2014, Chef Software, Inc. -# Copyright 2015, Juniper Network. +# Copyright:: 2014, Chef Software, Inc. +# Copyright:: 2015, Juniper Network. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,13 +30,14 @@ class Resource::NetdevGroup < Resource attr_accessor :exists alias exists? exists + resource_name :netdev_group + + default_action :create + def initialize(name, run_context = nil) super - @resource_name = :netdev_group - # Set default actions and allowed actions - @action = :create @allowed_actions.push(:create, :delete) # Set the name attribute and default attributes @@ -87,4 +88,5 @@ def template_path(arg = nil) end end end + class Chef::Provider::NetdevGroup; end diff --git a/libraries/resource_interface.rb b/libraries/resource_interface.rb index 8ef2f2e..ee5c2db 100644 --- a/libraries/resource_interface.rb +++ b/libraries/resource_interface.rb @@ -1,9 +1,9 @@ # -# Cookbook Name:: netdev +# Cookbook:: netdev # Resource:: interface # -# Copyright 2013, Arista Networks -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2013, Arista Networks +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,13 +31,14 @@ class Resource::NetdevInterface < Resource alias active? active alias exists? exists + resource_name :netdev_interface + + default_action :create + def initialize(name, run_context = nil) super - @resource_name = :netdev_interface - # Set default actions and allowed actions - @action = :create @allowed_actions.push(:create, :delete) # Set the name attribute and default attributes @@ -102,7 +103,7 @@ def speed(arg = nil) :speed, arg, kind_of: String, - equal_to: %w[auto 10m 100m 1g 10g 40g 56g 100g] + equal_to: %w(auto 10m 100m 1g 10g 40g 56g 100g) ) end @@ -117,7 +118,7 @@ def duplex(arg = nil) :duplex, arg, kind_of: String, - equal_to: %w[auto half full] + equal_to: %w(auto half full) ) end end diff --git a/libraries/resource_l2_interface.rb b/libraries/resource_l2_interface.rb index e922faa..ea897ff 100644 --- a/libraries/resource_l2_interface.rb +++ b/libraries/resource_l2_interface.rb @@ -1,9 +1,9 @@ # -# Cookbook Name:: netdev +# Cookbook:: netdev # Resource:: interface # -# Copyright 2013, Arista Networks -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2013, Arista Networks +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,13 +31,14 @@ class Resource::NetdevL2Interface < Resource alias active? active alias exists? exists + resource_name :netdev_l2_interface + + default_action :create + def initialize(name, run_context = nil) super - @resource_name = :netdev_l2_interface - # Set default actions and allowed actions - @action = :create @allowed_actions.push(:create, :delete) # Set the name attribute and default attributes diff --git a/libraries/resource_lag.rb b/libraries/resource_lag.rb index 3827bb6..e72d4cc 100644 --- a/libraries/resource_lag.rb +++ b/libraries/resource_lag.rb @@ -1,9 +1,9 @@ # -# Cookbook Name:: netdev +# Cookbook:: netdev # Resource:: lag # -# Copyright 2013, Arista Networks -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2013, Arista Networks +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,13 +31,14 @@ class Resource::NetdevLinkAggregationGroup < Resource alias active? active alias exists? exists + resource_name :netdev_lag + + default_action :create + def initialize(name, run_context = nil) super - @resource_name = :netdev_lag - # Set default actions and allowed actions - @action = :create @allowed_actions.push(:create, :delete) # Set the name attribute and default attributes @@ -92,7 +93,7 @@ def lacp(arg = nil) :lacp, arg, kind_of: String, - equal_to: %w[disable active passive] + equal_to: %w(disable active passive) ) end end diff --git a/libraries/resource_vlan.rb b/libraries/resource_vlan.rb index efac38f..cf0ac30 100644 --- a/libraries/resource_vlan.rb +++ b/libraries/resource_vlan.rb @@ -1,9 +1,9 @@ # -# Cookbook Name:: netdev +# Cookbook:: netdev # Resource:: vlan # -# Copyright 2013, Arista Networks -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2013, Arista Networks +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,13 +31,14 @@ class Resource::NetdevVirtualLAN < Resource alias active? active alias exists? exists + resource_name :netdev_vlan + + default_action :create + def initialize(name, run_context = nil) super - @resource_name = :netdev_vlan - # Set default actions and allowed actions - @action = :create @allowed_actions.push(:create, :delete) # Set the name attribute and default attributes diff --git a/metadata.rb b/metadata.rb index 9151a50..30f232a 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,10 +1,9 @@ name 'netdev' maintainer 'Chef Software, Inc.' maintainer_email 'releng@chef.io' -license 'Apache 2.0' +license 'Apache-2.0' description 'Provides a set of vendor-neutral resources for managing networking devices' -long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '2.1.0' -source_url 'https://github.com/chef-partners/netdev' if respond_to?(:source_url) -issues_url 'https://github.com/chef-partners/netdev/issues' if respond_to?(:issues_url) +source_url 'https://github.com/chef-partners/netdev' +issues_url 'https://github.com/chef-partners/netdev/issues' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cd3b7ec..5210642 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,12 +17,12 @@ require 'chefspec' # load all shared examples and shared contexts -Dir[File.expand_path('../support/**/*.rb', __FILE__)].each do |file| +Dir[File.expand_path('support/**/*.rb', __dir__)].each do |file| require(file) end # load all library files for easy mocking -libs = File.expand_path('../../libraries', __FILE__) +libs = File.expand_path('../libraries', __dir__) $LOAD_PATH.unshift(libs) unless $LOAD_PATH.include?(libs) Dir[File.join(libs, '*.rb')].each do |lib| require File.basename(lib, '.rb') diff --git a/spec/support/shared_contexts/provider_junos.rb b/spec/support/shared_contexts/provider_junos.rb index 234c0f3..59ff6fb 100644 --- a/spec/support/shared_contexts/provider_junos.rb +++ b/spec/support/shared_contexts/provider_junos.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/spec/unit/libraries/junos_api_client_spec.rb b/spec/unit/libraries/junos_api_client_spec.rb index cc5b1cb..b217545 100644 --- a/spec/unit/libraries/junos_api_client_spec.rb +++ b/spec/unit/libraries/junos_api_client_spec.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ instance end - %i[write! delete! activate! deactivate!].each do |action| + %i(write! delete! activate! deactivate!).each do |action| it "performs a config check after action: #{action}" do expect(transport).to receive(:commit?).once subject.send(action) diff --git a/spec/unit/libraries/junos_api_transport_spec.rb b/spec/unit/libraries/junos_api_transport_spec.rb index 2cd0a2f..ee58ce4 100644 --- a/spec/unit/libraries/junos_api_transport_spec.rb +++ b/spec/unit/libraries/junos_api_transport_spec.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/spec/unit/provider/group/junos_spec.rb b/spec/unit/provider/group/junos_spec.rb index 4e58ab5..eca211b 100644 --- a/spec/unit/provider/group/junos_spec.rb +++ b/spec/unit/provider/group/junos_spec.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ let(:new_resource) do new_resource = Chef::Resource::NetdevGroup.new('service_group') new_resource.template_path('services.set.erb') - new_resource.variables(services: node[:netdev][:services]) + new_resource.variables(services: node['netdev']['services']) new_resource end diff --git a/spec/unit/provider/interface/junos_spec.rb b/spec/unit/provider/interface/junos_spec.rb index e7e1ca1..0561a7b 100644 --- a/spec/unit/provider/interface/junos_spec.rb +++ b/spec/unit/provider/interface/junos_spec.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/spec/unit/provider/l2_interface/junos_spec.rb b/spec/unit/provider/l2_interface/junos_spec.rb index adc5ff4..ac8a883 100644 --- a/spec/unit/provider/l2_interface/junos_spec.rb +++ b/spec/unit/provider/l2_interface/junos_spec.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ port = double('port', exists?: true) allow(port).to receive(:[]).with(:description) { 'blahblahblah' } allow(port).to receive(:[]).with(:untagged_vlan) { 'default' } - allow(port).to receive(:[]).with(:tagged_vlans) { %w[chef-test] } + allow(port).to receive(:[]).with(:tagged_vlans) { %w(chef-test) } allow(port).to receive(:[]).with(:vlan_tagging) { true } allow(port).to receive(:[]).with(:_active) { true } port @@ -31,7 +31,7 @@ let(:new_resource) do new_resource = Chef::Resource::NetdevL2Interface.new('ge-0/0/0') - new_resource.tagged_vlans(%w[chef-test]) + new_resource.tagged_vlans(%w(chef-test)) new_resource.vlan_tagging(true) new_resource end diff --git a/spec/unit/provider/lag/junos_spec.rb b/spec/unit/provider/lag/junos_spec.rb index 343800c..9ffc511 100644 --- a/spec/unit/provider/lag/junos_spec.rb +++ b/spec/unit/provider/lag/junos_spec.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ let(:managed_resource) do lag = double('lag', exists?: true) - allow(lag).to receive(:[]).with(:links) { %w[ge-0/0/1 ge-0/0/2] } + allow(lag).to receive(:[]).with(:links) { %w(ge-0/0/1 ge-0/0/2) } allow(lag).to receive(:[]).with(:minimum_links) { 2 } allow(lag).to receive(:[]).with(:lacp) { 'disabled' } allow(lag).to receive(:[]).with(:_active) { true } @@ -30,7 +30,7 @@ let(:new_resource) do new_resource = Chef::Resource::NetdevLinkAggregationGroup.new('ae0') - new_resource.links(%w[ge-0/0/1 ge-0/0/2]) + new_resource.links(%w(ge-0/0/1 ge-0/0/2)) new_resource.minimum_links(1) new_resource.lacp('disable') new_resource diff --git a/spec/unit/provider/vlan/junos_spec.rb b/spec/unit/provider/vlan/junos_spec.rb index a3a5b5e..727fe73 100644 --- a/spec/unit/provider/vlan/junos_spec.rb +++ b/spec/unit/provider/vlan/junos_spec.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/test/fixtures/cookbooks/group/attributes/default.rb b/test/fixtures/cookbooks/group/attributes/default.rb index cc00698..b6911e2 100644 --- a/test/fixtures/cookbooks/group/attributes/default.rb +++ b/test/fixtures/cookbooks/group/attributes/default.rb @@ -1,4 +1,4 @@ -default[:netdev][:services] = [%w[ftp], %w[ssh], %w[netconf ssh]] +default[:netdev][:services] = [%w(ftp), %w(ssh), %w(netconf ssh)] default[:netdev][:bgp] = { 'internal' => { 'type' => 'internal', 'neighbor' => ['10.10.10.10', '10.10.10.11'], 'local-address' => '20.20.20.20', 'peer-as' => '100' }, 'external' => { 'type' => 'external', 'neighbor' => ['30.30.10.10', '30.30.10.11'], 'local-address' => '20.20.20.20', 'peer-as' => '200' } } diff --git a/test/fixtures/cookbooks/group/recipes/bgp_create.rb b/test/fixtures/cookbooks/group/recipes/bgp_create.rb index addeb0e..f93c68b 100644 --- a/test/fixtures/cookbooks/group/recipes/bgp_create.rb +++ b/test/fixtures/cookbooks/group/recipes/bgp_create.rb @@ -1,5 +1,5 @@ netdev_group 'bgp_group' do template_path 'bgp.xml.erb' action :create - variables(bgp: node[:netdev][:bgp]) + variables(bgp: node['netdev']['bgp']) end diff --git a/test/fixtures/cookbooks/group/recipes/service_create.rb b/test/fixtures/cookbooks/group/recipes/service_create.rb index 8d3b092..70b3992 100644 --- a/test/fixtures/cookbooks/group/recipes/service_create.rb +++ b/test/fixtures/cookbooks/group/recipes/service_create.rb @@ -1,5 +1,5 @@ netdev_group 'service_group' do template_path 'services.set.erb' action :create - variables(services: node[:netdev][:services]) + variables(services: node['netdev']['services']) end diff --git a/test/fixtures/cookbooks/group/recipes/syslog_create.rb b/test/fixtures/cookbooks/group/recipes/syslog_create.rb index 95679f4..ae92960 100644 --- a/test/fixtures/cookbooks/group/recipes/syslog_create.rb +++ b/test/fixtures/cookbooks/group/recipes/syslog_create.rb @@ -1,5 +1,5 @@ netdev_group 'syslog_group' do template_path 'syslog.text.erb' action :create - variables(syslog_names: node[:netdev][:syslog]) + variables(syslog_names: node['netdev']['syslog']) end diff --git a/test/fixtures/cookbooks/interface/recipes/create.rb b/test/fixtures/cookbooks/interface/recipes/create.rb index a48f03e..9aa2f5c 100644 --- a/test/fixtures/cookbooks/interface/recipes/create.rb +++ b/test/fixtures/cookbooks/interface/recipes/create.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/test/fixtures/cookbooks/interface/recipes/delete.rb b/test/fixtures/cookbooks/interface/recipes/delete.rb index c6b3134..a8c722a 100644 --- a/test/fixtures/cookbooks/interface/recipes/delete.rb +++ b/test/fixtures/cookbooks/interface/recipes/delete.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/test/fixtures/cookbooks/l2_interface/recipes/create.rb b/test/fixtures/cookbooks/l2_interface/recipes/create.rb index 59228d0..7a0432c 100644 --- a/test/fixtures/cookbooks/l2_interface/recipes/create.rb +++ b/test/fixtures/cookbooks/l2_interface/recipes/create.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ include_recipe 'vlan::create' netdev_l2_interface 'ge-0/0/0' do - tagged_vlans %w[chef-test] + tagged_vlans %w(chef-test) vlan_tagging true action :create end diff --git a/test/fixtures/cookbooks/l2_interface/recipes/delete.rb b/test/fixtures/cookbooks/l2_interface/recipes/delete.rb index 5993c13..246e322 100644 --- a/test/fixtures/cookbooks/l2_interface/recipes/delete.rb +++ b/test/fixtures/cookbooks/l2_interface/recipes/delete.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/test/fixtures/cookbooks/lag/recipes/create.rb b/test/fixtures/cookbooks/lag/recipes/create.rb index ab7dec4..39bced9 100644 --- a/test/fixtures/cookbooks/lag/recipes/create.rb +++ b/test/fixtures/cookbooks/lag/recipes/create.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ end netdev_lag 'ae0' do - links %w[ge-0/0/1 ge-0/0/2] + links %w(ge-0/0/1 ge-0/0/2) minimum_links 1 lacp 'disable' action :create diff --git a/test/fixtures/cookbooks/lag/recipes/delete.rb b/test/fixtures/cookbooks/lag/recipes/delete.rb index b559c31..2532ebe 100644 --- a/test/fixtures/cookbooks/lag/recipes/delete.rb +++ b/test/fixtures/cookbooks/lag/recipes/delete.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/test/fixtures/cookbooks/vlan/recipes/create.rb b/test/fixtures/cookbooks/vlan/recipes/create.rb index 46974e4..a43e02c 100644 --- a/test/fixtures/cookbooks/vlan/recipes/create.rb +++ b/test/fixtures/cookbooks/vlan/recipes/create.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/test/fixtures/cookbooks/vlan/recipes/delete.rb b/test/fixtures/cookbooks/vlan/recipes/delete.rb index 2788dc6..73281f6 100644 --- a/test/fixtures/cookbooks/vlan/recipes/delete.rb +++ b/test/fixtures/cookbooks/vlan/recipes/delete.rb @@ -1,5 +1,5 @@ # -# Copyright 2014, Chef Software, Inc. +# Copyright:: 2014, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/test/integration/lag/serverspec/lag_create_spec.rb b/test/integration/lag/serverspec/lag_create_spec.rb index 03fc67f..ca32cdf 100644 --- a/test/integration/lag/serverspec/lag_create_spec.rb +++ b/test/integration/lag/serverspec/lag_create_spec.rb @@ -4,7 +4,7 @@ include Serverspec::Helper::Exec include Serverspec::Helper::DetectOS -%w[ge-0/0/1 ge-0/0/2].each do |l2_interface| +%w(ge-0/0/1 ge-0/0/2).each do |l2_interface| describe command("cli show config interfaces #{l2_interface}") do it { should return_stdout(/802.3ad ae0;/) } end