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

pkgPathFor writes error msg when there is integer in ServiceConfig #2067

Closed
bodymindarts opened this issue Apr 10, 2017 · 3 comments
Closed
Labels
Focus:Supervisor Related to the Habitat Supervisor (core/hab-sup) component Type: Bug Issues that describe broken functionality

Comments

@bodymindarts
Copy link
Contributor

When using {{pkgPathFor}} the error msg

shield-agent.default(HK): Failed to compile init hook: hab-sup(ER)[src/error.rs:349:8]: Error rendering "hook" line 19, col 7: "pkgPathFor" can only be used on a template bound to a service config.

is being thrown.

After debugging this a bit the issue is actually only due to a problem deserializing integers. The hook is getting rendered correctly even though the error is being displayed.

This is the printout of the error comming from this line.

hab-sup(TP): Deserialize error: Syntax(Message("invalid type: integer8080, expected any valid TOML value"), 0, 0)

the value in the context struct is:

"cfg": Object({"port": Number(PosInt(8080))}),...

#1788 mentions there being an issue in regards to deserializing integers but says bumping to serde 0.9.x should fix it. By now serde has been updated but the issue remains.

@bodymindarts
Copy link
Contributor Author

Perhaps @smurawski has some insight?
For now a workaround seems to be to use strings instead of integers in config.

bodymindarts pushed a commit to starkandwayne-attic/habitat-plans that referenced this issue Apr 10, 2017
smurawski added a commit that referenced this issue Apr 11, 2017
Update the complex_config.toml fixure to include binding info
with an integer value for a configuration item.  This exposes the bug
described in #2067

Signed-off-by: Steven Murawski <steven.murawski@gmail.com>
@smurawski
Copy link
Contributor

We did a bit of debugging/exploration and have a test that reproduces this behavior. I'm going to change our approach pkg_path_for is using and rather than hydrating this large complex ServiceConfig struct, traverse the JSON::value to the PackageInstall struct and hydrate just that (since that's the minimum we need to get the information that the helper needs.

@reset
Copy link
Collaborator

reset commented Apr 19, 2017

Closed by #2077

@reset reset closed this as completed Apr 19, 2017
@christophermaier christophermaier added Focus:Supervisor Related to the Habitat Supervisor (core/hab-sup) component Type: Bug Issues that describe broken functionality and removed A-supervisor labels Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Focus:Supervisor Related to the Habitat Supervisor (core/hab-sup) component Type: Bug Issues that describe broken functionality
Projects
None yet
Development

No branches or pull requests

5 participants