vagrant-landrush / landrush

A Vagrant plugin that provides a simple DNS server for Vagrant guests
MIT License
666 stars 78 forks source link

Execution of iptables_installed capabiltiy fails on Photon guest #263

Open ghost opened 7 years ago

ghost commented 7 years ago

I am using landrush to provision a project which consists of 3 machines. However, I encountered the following error message through vagrant up --provider=vmware_fusion. The box I used is from vmware/photon. I also test precise64-vmware box and it works fine. I wonder how to enable iptables_installed capability inside the vmware/photon box.

==> host-02.shawnho.taiwan: Machine booted and ready!
Vagrant attempted to execute the capability 'iptables_installed'
on the detect guest OS 'photon', but the guest doesn't
support that capability. This capability is required for your
configuration of Vagrant. Please either reconfigure Vagrant to
avoid this capability or fix the issue by creating the capability.
hferentschik commented 7 years ago

Landrush uses iptables inside of the guest to re-configure its DNS to reach out to the Landrush DNS server running on the host. To do so, Landrush needs to call two guest capabilities - _iptablesinstalled and _iptablesinstall. See also https://github.com/vagrant-landrush/landrush/tree/master/lib/landrush/cap/guest/debian as an example for Debian. There is no implementation for these capabilities for photon. How do you check on Photon whether a package is installed and how do you install it, if it is not available? A quick look seems to suggest that Photon is using its own package manager (tdnf), so one would indeed have to write some new guest capabilities (opposed to re-using existing ones).

Is this something you would be interested in contributing. The implementation should not be too hard.

ghost commented 7 years ago

Certainly. I checked photon actually has iptables v.1.6.0 installed as well as dnsmasq. I guess I need to implement couple check functions to validate these tests. Is there any implementation guide I could check?

hferentschik commented 7 years ago

I guess I need to implement couple check functions to validate these tests. Is there any implementation guide I could check?

Not quite sure what you are asking. If you are asking for examples on how to write guest capabilities, have a look at the existing ones - see https://github.com/vagrant-landrush/landrush/tree/master/lib/landrush/cap/guest

Note, that guest can inherit of each other, for example debian inherits from linux, so linux capabilities are available for a debian guest as well. See also the relevant Vagrant documentation - https://www.vagrantup.com/docs/plugins/guest-capabilities.html.

In case you are asking about testing frameworks, you have two choices. Minispec is used for unit tests. You find some unit tests around capabilities here - https://github.com/vagrant-landrush/landrush/tree/master/test/landrush/cap/guest.

It might be simpler though to test end to end via the Cucumber integration tests - https://github.com/vagrant-landrush/landrush/tree/master/features. There you could configure a Vagrant setup using photon, booting it and then verify that all DNS works. In fact, if one where to add photon as example to this test - https://github.com/vagrant-landrush/landrush/blob/master/features/dns_resolution.feature#L34 and everything works, one is pretty much good to go.

Not sure whether this answers your question. Have a look at the README. It should tell you how to setup your environment and how to run the various tests.

If you like, give it a go and you can always ask questions when you get stuck. I am happy to help. Also check out the CONTRIBUTING page. It explains how we usually integrate changes into the code base (aka pull requests).