xorpaul / g10k

my r10k fork in Go
Apache License 2.0
127 stars 51 forks source link

`g10k -force` changes `basedir` to directory, even if link #106

Closed hybby closed 5 years ago

hybby commented 6 years ago

This seems to be an odd one. I've got my environmentdir configured as a symlink to /vol/environments, which is a separate volume:

$ watch "stat $(puppet config print environmentpath) | grep File:"
Every 2.0s: stat /etc/puppetlabs/code/environments | grep File:                                                                                                                          Mon Jul 16 02:10:28 2018

  File: ‘/etc/puppetlabs/code/environments’ -> ‘/vol/environments’

As soon as I execute g10k with the -force flag, my environmentdir becomes a directory again, after -force bombs out with an error:

# g10k -config /etc/g10k.yaml -branch feature/drew-puppetserver -branch bootstrap -force
Resolving Git modules (0/1)   --- [--------------------------------------------------------------------]   0%
Resolving Forge modules (21/21)   2ms [====================================================================] 100%
Error: Can't hardlink Forge module files over different devices. Please consider changing the cachdir setting. ForgeCachedir: /vol/cache/forge/ target dir: /etc/puppetlabs/code/environments/bootstrap/fanduel/puppet_agent/
$ watch "stat $(puppet config print environmentpath) | grep File:"
Every 2.0s: stat /etc/puppetlabs/code/environments | grep File:                                                                                                                          Mon Jul 16 02:21:28 2018

  File: ‘/etc/puppetlabs/code/environments’

Would it be possible to alter g10k to only purge the contents of the basedir rather than removing it completely?

xorpaul commented 6 years ago

Yeah, I haven't considered the possibility that the environmentdir could be a symlink. Let me have a look.

Out of interest: why do trigger g10k with the -force parameter in the first place?

hybby commented 6 years ago

I was troubleshooting another issue where it didn't seem like modules were being installed where I expected them to be based on the directives in my Puppetfile (#107) and thought I'd be a bit more aggressive.

I'm not using it regularly, but the behavior surprised me slightly - since the option exists, it's okay to use, right? :)

xorpaul commented 6 years ago

Hmm, I can't reproduce the change of the basedir from a symlink to a directory after a g10k run.

Are you sure that the Puppetserver isn't changing its environmentpath from a symlink to a directory? Why did you use a watch to check if it's still a symlink or a file? If g10k is really responsible then it should be a directory and not a symlink directly after the g10k run.

Can you please try to reproduce the error yourself and use the -debug parameter and post it here?

xorpaul commented 5 years ago

Fixed with commit 00085174c43a2e1e063b1f01a3f86bab0b99906c