(MODULES-8175) Add safety to new-pscredential helper #91
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this commit the helper function
new-pscredentialin the template used to invoke DSC resources attempted to
cast an incoming value for password to a string. When passed
a hashtable, it was unable to extract the password for use
and instead set the password as the typename for the object.
This happened when the catalog was compiled on a Puppet 5
master to apply to a Puppet 6 agent or when compiled on a
Puppet 6 master for a Puppet 5 agent and specifying the
password using the sensitive datatype.
This problem was introduced in MODULES-8597 when the tags
for rich data serialization were changed from
__pcore_type_and
__pcore_value__to the shorter__ptypeand__pvalue.After this change, the master and agent both expect different
keys for the sensitive data type, which is why this problem
only shows when the master and agent are mismatched versions.
This commit modifies the
new-pscredentialhelper functionto include handling for both strings and hashtables, and
will extract the password if possible and error loudly if
not.