Closed GabrielNagy closed 5 years ago
Acceptance tests are passing:
@joshcooper I've restored the functionality that creates the parent directory (in case we're writing as the user/path is not trusted), so this should not be a breaking change anymore.
Fixed the rubocop stuff, I'll squash my commits when you're good with this @joshcooper
Passing acceptance run (except for ubuntu 14.04 which is no longer in our pipeline and can be ignored): https://jenkins-master-prod-1.delivery.puppetlabs.net/view/modules/view/Core/view/sshkeys_core/view/adhoc/job/forge-module_puppetlabs-sshkeys_core_intn-sys_nightly-adhoc/2/
Previously, when the
target
property was set, the ssh_authorized_key resource could not create directories/files within root-owned paths. This behavior is due to the module switching context to the user, then attempting to create the directory/file as the specified user, ultimately failing because of insufficient permissions.This commit removes the context change logic, and creates the authorized_key file as
root
, then executesFileUtils.chown
to make it owned by the target user.This commit also removes the functionality that created parent directories, since it should not be in the scope of this module.
Cherry-picked 2 commits from @pillarsdotnet's tree, related to tests.