chef-boneyard/chef-dk

Different chef vault variable output

webchi opened this issue · 2 comments

Environment:

kitchen 14.7.17 and ubuntu 16.04

Scenario:

I want to make output of ssl certificate that previously saved in vault and transformed in one string to be saved in json.

Steps to Reproduce:

awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' fullchain.pem #making one line with \n separated rows
knife vault create nginx certificate --file fullchain.pem
include_recipe "chef-vault"

fullchain = chef_vault_item("nginx", "fullchain")

file "#{home_dir}/nginx/ssl/cert.crt" do
        content cert['file-content']
        mode '0644'
        owner 'root'
        group 'root'
end

Expected Result:

This is how I see it on kitchen when converge. "\n" have been transformed to line breaks.

+-----BEGIN CERTIFICATE-----
+MIIDrTCCApWgAwIBAgIJAM6dy+Nn3n6yMA0GCSqGSIb3DQEBCwUAMG0xCzAJBgNV
+BAYTAlJVMRMwEQYDVQQIDApTb21lLVN0YXRlMRAwDgYDVQQKDAdGb3JjZUFJMRUw

Actual Result:

This is happening on real server. Output still with "\n"

 +-----BEGIN CERTIFICATE-----\nMIIFVTCCBD2gAwIBAgISA0mX6QHDgUzbBa+AWeIltkdeMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQ

With --file option chef-vault apply escaping to "\n". So create secrets from json files with--json option.

lock commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.