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

getconfig fails if template contains a placeholder that is not enclosed in quotes #414

Closed
yasufs opened this issue Nov 13, 2019 · 1 comment

Comments

@yasufs
Copy link

yasufs commented Nov 13, 2019

  • iotedgedev Version: 2.1.0
  • Python Version: 3.7.4
  • Pip Version: 19.2.3
  • Development machine OS Version: Ubuntu 18.04
  • IoT Edge device OS Version: n/a

Steps to Reproduce:

  1. Author a deployment.template.json file that contains environment variable placeholders not enclosed in quotes. For example, the properties.desired section might contain something like this:
    "boolean_value": $ENV_VAR_THAT_CONTAINS_BOOLEAN,
  2. Author a .env file that defines this environment variable to be a JSON boolean value:
    ENV_VAR_THAT_CONTAINS_BOOLEAN=true
  3. Run iotedgedev genconfig --file deployment.template.json

Expected:
Generates deployment.json file that contains something like "boolean_value": true,, which is valid JSON.

Actual:
Tool aborts with an error like ERROR: Expecting value: line xxx column yyy (char zzz)

This used to work fine with version 2.0.2.

@blackchoey
Copy link
Collaborator

Hi @yasufs This error will be fixed in next release. In 2.1.0 we added schema validations for deployment.template.json and the generated deployment.json. The error is because your deployment.template.json is not a valid json due to the use of environment variable. You can install v2.0.2 to skip the validations temporary.
By the way, environment variables are always strings. The tool won't prevent you from using environment variables as other types, but it's not a best practice.

blackchoey added a commit that referenced this issue Nov 29, 2019
blackchoey added a commit that referenced this issue Dec 2, 2019
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

2 participants