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

add openvpn::deploy::(export/client) #261

Merged
merged 5 commits into from
Jan 11, 2018
Merged

Conversation

to-kn
Copy link
Contributor

@to-kn to-kn commented Jan 6, 2018

Facter.add("openvpn::deploy_cert_data") do
setcode do
clients = {}
path = '/etc/openvpn'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there any operatingsystems we support, that use a different path?

#

define openvpn::deploy::client (
String $server,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datatypes \o/

~> Class['openvpn::deploy::service']


if ($manage_etc == true) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can be lazy here and save a few chars:

if $manage_etc {}

File <<| tag == "${server}-${name}" |>>
~> Class['openvpn::deploy::service']

}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a newline here

tag => "${server}-${name}",
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a newline here


ensure_packages(['openvpn'])

}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline


class openvpn::deploy::install {

ensure_packages(['openvpn'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't that already covered by this module?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on the server yes, on the client not as far as i am aware of...


class openvpn::deploy::service {

service { 'openvpn':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not shure, if i should/could reuse the server part for the client here too? (same as for install)

@bastelfreak bastelfreak added enhancement New feature or request needs-tests labels Jan 6, 2018
@bastelfreak
Copy link
Member

Hi @to-kn, thanks for the PR. I added a few inline comments. Can you take a look a them and add a few spec tests?

@to-kn to-kn force-pushed the feat_deploy branch 2 times, most recently from 439cbe3 to 89cd5b4 Compare January 7, 2018 15:58
@to-kn
Copy link
Contributor Author

to-kn commented Jan 7, 2018

hi @bastelfreak, like that?

fix linting, add credit, add tests
fixes voxpupuli#231
@bastelfreak
Copy link
Member

Can you checked the failed travis run?

@to-kn
Copy link
Contributor Author

to-kn commented Jan 10, 2018

@bastelfreak looks good now!

# @return [NilClass]
def self.add_facts
certs = client_certs
Facter.add('openvpn::client_configs') do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use a different delimiter here and not ::? This looks to much like a normal puppet variable.

-> Openvpn::Client[$name]
-> Openvpn::Deploy::Export[$name]

if $facts['openvpn::client_configs'] {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on a first view, this looks like you lookup a puppet variable in the facts hash, I think we should change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you prefer something along the lines of "openvpn_client_configs"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openvpn_client_configs or just openvpn or openvpn {client_configs{}} sound good I guess

@@ -2,6 +2,8 @@
require 'rspec-puppet-facts'
include RspecPuppetFacts

$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will get killed by the next modulesync. This file is a template. Is this actually needed?

Copy link
Contributor Author

@to-kn to-kn Jan 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i remove that line, than i get an error while running the tests. - maybe you know, how this could be fixed?

An error occurred while loading ./spec/unit/openvpn_module_spec.rb.
Failure/Error: require 'lib/facter/openvpn'

LoadError:
  cannot load such file -- lib/facter/openvpn

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about moving that $LOAD_PATH thing into spec/unit/openvpn_module_spec.rb? That may work.

@@ -0,0 +1,103 @@
require 'spec_helper'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh sweet. Good job in that file!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks :)

@@ -27,6 +29,7 @@
default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__))
c.default_facts = default_facts
c.hiera_config = 'spec/fixtures/hiera/hiera.yaml'
c.mock_with :rspec
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought rspec is the default and this isn't needed. However, our template actually supports it \o/
https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/spec/spec_helper.rb.erb#L47

Please configure it like this: https://github.com/voxpupuli/puppet-extlib/blob/master/.sync.yml#L5

add mock_with to .sync.yml and remove additional $LOAD from spec_helper
@to-kn
Copy link
Contributor Author

to-kn commented Jan 10, 2018

i also added a short info to the readme

@bastelfreak
Copy link
Member

Thanks for all the work @to-kn!

@bastelfreak bastelfreak merged commit 652f33a into voxpupuli:master Jan 11, 2018
@jkroepke jkroepke mentioned this pull request Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants