Skip to content

Commit

Permalink
fix broken code
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Nov 16, 2022
1 parent b712e0c commit ff9c0c5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 25 deletions.
43 changes: 24 additions & 19 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-11-16 15:12:16 UTC using RuboCop version 1.22.3.
# on 2022-11-16 15:26:02 UTC using RuboCop version 1.22.3.
# 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
Expand All @@ -26,30 +26,12 @@ Lint/RedundantCopDisableDirective:
Exclude:
- 'lib/puppet/provider/cs_colocation/pcs.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: AllowedMethods.
# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal?
Lint/RedundantSafeNavigation:
Exclude:
- 'lib/puppet/provider/cs_primitive/crm.rb'
- 'lib/puppet/provider/cs_primitive/pcs.rb'

# Offense count: 1
# Cop supports --auto-correct.
Lint/RedundantStringCoercion:
Exclude:
- 'lib/puppet/provider/cs_rsc_defaults/pcs.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: AllowedMethods.
# AllowedMethods: present?, blank?, presence, try, try!
Lint/SafeNavigationConsistency:
Exclude:
- 'lib/puppet/provider/cs_primitive/crm.rb'
- 'lib/puppet/provider/cs_primitive/pcs.rb'

# Offense count: 1
# Configuration parameters: CheckForMethodsWithNoSideEffects.
Lint/Void:
Expand Down Expand Up @@ -91,3 +73,26 @@ RSpec/RepeatedExampleGroupBody:
Style/CaseLikeIf:
Exclude:
- 'lib/puppet/provider/cs_colocation/pcs.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: IgnoredMethods.
# IgnoredMethods: ==, equal?, eql?
Style/ClassEqualityComparison:
Exclude:
- 'lib/puppet/provider/cs_primitive/crm.rb'
- 'lib/puppet/provider/cs_primitive/pcs.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Exclude:
- 'lib/puppet/provider/cs_primitive/crm.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
# AllowedMethods: present?, blank?, presence, try, try!
Style/SafeNavigation:
Exclude:
- 'lib/puppet/provider/cs_primitive/pcs.rb'
6 changes: 4 additions & 2 deletions lib/puppet/provider/cs_primitive/crm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ def flush
end
end
end
if @resource&.instance_of?(:cs_primitive) && @resource[:unmanaged_metadata]
if @resource && @resource.class.name == :cs_primitive && @resource[:unmanaged_metadata]
@resource[:unmanaged_metadata].each do |parameter_name|
@property_hash[:metadata][parameter_name] = @property_hash[:existing_metadata]['target-role'] if @property_hash[:existing_metadata] && @property_hash[:existing_metadata][parameter_name]
if @property_hash[:existing_metadata] && @property_hash[:existing_metadata][parameter_name]
@property_hash[:metadata][parameter_name] = @property_hash[:existing_metadata]['target-role']
end
end
end
unless @property_hash[:parameters].empty?
Expand Down
6 changes: 3 additions & 3 deletions lib/puppet/provider/cs_primitive/pcs.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
# frozen_string_literal: false

begin
require 'puppet_x/voxpupuli/corosync/provider/pcs'
Expand Down Expand Up @@ -266,10 +266,10 @@ def flush
end

# Clear all metadata structures when specified
if @resource&.instance_of?(:cs_primitive) && @resource[:unmanaged_metadata]
if @resource && @resource.class.name == :cs_primitive && @resource[:unmanaged_metadata]
@resource[:unmanaged_metadata].each do |parameter_name|
@property_hash[:metadata].delete(parameter_name)
@property_hash[:existing_metadata]&.delete(parameter_name)
@property_hash[:existing_metadata].delete(parameter_name) if @property_hash[:existing_metadata]
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/type/cs_primitive.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
# frozen_string_literal: false

require 'puppet/parameter/boolean'

Expand Down

0 comments on commit ff9c0c5

Please sign in to comment.