-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
Conversation
Facter.add("openvpn::deploy_cert_data") do | ||
setcode do | ||
clients = {} | ||
path = '/etc/openvpn' |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Datatypes \o/
manifests/deploy/client.pp
Outdated
~> Class['openvpn::deploy::service'] | ||
|
||
|
||
if ($manage_etc == true) { |
There was a problem hiding this comment.
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'] | ||
|
||
} |
There was a problem hiding this comment.
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
manifests/deploy/export.pp
Outdated
tag => "${server}-${name}", | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
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']) | ||
|
||
} |
There was a problem hiding this comment.
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']) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is also redundant with https://github.com/voxpupuli/puppet-openvpn/blob/master/manifests/service.pp ?
There was a problem hiding this comment.
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)
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? |
439cbe3
to
89cd5b4
Compare
hi @bastelfreak, like that? |
fix linting, add credit, add tests fixes voxpupuli#231
Can you checked the failed travis run? |
@bastelfreak looks good now! |
lib/facter/openvpn.rb
Outdated
# @return [NilClass] | ||
def self.add_facts | ||
certs = client_certs | ||
Facter.add('openvpn::client_configs') do |
There was a problem hiding this comment.
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.
manifests/deploy/export.pp
Outdated
-> Openvpn::Client[$name] | ||
-> Openvpn::Deploy::Export[$name] | ||
|
||
if $facts['openvpn::client_configs'] { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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
spec/spec_helper.rb
Outdated
@@ -2,6 +2,8 @@ | |||
require 'rspec-puppet-facts' | |||
include RspecPuppetFacts | |||
|
|||
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../')) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
i also added a short info to the readme |
Thanks for all the work @to-kn! |
proposal to integrate https://bitbucket.org/codacity/puppet-module-openvpn_client as mentioned in #231