voxpupuli / modulesync

Synchronize common files across your Git repositories.
Apache License 2.0
105 stars 49 forks source link

Run msync from outside a ModuleSync configuration directory #155

Open bittner opened 6 years ago

bittner commented 6 years ago

It doesn't seem to be possible to run msync update from a location outside a directory containing a modulesync configuration.

In other words, it seems to be necessary to cd into the directory containing your configuration to be able to successfully run msync update.

$ msync update -m configs/modulesync_puppet-profile
No config file under ./config_defaults.yml found, using default values
./moduleroot/ does not exist. Check that you are working in your module configs directory or that you have passed in the correct directory with -c.
$ msync update -c configs/modulesync_puppet-profile
No config file under modulesync.yml found, using default values
No value provided for required option "--message"
$ cd configs/modulesync_puppet-profile && msync update
No config file under ./config_defaults.yml found, using default values
Syncing <repository-name>
Cloning repository fresh
Cloning from <repository-uri>.git
...

This is tedious when you manage several configurations in a single repository (in subdirectories), and loop over them. For example, our directory structure looks like this, and I'd like to run msync with the directory (or directories) as a parameter (instead of cd'ing into them).

.
├── configs/
│   ├── modulesync_puppet-hieradata/
│   │   ├── managed_modules.yml
│   │   ├── moduleroot/
│   │   │   ├── .gitignore.erb
│   │   │   └── .gitlab-ci.yml.erb
│   │   ├── modulesync.yml
│   │   └── README.md
│   └── modulesync_puppet-profile/
│       ├── managed_modules.yml
│       ├── moduleroot/
│       │   ├── .gitignore.erb
│       │   └── .gitlab-ci.yml.erb
│       ├── modulesync.yml
│       └── README.md
├── tools/
├── Gemfile
├── LICENSE
└── README.md

Is there a way to achieve this already, which I have not figured out yet? Or should we add this functionality?

bittner commented 5 years ago

Any feedback on this issue? Would adding the (seemingly) missing capability be a valuable enhancement?

bittner commented 5 years ago

Anyone any opinion on that?

bastelfreak commented 5 years ago

Hi @bittner, sorry for the slow feedback. This is a bit different from the original usecase for this tool, but I don't see why it should not be included. Are you interested in providing a PR for this?

bittner commented 5 years ago

Are you interested in providing a PR for this?

Yes, definitely. The question was: Would a related PR have a chance to be merged.

bastelfreak commented 5 years ago

definitely!