Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Literal '%2F' in document name #71

Open
bryanandrews opened this issue Feb 16, 2018 · 3 comments
Open

Literal '%2F' in document name #71

bryanandrews opened this issue Feb 16, 2018 · 3 comments

Comments

@bryanandrews
Copy link

We are using a CouchDB v2 backend and our document names look like this:

  • companya%2Fdev
  • companyb%2Fproduction
  • companyc%2Fwebserver-test-01

We have a web frontend that resolves the literal %2F to a / so it looks pretty in the GUI editor. So our hierarchy uris should be something like this:

  - "http://localhost:5984/configuration/%{fqdn}"
  - "http://localhost:5984/configuration/%{ec2_tag_company}%2F%{ec2_tag_name}"
  - "http://localhost:5984/configuration/%{ec2_tag_company}%2F%{environment}"
  - "http://localhost:5984/configuration/%{ec2_tag_company}"
  - "http://localhost:5984/configuration/%{environment}"
  - "http://localhost:5984/configuration/common"

However hiera_http is turning %2F into %252F during the lookup which means the right document isn't ever found. Is there a way to have literal %2F in the uri?

@bryanandrews
Copy link
Author

--explain output example:

  URI "http://localhost:5984/configuration/companya%2Fcompanya-dev-03"
    Original uri: "http://localhost:5984/configuration/%{ec2_tag_company}%2F%{ec2_tag_name}"
    No such key: "profiles::jvm::default"
    Returning cached value for /configuration/companya%252Fcompanya-dev-03

It looks like the URI is correct. I can use curl to verify that URI is correct and the output is JSON. However when I see the cached value the doc name isn't correct and I can see the key exists but it isn't found.

@bryanandrews
Copy link
Author

bryanandrews commented Feb 16, 2018

Curl example showing the URI works:

curl http://localhost:5984/configuration/companya%2Fcompanya-dev-03
{"_id":"companya/companya-dev-03","_rev":"1-9657c4f470e52e081f3d19eec20f269b","profiles::jvm::default":8}

@bryanandrews
Copy link
Author

I have confirmed that '%2F' in the URI is being translated to '%252F' by looking at the CouchDB access logs which is why it fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant