Skip to content

Conversation

@srctarget
Copy link

Description

This is bringing forward some of the changes (Descriptions included below) from #59 :
Simplify aix_chsec
make attributes and stanza properties required for aix_chsec
Version bump to 2.2.1
Would close PR #59 with this PR

Issues Resolved

see above, non-documented but experienced in local testing

Check List

srctarget and others added 3 commits January 19, 2018 15:47
Signed-off-by: Daniel Hebert <dhebert@us.ibm.com>
@srctarget srctarget changed the title Chef13upgrade aix_chsec simplification Jan 26, 2018
srctarget and others added 4 commits January 26, 2018 10:50
Signed-off-by: Daniel Hebert <dhebert@us.ibm.com>
Signed-off-by: Daniel Hebert <dhebert@us.ibm.com>
Signed-off-by: Daniel Hebert <dhebert@us.ibm.com>
Signed-off-by: Daniel Hebert <dhebert@us.ibm.com>
metadata.rb Outdated
description 'Custom resources useful for AIX systems'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '2.2.0'
version '2.2.1'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't update the metadata version information.

@iennae
Copy link
Contributor

iennae commented Jan 31, 2018

@msgarbossa could you take a look at this PR and give your feedback if you have time? Thanks so much.

property :attributes, Hash
property :stanza, String, desired_state: false
property :attributes, Hash, required: true
property :stanza, String, desired_state: false, required: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

converting properties to required would be a major change as it would break folks using this resource previously who didn't have it included in their wrapper

change = true
chsec_s = chsec_s << " -a \"#{key}=#{new_resource.attributes[key]}\""
end
nr = @new_resource
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nr isn't a great name to use as it obscures what's happening throughout the resource.

Copy link
Contributor

@iennae iennae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes as specified in comments please.

Remove requirement on properties

Signed-off-by: Daniel Hebert <dhebert@us.ibm.com>
Remove requirement on properties

Merge branch 'Chef13upgrade' of https://github.com/srctarget/aix.git
into Chef13upgrade
Signed-off-by: Daniel Hebert <dhebert@us.ibm.com>
@srctarget
Copy link
Author

I reverted the requirements on the properties and the version in the metadata.rb file. Also re-factored nr to be new_res.

@msgarbossa
Copy link

This breaks when I test the chsec resource in a recipe with the following for setting default password policy:

aix_chsec '/etc/security/user' do
  attributes(minlen: '15', minalpha: '2')
  stanza 'default'
  action :update
end

I get the following error:

  * aix_chsec[/etc/security/user] action update

    ================================================================================
    Error executing action `update` on resource 'aix_chsec[/etc/security/user]'
    ================================================================================

    NoMethodError
    -------------
    undefined method `attributes' for nil:NilClass

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/aix/resources/chsec.rb:45:in `changed_attributes'
    /var/chef/cache/cookbooks/aix/resources/chsec.rb:109:in `block in class_from_file'

I believe the issue is with lines 45 and 46. new_resource and current_resource do not seem to be evaluating inside a def.

new_attributes     = @new_resource.attributes
current_attributes = @current_resource.attributes

@tas50
Copy link
Contributor

tas50 commented Jul 18, 2018

@srctarget Thanks for pulling this together, but there's still a merge conflict with master. If you want to get that cleared up I can merge this in.

@srctarget
Copy link
Author

Going to close this. Thank you.

@srctarget srctarget closed this Jul 19, 2018
@tas50 tas50 added Triage: Needs Information Indicates an issue needs more information in order to work on it. and removed Status: Pending Contributor Response labels Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Triage: Needs Information Indicates an issue needs more information in order to work on it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants