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!
def modifycmd(param,value)
cmd = super(param, value)
cmd << "-F"
if self.trusted == "Trusted"
cmd << ";"
cmd << "/usr/lbin/modprpw"
cmd << "-v"
cmd << "-l"
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
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