Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing Nil To configuration_file #18

Open
AshleyPoole opened this issue Oct 27, 2015 · 8 comments
Open

Passing Nil To configuration_file #18

AshleyPoole opened this issue Oct 27, 2015 · 8 comments

Comments

@AshleyPoole
Copy link

Hi,

I'm trying to set the configuration_file variable in the Vagrant file to nil but I cannot seem to get it to work. Could you provide an example as I'm trying to use precompiled mof files but cannot.

One possibility is it might be a bug? Within config.rb, line 97 sets the default value to "Default.ps1" if a value isn't given, yet on line 117 the variaibile is tested to see if it's null as to allow the the mof path instead. I believe this is why the message "cannot provide configuration_file and mof_path at the same time. Please provide only one of the two" is being printed out.

https://github.com/mefellows/vagrant-dsc/blob/master/lib/vagrant-dsc/config.rb#L97

@mefellows
Copy link
Owner

Thanks @AshleyPoole. Looks like it might be a bug actually, obviously I've anticipated this scenario but it appears as if its not properly implemented (include Tests). Happy for you to submit a patch with tests and i'll update the plugin?

@AshleyPoole
Copy link
Author

@mefellows can you provide some basics / README for developers?

I've got all the gems installed needed and wanted to run the tests before making the bugfix but I'm getting "require': cannot load such file -- vagrant (LoadError)". I already have Vagrant installed on my device (OS X) and running gem for Vagrant says the package is no longer being updated and to use the native installer (already installed).

Anyway if you can provide some basic notes, I'm more than happy to (and want to) make the fix.

@mefellows
Copy link
Owner

Hi @AshleyPoole, I've updated the README.md, hopefully that helps.

As a TL;DR - you need to execute tests via Bundler i.e. bundle exec rake spec.

Thanks for chipping in!

@AshleyPoole
Copy link
Author

@mefellows Thanks the README.md has helped a lot and I've got tests around the area though I'm unsure yet how to approach this; It's unclear from the README.md what parameters you want set for each of the two modes - precompiled MOF's VS compile MOF's.

I believe if you could update the README.MD to have a example of two usages this will help make things a little clearer to what is needed or not needed for each of the two modes of operation. This then makes the intent much clearer to developers helping out.

@mefellows
Copy link
Owner

No worries at all. I would suggest that if mof_path is set then configuration_name, configuration_data_file_path, configuration_file_path are all not required, in fact they should be ignored. Once you have a MOF file, you have everything you need (except possibly any paths to modules i.e. module_paths) to run the DSC configuration.

I'll update the README accordingly.

@mefellows
Copy link
Owner

Also, looking at https://github.com/mefellows/vagrant-dsc/blob/master/lib/vagrant-dsc/templates/runner.ps1.erb#L18-L20 it feels like they should be moved to under line 23 and the default setting of default.ps1 rule removed, to allow for "MOF mode" (for want of a better term) to work. This will need some minor refactoring, but at a glance should begin to address your problem from above.

@dragon788
Copy link
Contributor

Just ran into this myself. I wanted to test a MOF and see if it would apply cleanly but even with all the configuration file options commented it throws the warning.

I tried moving the check for both the @config and @mof being defined to BEFORE the @config gets assigned the default.ps1 value (making it never nil before the nil check), but I think there may be a cached copy somewhere (I was hacking directly in ~/.vagrant.d/gems/gems/vagrant-dsc/lib), or as @mefellows mentioned perhaps there is somewhere else that it needs changed as well.

I might see if I can setup a dev environment to run some tests around this, currently I am just trying to get DSCLocalConfigurationManager settings in place, and since doesn't support taking a config file, I am attempting to fake it by creating an empty psd1, the way the DSCLocalConfiguration works isn't quite the same as a standard module though so I'm not sure how well it will work out.

@mefellows
Copy link
Owner

Thanks @dragon788, happy to take PRs on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants