FlashArray-Collection icon indicating copy to clipboard operation
FlashArray-Collection copied to clipboard

In purefa_token, main doesn't pull in the module defautls

Open lotaris-xx opened this issue 1 year ago • 9 comments

Describe the bug The purefa_token module main() should grab purefa_argument_spec() and the update() the spec with module parameters, but it does not. This causes what looks like a cert error, but is actually a keyerror about disable_warnings. disable_warnings is defined in purefa_argument_spec globally.

To Reproduce Steps to reproduce the behavior: Use 1.29.0 or greater of the collection and try to run the purefa_token module.

Expected behavior Expect the token operation to succeed.

Additional context Will submit PR.

lotaris-xx avatar Aug 13 '24 21:08 lotaris-xx

@lotaris-xx I'm not sure doing what you suggest will work. Thi smodukle is effectively a standalone module that was only added reluctantly. What appears to have happened is that when we added disable_warnings to the main util module, we forgot to add it to this module. We'll get it fixed .

sdodsley avatar Aug 13 '24 21:08 sdodsley

The correct method for resolving this should be in #615 Please check this to see it it works

sdodsley avatar Aug 14 '24 15:08 sdodsley

Whacky. Every other module uses the method in 614 for this property.

lotaris-xx avatar Aug 14 '24 15:08 lotaris-xx

I did fix the linting and import error in #615, so it will hopefully pass pipelines now.

lotaris-xx avatar Aug 14 '24 15:08 lotaris-xx

That is because this module is slighlty different to the other modules. It is primarily used to create an API token for a user when only the password is known and therefore we have to use an old authentication method. In fact we originally didn't even publish this module, because only wanted to authenticate with tokens and not passwords, but we were 'forced to' by a large customer...

sdodsley avatar Aug 14 '24 15:08 sdodsley

That makes sense. We use central auth on all of our arrays and for each ansible job we first create a 1day token and use that for the rest of the job and then delete the token at the end of the job. Keeps us from having to have a list of tokens vaulted somewhere that we have to then manage/rotate regularly. Interested to hear what the recommended workflow would be for automation across a large # of arrays, probably a good conversation for another forum.

lotaris-xx avatar Aug 14 '24 15:08 lotaris-xx

@lotaris-xx does this patch resolve your issue? We are going to release a new collection soon and want to add this fix into it, assuming it works for you

sdodsley avatar Aug 15 '24 17:08 sdodsley

I can let you know by EOD tomorrow. Thanks, -Allen

lotaris-xx avatar Aug 15 '24 18:08 lotaris-xx

Our test session has slipped to Monday, so we will update then.

lotaris-xx avatar Aug 16 '24 16:08 lotaris-xx

Works great. Thanks!

lotaris-xx avatar Aug 19 '24 20:08 lotaris-xx