Updating user.toml says hooks are recompiled, but still the values from default.toml are picked


#1

I was working on windows packages and observed this behaviour:

  • I’ve a run hook which loops through some values in default.toml
  • Once I load the service, run hook compiles by pulling in the actual values from default.toml
  • Now, when I add user.toml, I am seeing messages in habitat log on hooks compiled, but still I have the values from default.toml.

Is this expected or am I missing something?

Below is the code from run hook:

Write-Host "Starting {{pkg.name}} service"

# Set environment variables
Write-Host "Setting up environment variables!"
{{#each cfg.env_variables}}
   SETX {{@key}} {{this}} -m
{{/each}}

Environment:
OS: Windows Server 2016
Habitat version: 0.56


#2

I think this might be the bug that was fixed here: https://github.com/habitat-sh/habitat/pull/5177

It will require a release to get this all fixed up


#3

That bug was in 57-dev and was caused by the prost changes, it shouldn’t be in v56


#4

@mkvalluri can you verify if shutting the service down completely and bringing it back up refreshes the config?


#5

Nope. That didn’t work as well.
Stopped the service and restarted it.


#6

Initially I thought it is the path issue, but I do see messages in the log saying “Hooks compiled” whenever I am editing the user.toml and saving it. So, it has to be something else.


#7

Update on this:
It was my mistake. I forgot to provide section name “env_variables” in user.toml file. Once I’ve added that, everything worked.

I think we can mark this thread as solved and close it.