Closed jmontleon closed 7 years ago
Something about the 2 steps of registering curl output and ehcoing it in the second step is stripping the quotations from the payload and ends up encoding invalid JSON:
{db_name:testdb,hostname:172.30.97.67,password:dbpasswd,port:5432,username:dbuser}
The broker actually decodes this okay but then blows up trying to unmarshal that into a struct.
I changed it to a single step and that seems to avoid the strip:
- name: encode credentials shell: 'curl {{ url }} | base64 -w 0' register: encoded_bind_credentials - debug: msg: "<BIND_CREDENTIALS>{{ encoded_bind_credentials.stdout }}</BIND_CREDENTIALS>"
Produces: {"db_name":"testdb","hostname":"172.30.97.67","password":"dbpasswd","port":"5432","username":"dbuser"}
{"db_name":"testdb","hostname":"172.30.97.67","password":"dbpasswd","port":"5432","username":"dbuser"}
I don't know if this is poor ansible form, but Unmarshalling works ¯_(ツ)_/¯
@jmontleon please close this PR and migrate to apb-examples if necessary.
Something about the 2 steps of registering curl output and ehcoing it in the second step is stripping the quotations from the payload and ends up encoding invalid JSON:
{db_name:testdb,hostname:172.30.97.67,password:dbpasswd,port:5432,username:dbuser}
The broker actually decodes this okay but then blows up trying to unmarshal that into a struct.
I changed it to a single step and that seems to avoid the strip:
Produces:
{"db_name":"testdb","hostname":"172.30.97.67","password":"dbpasswd","port":"5432","username":"dbuser"}
I don't know if this is poor ansible form, but Unmarshalling works ¯_(ツ)_/¯