Skip to content

Commit

Permalink
Merge pull request #1 from walkamongus/master
Browse files Browse the repository at this point in the history
rebase with master
  • Loading branch information
andrewwippler committed May 25, 2016
2 parents 3f9afcc + 94753bc commit b3273e7
Show file tree
Hide file tree
Showing 19 changed files with 185 additions and 161 deletions.
12 changes: 6 additions & 6 deletions .rubocop.yml
Expand Up @@ -211,7 +211,7 @@ Style/SpaceInsideParens:
Style/LeadingCommentSpace:
Enabled: false

Style/SingleSpaceBeforeFirstArg:
Style/SpaceBeforeFirstArg:
Enabled: false

Style/SpaceAfterColon:
Expand All @@ -220,7 +220,7 @@ Style/SpaceAfterColon:
Style/SpaceAfterComma:
Enabled: false

Style/SpaceAfterControlKeyword:
Style/SpaceAroundKeyword:
Enabled: false

Style/SpaceAfterMethodName:
Expand Down Expand Up @@ -323,7 +323,10 @@ Style/TrailingWhitespace:
Style/StringLiterals:
Enabled: false

Style/TrailingComma:
Style/TrailingCommaInArguments:
Enabled: false

Style/TrailingCommaInLiteral:
Enabled: false

Style/GlobalVars:
Expand Down Expand Up @@ -464,9 +467,6 @@ Metrics/ParameterLists:
Lint/RequireParentheses:
Enabled: false

Lint/SpaceBeforeFirstArg:
Enabled: false

Style/ModuleFunction:
Enabled: false

Expand Down
37 changes: 9 additions & 28 deletions .travis.yml
@@ -1,38 +1,19 @@
---
language: ruby
bundler_args: --without development system_tests
before_install: rm Gemfile.lock || true
bundler_args: --without development
before_install:
- rm Gemfile.lock || true
- gem update bundler
rvm:
- 1.8.7
- 1.9.3
- 2.0.0
- 2.1.0
script: bundle exec rake test
env:
- PUPPET_GEM_VERSION="~> 2.7.0"
- PUPPET_GEM_VERSION="~> 3.2.0"
- PUPPET_GEM_VERSION="~> 3.3.0"
- PUPPET_GEM_VERSION="~> 3.4.0"
- PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES=yes
- PUPPET_GEM_VERSION="~> 3.6.0" STRICT_VARIABLES=yes
- PUPPET_GEM_VERSION="~> 3.7.0" STRICT_VARIABLES=yes
- PUPPET_GEM_VERSION="~> 3.7.0" STRICT_VARIABLES=yes FUTURE_PARSER=yes
- PUPPET_GEM_VERSION="~> 3.8.0" STRICT_VARIABLES=yes FUTURE_PARSER=yes
- PUPPET_GEM_VERSION="~> 4.0.0" STRICT_VARIABLES=yes
- PUPPET_GEM_VERSION="~> 4.1.0" STRICT_VARIABLES=yes
- PUPPET_GEM_VERSION="~> 4.2.0" STRICT_VARIABLES=yes
- PUPPET_GEM_VERSION="~> 4.3.0" STRICT_VARIABLES=yes
matrix:
exclude:
# Ruby 1.9.3
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 2.7.0"

# Ruby 2.0.0
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 2.7.0"

# Ruby 2.1.0
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 2.7.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.2.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.3.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.4.0"
6 changes: 6 additions & 0 deletions CHANGELOG
@@ -1,2 +1,8 @@
2016-05-24 Release 0.1.3
- Add more robust check of domain membership and attempt to join domain if check fails
2016-05-24 Release 0.1.2
- Force rebuilding of SSSD config cache on each configuration change
2015-12-16 Release 0.1.1
- null release
2015-12-16 Release 0.1.0
- initial release
6 changes: 3 additions & 3 deletions Gemfile
Expand Up @@ -2,13 +2,13 @@ source "https://rubygems.org"

group :test do
gem "rake"
gem "puppet", ENV['PUPPET_GEM_VERSION'] || '~> 3.8.0'
gem "rspec", '< 3.2.0'
gem "puppet", ENV['PUPPET_GEM_VERSION'] || '~> 4.0.0'
gem "rspec", '~> 3.4.0'
gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git'
gem "puppetlabs_spec_helper"
gem "metadata-json-lint"
gem "rspec-puppet-facts"
gem 'rubocop', '0.33.0'
gem 'rubocop', '0.40.0'
gem 'simplecov', '>= 0.11.0'
gem 'simplecov-console'

Expand Down
3 changes: 3 additions & 0 deletions README.markdown
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/walkamongus/realmd.svg?branch=master)](https://travis-ci.org/walkamongus/realmd)

#### Table of Contents

1. [Overview](#overview)
Expand Down Expand Up @@ -49,6 +51,7 @@ It also optionaly manages the contents of the Kerberos client configuration and
* the kerberos config file (/etc/krb5.conf) will be placed on disk
* the `kinit` command is run to obtain an initial TGT
* the `realm join` command is run to join via keytab
* the SSSD config cache is forcibly removed on each config change to ensure cache is rebuilt

### Setup Requirements

Expand Down
4 changes: 2 additions & 2 deletions Rakefile
Expand Up @@ -22,7 +22,7 @@ exclude_paths = [
"bundle/**/*",
"pkg/**/*",
"vendor/**/*",
"spec/**/*",
"spec/**/*"
]

# Coverage from puppetlabs-spec-helper requires rcov which
Expand Down Expand Up @@ -59,5 +59,5 @@ task :test => [
:syntax,
:lint,
:rubocop,
:spec,
:spec
]
2 changes: 1 addition & 1 deletion manifests/config.pp
Expand Up @@ -8,7 +8,7 @@
$_realmd_config_file = $::realmd::realmd_config_file

file { $_realmd_config_file:
ensure => present,
ensure => file,
owner => 'root',
group => 'root',
mode => '0640',
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Expand Up @@ -19,6 +19,7 @@
$sssd_package_name = $::realmd::params::sssd_package_name,
$sssd_service_name = $::realmd::params::sssd_service_name,
$sssd_config_file = $::realmd::params::sssd_config_file,
$sssd_config_cache_file = $::realmd::params::sssd_config_cache_file,
$sssd_config = $::realmd::params::sssd_config,
$manage_sssd_config = $::realmd::params::manage_sssd_config,
$mkhomedir_package_names = $::realmd::params::mkhomedir_package_names,
Expand Down
15 changes: 7 additions & 8 deletions manifests/join/keytab.pp
Expand Up @@ -22,7 +22,7 @@

if $_manage_krb_config {
file { 'krb_configuration':
ensure => present,
ensure => file,
path => $_krb_config_file,
owner => 'root',
group => 'root',
Expand All @@ -36,15 +36,14 @@
path => '/usr/bin:/usr/sbin:/bin',
command => "kinit -kt ${_krb_keytab} ${_domain_join_user}",
refreshonly => true,
before => Exec['run_realm_join_with_keytab'],
before => Exec['realm_join_with_keytab'],
}

exec { 'run_realm_join_with_keytab':
path => '/usr/bin:/usr/sbin:/bin',
command => "realm join ${_domain}",
unless => "realm list --name-only | grep ${_domain}",
refreshonly => true,
require => Exec['run_kinit_with_keytab'],
exec { 'realm_join_with_keytab':
path => '/usr/bin:/usr/sbin:/bin',
command => "realm join ${_domain}",
unless => "klist -k /etc/krb5.keytab | grep -i '${::hostname}@${_domain}'",
require => Exec['run_kinit_with_keytab'],
}

}
13 changes: 6 additions & 7 deletions manifests/join/password.pp
Expand Up @@ -5,15 +5,14 @@
#
class realmd::join::password {

$_domain = $::realmd::domain
$_user = $::realmd::domain_join_user
$_password = $::realmd::domain_join_password
$_domain = $::realmd::domain
$_user = $::realmd::domain_join_user
$_password = $::realmd::domain_join_password

exec { 'realm_join_with_password':
path => '/usr/bin:/usr/sbin:/bin',
command => "echo '${_password}' | realm join ${_domain} --unattended --user=${_user}",
unless => "realm list --name-only | grep ${_domain}",
refreshonly => true,
path => '/usr/bin:/usr/sbin:/bin',
command => "echo '${_password}' | realm join ${_domain} --unattended --user=${_user}",
unless => "klist -k /etc/krb5.keytab | grep -i '${::hostname}@${_domain}'",
}

}
1 change: 1 addition & 0 deletions manifests/params.pp
Expand Up @@ -14,6 +14,7 @@
$sssd_package_name = 'sssd'
$sssd_service_name = 'sssd'
$sssd_config_file = '/etc/sssd/sssd.conf'
$sssd_config_cache_file = '/var/lib/sss/db/config.ldb'
$sssd_config = {}
$manage_sssd_config = false
$mkhomedir_package_names = [
Expand Down
6 changes: 6 additions & 0 deletions manifests/sssd/config.pp
Expand Up @@ -12,6 +12,12 @@
owner => 'root',
group => 'root',
mode => '0600',
notify => Exec['force_config_cache_rebuild'],
}

exec { 'force_config_cache_rebuild':
command => "/usr/bin/rm -f ${::realmd::sssd_config_cache_file}",
refreshonly => true,
}
}

Expand Down
2 changes: 1 addition & 1 deletion metadata.json
@@ -1,6 +1,6 @@
{
"name": "walkamongus-realmd",
"version": "0.1.1",
"version": "0.1.3",
"author": "Chadwick Banning",
"summary": "Puppet module to install and configure Realmd",
"license": "Apache-2.0",
Expand Down
6 changes: 4 additions & 2 deletions spec/classes/config_spec.rb
Expand Up @@ -11,11 +11,13 @@
context "realmd::config class with default parameters" do
let(:params) {{ }}

it { should contain_file('/etc/realmd.conf').with({
it do
should contain_file('/etc/realmd.conf').with({
:owner => 'root',
:group => 'root',
:mode => '0640',
}) }
})
end
end
end
end
Expand Down
10 changes: 6 additions & 4 deletions spec/classes/init_spec.rb
Expand Up @@ -27,10 +27,12 @@

context 'unsupported operating system' do
describe 'realmd class without any parameters on Solaris/Nexenta' do
let(:facts) {{
:osfamily => 'Solaris',
:operatingsystem => 'Nexenta',
}}
let(:facts) do
{
:osfamily => 'Solaris',
:operatingsystem => 'Nexenta',
}
end

it { expect { is_expected.to contain_package('realmd') }.to raise_error(Puppet::Error, /Nexenta not supported/) }
end
Expand Down

0 comments on commit b3273e7

Please sign in to comment.