I need some help again y'all... I have this ruby f...
# puppet
g
I need some help again y'all... I have this ruby function:
Copy code
# sshd/lib/puppet/functions/sshd/create_rfc4716_authorized_keys.rb
Puppet::Functions.create_function(:'sshd::create_rfc4716_authorized_keys') do
  dispatch :default_impl do
    repeated_param 'Any', :args
  end
  def default_impl(*args)
  	pubkeys = args[0]
  	keys_contents = ""
  	pubkeys.each { |pubkey|
  		cmd = "ssh-keygen -e -f /dev/stdin <<< \"#{pubkey}\""
      key_contents = "\n" + `#{cmd}`
      key_contents = key_contents.gsub(/^Comment:.*?$/, 'Comment: "Converted by create_rfc4716_authorized_keys.rb"')
		  keys_contents = keys_contents + key_contents
  	}
  	keys_contents = keys_contents + "\n"
  	return keys_contents
  end
end
In
onceover.yaml
I have this:
Copy code
functions:
  sshd::create_rfc4716_authorized_keys:
    returns: "---- BEGIN SSH2 PUBLIC KEY ----\nAAAAB3NzaC1yc2EAAAABIwAAAQEArD1g...\n---- END SSH2 PUBLIC KEY ----\n"
In CI, it seems this function is not being mocked as
ssh-keygen
is being called as part of the Onceover run.... am I doing something wrong? I am on Onceover 3.19.2 fwiw. I checked the changelog and it says mocking functions like this one was fixed in 3.10 so I am at a loss at this point.