xorpaul / g10k

my r10k fork in Go
Apache License 2.0
125 stars 50 forks source link

Puppetfile option with a config file #71

Open mchouque opened 7 years ago

mchouque commented 7 years ago

Hello,

This issue is somewhat related to issue #70 where with r10k, I can have both a simple config file and still use: puppetfile install.

My yaml config (r10k.yaml) file contains:

---
cachedir: /tmp/somerandomdirectory
forge: {baseurl: 'http://myforge:42080'}
git:
    private_key: /home/user/.ssh/id_rsa
    provider: rugged

And I run r10k with the following options (which works properly):

r10k -c r10k.yaml puppetfile install -v info --puppetfile Puppetfile --moduledir modules

If I try the same thing with g10k, I get this message "-puppetfile parameter is not allowed with -config parameter" which is different from what r10k supports: is there a reason for that?

So either:

Cheers, Mathieu

xorpaul commented 7 years ago

Is the Puppetfile you want to use located in the same directory as your r10k.yaml file? Do you only use one Puppetfile?

By default g10k looks inside defined sources for a Puppetfile and resolves those modules.

See https://github.com/xorpaul/g10k/blob/master/test.yaml and https://github.com/xorpaul/g10k-environment

mchouque commented 7 years ago

Right, my Puppetfile and r10k.yaml are in the same directory and I only use one Puppetfile.

Thing is, to use a source I have to define a remote which I have no use for (unless I misunderstood something: "config setting remote is not set for source operations in config file r10k.yaml").

My use case is somewhat special as I generate the Puppetfile on the fly to execute compilation checks. The CI gets the Puppetfile from the control-repo and then modifies module lines by changing either tag, version, branch to compile against the appropriate target(s).

So it can't really come from a repo, hence why with r10k it doesn't. And having it in a repo doesn't make much sense either as the file is short lived and doesn't need to be kept around. Also it could be messy to store it in a repo as I'd have to have multiple branches (or something similar) as I can have concurrent compilations.

mchouque commented 6 years ago

Hello,

I found a work around for this so I'm closing this issue.

Thanks for all the other things you added for me, it's very much appreciated!

Regards, Mathieu

xorpaul commented 6 years ago

Could you tell me about your workaround?

Maybe others could also use it as well.

mchouque commented 6 years ago

It's definitely an ugly workaround but it works for me (TM).

In a nutshell I created a repo which contains only one symbolic link: Puppetfile -> ../../Puppetfile

This way g10k is happy: there's a Puppetfile in a repo and it points to the one I modified.

xorpaul commented 6 years ago

Thanks for the info.

I'll leave this open, so I can add the config with puppetfile mode later.