deadc0de6 / dotdrop

Save your dotfiles once, deploy them everywhere
https://dotdrop.readthedocs.io
GNU General Public License v3.0
1.77k stars 105 forks source link

[bug] profile variables not merged on import_configs #423

Closed marczz closed 8 months ago

marczz commented 8 months ago

Dotdrop version last git commit 4044dabd from 30/11/23 tagged 1.14.0, also tested with 1.12.9

When a configuration import a sub configuration and in the main and sub config there is a profile section which has a profile variable, even if the variable in both files are distinct. Dotdrop fail with "unable to merge"

I created a simplified use case for this bug.

My main config file is

config:
  dotpath: dotfiles
  import_configs:
  - subconfig.yaml
dotfiles:
  f_test_config:
    dst: /tmp/test_config
    src: test_config
profiles:
  test:
    dotfiles:
    - f_test_config
    variables:
      onevar: "has some value"

The content of dotfiles is not relevant since it fails before using it.

The subconfig file is

config:
  dotpath: dotfiles
dotfiles:
  f_essai:
    src: essai.txt
    dst: /tmp/essai.txt
profiles:
  test:
    variables:
      somevar: "somevalue"

We should expect that the two config are merged, and the profile test has now the two variables onevar and somevar.

But when I try, I get:

$dotdrop -c config_debug.yaml install -p test
[ERR] config error: unable to merge 

A full debug log is attached debug_log.txt

deadc0de6 commented 8 months ago

Thanks for reporting this. I was able to reproduce the issue and got it fix on branch #424. If you want you can test it out, I will merge it soon.

marczz commented 8 months ago

Thank You, I have tested with some example configs, and my main dotdrop config which use variables in both main and sub-config, the branch #424 works as expected.

deadc0de6 commented 8 months ago

Awesome, this was merged in the master branch. Thanks for your help!