Windows; adding option to perform default action on a file after win_copy / win_template

I’ve been making use of the win_template module a bit and the thing I use it for most is to create a file of registry entries which I then import using raw like this:

raw: “reg.exe IMPORT {{ deployment_files_dir }}templated-registry-settings.reg”

I started thinking it might be nice if I added an option to win_template that would merge the registry entries. Because its a ‘virtual module’ it would actually be a change to win_copy module, but it would at least allow me to get rid of the ‘raw’.

The main objection I can think of to this would be that its not intuitive to look at the template module for the ability to manipulate the registry.

But then I started to think that maybe it would be better to have the option to call the default action on a file type (The default action is the one that appears in bold on the context menu when you right click on a file). It would be much more flexible than just having an option to merge the file contents into the registry, but I’m not sure if this would be a ‘too much rope’ type option.

Before I dig into this, I thought I’d ask if anyone thinks this is a good or bad idea or might have any other uses for it that I could put into examples.

Jon

I don’t think importing into the registry is the correct thing for copy or template to do.

Why not create a new module for importing registry entries?

Yes a win_registry_merge module would be an option too.

I agree just having the option to import registry settings would be strange and fails the ‘do one thing well’ test. Invoking the default action though could be quite powerful - each file type can have a default action so for word documents, the default action is usually to open Word. Just don’t know if its too powerful.

I dont think a simple “default action” would have much value without strong parameter support (maybe except in some very edgy edge cases). We would also need to handle what would happen after the file is invoked, manage processes and so on. I don’t think it’s a the right way to solve the problem.

However, manipulating registry entries is a very good idea - and one option for such a module could absolutely be to import a reg file.

-Trond

I agree with the other comments, this option should be it’s own module.

Just to follow up on this, I’m working on a win_regmerge module.

There is now a win_reg_edit module in latest devel extras, but if you have many registry settings to control I think having the option to merge in a reg file would still be useful.

Jon