puppet-openvpn icon indicating copy to clipboard operation
puppet-openvpn copied to clipboard

Readme doesn’t work for server config

Open danquack opened this issue 6 years ago • 5 comments

Ran into an error stating I needed to define local because it was undefined.

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet:5.5.6
  • Ruby:Baked in to 5.5.6
  • Distribution:Centos7
  • Module version:latest

How to reproduce (e.g Puppet code you use)

Use readme server invoke -

openvpn::server { 'winterthur':
    country      => 'CH',
    province     => 'ZH',
    city         => 'Winterthur',
    organization => 'example.org',
    email        => '[email protected]',
    server       => '10.200.200.0 255.255.255.0',
  }

What are you seeing

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Openvpn::Server[$::hostname]: parameter 'local' expects a String value, got Undef (file: /etc/puppetlabs/code/environments/production/modules/vpn/manifests/server.pp, line: 2) on node hostname.example.com

What behaviour did you expect instead

It to work

Output log

Any additional information you'd like to impart

If you add local => “”, it willl apply. Not sure if this is as intended.

danquack avatar Oct 21 '18 07:10 danquack

the parameter defaults to an ip address: https://github.com/voxpupuli/puppet-openvpn/blob/139c72778008b91469d445f4f2c89d5c35d57ef4/manifests/server.pp#L457

I assume your network interface has a different name? The default should probably be changed to $facts['network']['ip']

bastelfreak avatar Oct 21 '18 07:10 bastelfreak

notify { $facts['network']['ip']:}  -> Error: Evaluation Error: A substring operation does not accept a String as a character index. Expected an Integer (file: /root/ip.erb, line: 1, column: 28)

notify { $facts['network']:} -> the network domain

My system only has interface, eth0

danquack avatar Oct 21 '18 08:10 danquack

sorry, I made a typo, the correct fact is $facts['networking']['ip']. But this should work out of the box if your eth0 has an ip address, even with the current code.

bastelfreak avatar Oct 21 '18 08:10 bastelfreak

I proposed https://github.com/voxpupuli/puppet-openvpn/pull/308 to make the setup a bit clearer.

bastelfreak avatar Oct 21 '18 08:10 bastelfreak

What I still don’t understand as why it was reading as undef when I didn’t specify it in the class variables, since the original fact. I can pull your code later though and see if that fixes it.

danquack avatar Oct 21 '18 08:10 danquack