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

yaml_escape is not defined in cc_deployment_updater #141

Closed
charleshansen opened this issue Apr 26, 2019 · 4 comments
Closed

yaml_escape is not defined in cc_deployment_updater #141

charleshansen opened this issue Apr 26, 2019 · 4 comments

Comments

@charleshansen
Copy link
Contributor

Thanks for submitting an issue to capi-release. We are always trying to improve! To help us, please fill out the following template.

Issue

The cc_deployment_updater job template is only valid if other templates have been compiled first. This is true during a normal deployment, but not in bosh cck

Context

Noticed while looking at cloudfoundry/bosh#2175

Steps to Reproduce

In a cf-deployment, delete a scheduler VM in your IaaS console. (I was already at only 1 scheduler VM when I reproduced it)
Watch bosh scan-and-fix happen, you will get the errors in the linked issue undefined method yaml_escape'`
The error is from

password: <%= yaml_escape(db_role["password"]) %>

Expected result

bosh scan-and-fix can successfully recreate a scheduler VM

Current result

scheduler VM is broken forever if you delete it

Possible Fix

Define yaml_escape in all your templates
(e.g.

def yaml_escape(input_string)
chars_to_escape = /[:\\"\x00-\x1f\x7f]/
chars_needing_quotes = /[ !#'&%*,:>@\[\]\\`{|}]/
delimiter = (chars_needing_quotes.match(input_string) ||
chars_to_escape.match(input_string)) ? '"' : ''
fixed_string = input_string.gsub(/(#{chars_to_escape})/) { |m| "\\x#{'%x' % m.ord}" }
"#{delimiter}#{fixed_string}#{delimiter}"
)

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/165652848

The labels on this github issue will be updated when the story is started.

@voelzmo
Copy link

voelzmo commented May 3, 2019

Out of curiosity: why did this work on initial deployment? Are we leaking functions (and other things, potentially) defined in one template into another? My understanding was that there each job gets its own isolated set of variables for rendering? I might be wrong here and this might even be intentional – not sure about this.

/cc @mfine @jfmyers9

@tcdowney
Copy link
Member

This was fixed in cbb66b1 and will ship with the next capi-release (1.81.0). @voelzmo you might want to reach out directly to @mfine @jfmyers9 and/or create a BOSH issue for those concerns since I don't think they are tracking this repo that closely.

@charleshansen
Copy link
Contributor Author

charleshansen commented May 17, 2019

Following up @voelzmo I created an issue in Bosh about the leaking functions. cloudfoundry/bosh#2181

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

4 participants