diff --git a/.fixtures.yml b/.fixtures.yml index 4d1fe61..6470f44 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -3,4 +3,4 @@ --- fixtures: forge_modules: - stdlib: "puppetlabs/stdlib" + stdlib: "puppetlabs/stdlib" diff --git a/README.md b/README.md index 3d5c584..257a3e0 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,18 @@ ## Table of Contents -1. [Description](#description) -1. [Setup - The basics of getting started with networkmanager](#setup) - * [Setup requirements](#setup-requirements) -1. [Usage - Configuration options and additional functionality](#usage) -1. [Limitations - OS compatibility, etc.](#limitations) -1. [Development - Guide for contributing to the module](#development) +- [networkmanager](#networkmanager) + - [Table of Contents](#table-of-contents) + - [Description](#description) + - [Setup](#setup) + - [Setup Requirements](#setup-requirements) + - [Usage](#usage) + - [Simple Including the module](#simple-including-the-module) + - [Instantiation as a class](#instantiation-as-a-class) + - [Setup of hieradata](#setup-of-hieradata) + - [Parameters](#parameters) + - [Limitations](#limitations) + - [Development](#development) ## Description @@ -26,7 +32,7 @@ of the NetworkManager: ## Setup -### Setup Requirements +### Setup Requirements This module requires following: @@ -51,7 +57,7 @@ configuration must be done via hieradata. include networkmanager ``` -or +or ```puppet contain networkmanager diff --git a/data/common.yaml b/data/common.yaml index 5ba9031..8b0a5b0 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -1,5 +1,4 @@ --- - # Defaults for Global DNS options networkmanager::enable_global_dns: false networkmanagerservers: [] @@ -19,4 +18,3 @@ networkmanager::ensure_service: 'running' networkmanager::service_name: 'NetworkManager' networkmanager::enable_service: true networkmanager::restart_service: ~ - diff --git a/lib/facter/networkmanager_nmcli_path.rb b/lib/facter/networkmanager_nmcli_path.rb index e7a3208..25cfebc 100644 --- a/lib/facter/networkmanager_nmcli_path.rb +++ b/lib/facter/networkmanager_nmcli_path.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative '../puppet_x/pixelpark/nm-which' +require_relative '../puppet_x/pixelpark/nm_which' Facter.add(:networkmanager_nmcli_path) do setcode do diff --git a/lib/puppet_x/pixelpark/nm-which.rb b/lib/puppet_x/pixelpark/nm_which.rb similarity index 100% rename from lib/puppet_x/pixelpark/nm-which.rb rename to lib/puppet_x/pixelpark/nm_which.rb diff --git a/manifests/dns.pp b/manifests/dns.pp index d99193a..cfa6c84 100644 --- a/manifests/dns.pp +++ b/manifests/dns.pp @@ -45,13 +45,13 @@ $nmcli = $facts['networkmanager_nmcli_path'] - if $connection { - $_connection = $connection - } else { + if empty($connection) { $_connection = $name + } else { + $_connection = $connection } - if $nameservers.length() == 1 { + if $nameservers.length == 1 { notify { "Only one nameserver was given for NetworkManager connection ${_connection}.": loglevel => warning } } @@ -69,7 +69,7 @@ } $used_searchdomains = $searchdomains.join(',') - $has_searchdomains = $facts['networkmanager_dns'][$_connection]['search'].join(',') + $has_searchdomains = $facts['networkmanager_dns'][$_connection]['search'].join(',') unless $used_searchdomains == $has_searchdomains { exec { "update searchdomains nmcli connection ${_connection}": diff --git a/spec/classes/networkmanager_service_spec.rb b/spec/classes/networkmanager_service_spec.rb index ea764da..023b4e4 100644 --- a/spec/classes/networkmanager_service_spec.rb +++ b/spec/classes/networkmanager_service_spec.rb @@ -6,6 +6,15 @@ on_supported_os.each do |os, os_facts| context "on #{os}" do let(:facts) { os_facts } + let(:params) do + { + service_name: 'foobar', + enable: true, + ensure: 'running', + manage: true, + restart: nil, + } + end it { is_expected.to compile } end diff --git a/spec/defines/dns_spec.rb b/spec/defines/dns_spec.rb index 6e018d3..56dac9d 100644 --- a/spec/defines/dns_spec.rb +++ b/spec/defines/dns_spec.rb @@ -11,7 +11,7 @@ dns_options: '', } end - let(:pre_condition) { 'include networkmanager::service' } + let(:pre_condition) { 'class { "networkmanager::service": service_name => "foobar", enable => true, ensure => "running", manage => true, restart => "/bin/foo",}' } on_supported_os.each do |os, os_facts| context "on #{os}" do