I am trying to add some functionality to the HP-UX user provider module. 
 In the past I was able to submit changes that allowed it to check for 
trusted computing and find the password crypt properly.  Unfortunately, 
even through the password was updated, HP-UX was not resetting the password 
age back to 0 days.  I have the commands required to do that and the rspec 
tests work fine on HP-UX boxes, it fails elsewhere as I am using specific 
commands to test and get data. 

I still cannot seem to wrap my head around what is passed in and how to use 
rspec to verify the function works on HP-UX without trying to run the 
command.

I know the trusted method fails to Trusted, I have not fixed that yet as I 
am trying to figure out how to properly code it so that I can override it 
in rspec to make sure nothing else is broken.

What I have added to the modify command works by checking if the HP-UX 
server is trusted or not by running the trusted method.  

I am completely confused on the right ways to make rspec work with the 
code.  I know the code works on the HP-UX hosts without issue, so that part 
is functional, I just cannot test it with rspec on Linux. 

Any help / suggestions would be greatly appreciated! 


hpux.rb 
(https://github.com/jjperry69/puppet/blob/fix/master/PUP-3801-HP-UX-User-Provider/lib/puppet/provider/user/hpux.rb)
 

  def modifycmd(param,value)
     cmd = super(param, value)
     cmd << "-F"
     if self.trusted == "Trusted"
        cmd << ";"
        cmd << "/usr/lbin/modprpw"
        cmd << "-v"
        cmd << "-l"
        cmd << "#{resource.name}"
     end
     cmd
  end

  def trusted
      trusted_sys = %x(/usr/lbin/getprpw root 2>&1)
      if trusted_sys.chomp == "System is not trusted."
         "NotTrusted"
      else
         "Trusted"
      end
  end

rspec: 
(https://github.com/jjperry69/puppet/blob/fix/master/PUP-3801-HP-UX-User-Provider/spec/unit/provider/user/hpux_spec.rb)
     it "should return modprpw for password aging on trusted systems" do
        if provider.trusted == "Trusted"
           provider_class.command(:password).should == "/usr/lbin/modprpw"
        end
     end




-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/3ff1f739-7caa-416c-8442-df2891844883%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to