Skip to content

Commit

Permalink
Added basic testing; fixed a bug when not joined to the domain
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared King committed Sep 2, 2014
1 parent 064d616 commit e319f4e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ driver:
name: vagrant

provisioner:
name: chef_solo
name: chef_zero

platforms:
- name: ubuntu-12.04
- name: centos-6.4

suites:
- name: default
run_list:
attributes:
- recipe[pbis-open::default]
attributes:
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
license 'Apache 2.0'
description 'Installs and configures PowerBroker Identity Services Open Edition'
long_description 'Installs and configures PowerBroker Identity Services Open Edition'
version '1.0.1'
version '1.0.2'

depends 'chef-vault', '~> 1.1.2'
10 changes: 9 additions & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
domain_member = `domainjoin-cli query | egrep -ic 'Domain = #{node['pbis-open']['ad_domain'].upcase}'`.to_i

# Set configuration options if joined
if (File.exists?('/usr/bin/domainjoin-cli') && domain_member)
if (File.exists?('/usr/bin/domainjoin-cli') && domain_member == 1)
execute "reload-config" do
command "/opt/pbis/bin/config --file #{node['pbis-open']['config_file']}"
action :nothing
Expand All @@ -67,6 +67,14 @@

# Disable the Ohai passwd plugin to avoid pulling LDAP information
# https://tickets.opscode.com/browse/OHAI-165
directory "/etc/chef/client.d" do
owner "root"
group "root"
mode "0755"
recursive true
action :create
end

template "/etc/chef/client.d/disable-passwd.rb" do
source "disable-passwd.rb.erb"
end
16 changes: 16 additions & 0 deletions test/integration/default/serverspec/pbis-open_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'serverspec'

include Serverspec::Helper::Exec
include Serverspec::Helper::DetectOS

RSpec.configure do |c|
c.before :all do
c.path = '/sbin:/usr/sbin'
end
end

describe "pbis-open" do
it "has a running service of lwsmd" do
expect(service("lwsmd")).to be_running
end
end

0 comments on commit e319f4e

Please sign in to comment.