oscar-stack / puppet-debugging-kit

A batteries-included environment for debugging Puppet powered infrastructure.
29 stars 16 forks source link

windows 2012 agent creation crashes because vagrant-hosts doesn't work on openstack #17

Closed jessereynolds closed 6 years ago

jessereynolds commented 7 years ago

It seems that the vagrant-hosts plugin doesn't play nicely with vagrant-openstack provisioner and so this project can't be used to create agents on openstack. Or am I missing something? You get:

$ vagrant up pe-201730-agent --provider openstack
Bringing machine 'pe-201730-agent' up with 'openstack' provider...
...snip...
==> pe-201730-agent: Machine booted and ready!
==> pe-201730-agent: Ensuring requiretty is disabled...
==> pe-201730-agent: Rsyncing folder: /home/ubuntu/puppet-debugging-kit/ => /vagrant
==> pe-201730-agent: Running provisioner: base networking (hosts)...
An unknown error happened in Vagrant OpenStack provider
...snip...
/home/ubuntu/.vagrant.d/gems/2.3.4/gems/vagrant-hosts-2.8.0/lib/vagrant-hosts/cap/facts/windows.rb:39:in `get_default_iface': Catc
hed Error: undefined method `split' for nil:NilClass (NoMethodError)
        from /home/ubuntu/.vagrant.d/gems/2.3.4/gems/vagrant-hosts-2.8.0/lib/vagrant-hosts/cap/facts/windows.rb:13:in `load_facts'
...snip...

Is this a bug in vagrant-hosts ? Is there a known workaround for this issue ?

jessereynolds commented 7 years ago

FWIW, the offending Windows VM's netstat -an output:

screenshot 2017-10-18 09 27 21
jessereynolds commented 7 years ago

And netstat -rn

screenshot 2017-10-18 09 32 29
jessereynolds commented 7 years ago

Adding a puts line into the hosts code to show the route_table variable yields:

===== route table =====
===========================================================================Interface List 12...fa 16 3e 50 90 39 ......Red Hat Vir
tIO Ethernet Adapter  1...........................Software Loopback Interface 1 22...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adap
ter===========================================================================IPv4 Route Table====================================
=======================================Active Routes:Network Destination        Netmask          Gateway       Interface  Metric
        0.0.0.0          0.0.0.0      192.168.0.1     192.168.0.31      5        127.0.0.0        255.0.0.0         On-link
  127.0.0.1    306        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306  127.255.255.255  255.255.255.255
      On-link         127.0.0.1    306      192.168.0.0    255.255.255.0         On-link      192.168.0.31    261     192.168.0.31
  255.255.255.255         On-link      192.168.0.31    261    192.168.0.255  255.255.255.255         On-link      192.168.0.31
261        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306        224.0.0.0        240.0.0.0         On-link
    192.168.0.31    261  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306  255.255.255.255  255.255.255.2
55         On-link      192.168.0.31    261===========================================================================Persistent Routes:  NoneIPv6 Route Table===========================================================================Active Routes: If Metric Ne
twork Destination      Gateway  1    306 ::1/128                  On-link 12    261 fe80::/64                On-link 12    261 fe80::8916:5cf0:504c:8164/128                                    On-link  1    306 ff00::/8                 On-link 12    261 ff00::/
8                 On-link===========================================================================Persistent Routes:  None

Unfortunately tmux is adding its own line endings to the above, but I think there are no line endings coming back from the netstat command to the hosts code

jessereynolds commented 7 years ago

Versions:

ubuntu@slicejump:~/puppet-debugging-kit$ vagrant plugin list
oscar (0.5.3)
vagrant-norequiretty (0.0.4)
vagrant-openstack-provider (0.11.0)
vagrant-share (1.1.9, system)

ubuntu@slicejump:~/puppet-debugging-kit$ vagrant --version
Vagrant 2.0.0
jessereynolds commented 7 years ago

Reverting to Vagrant 1.8.7 has fixed this issue.

Adding the puts line for the route_table variable in the hosts code shows that it's now getting newlines.

==> pe-201730-agent: Running provisioner: base networking (hosts)...

===== route_table =====
===========================================================================
Interface List
 12...fa 16 3e 6b 8f b9 ......Red Hat VirtIO Ethernet Adapter
  1...........................Software Loopback Interface 1
 22...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.0.1     192.168.0.34      5
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      192.168.0.0    255.255.255.0         On-link      192.168.0.34    261
     192.168.0.34  255.255.255.255         On-link      192.168.0.34    261
    192.168.0.255  255.255.255.255         On-link      192.168.0.34    261
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link      192.168.0.34    261
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link      192.168.0.34    261
===========================================================================
Persistent Routes:
  None

...snip...
Sharpie commented 6 years ago

Apologies for the long delay on this one. This turned out to be an issue in Vagrant 1.9+ as a result of the winrm gem upgrading from v1.8.1 to v2.2.3. WinRM 2.0 moved the implementation of Powershell over to using PSRP where it was previously running through a CMD.exe shell in 1.8. This is 10000% the right implementation, but it changed the way line breaks in command output are transported which caused this problem.

This has been fixed in oscar-stack/vagrant-hosts@427a72d and released in vagrant-hosts 2.8.3.