From e319f4e8a4cfcfd67b689eaf722bbef5f0b427c2 Mon Sep 17 00:00:00 2001 From: Jared King Date: Tue, 2 Sep 2014 10:47:17 -0700 Subject: [PATCH] Added basic testing; fixed a bug when not joined to the domain --- .kitchen.yml | 6 +++--- metadata.rb | 2 +- recipes/default.rb | 10 +++++++++- .../default/serverspec/pbis-open_spec.rb | 16 ++++++++++++++++ 4 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 test/integration/default/serverspec/pbis-open_spec.rb diff --git a/.kitchen.yml b/.kitchen.yml index 8e31207..89f41f1 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -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: \ No newline at end of file diff --git a/metadata.rb b/metadata.rb index 55850c1..0eaed29 100644 --- a/metadata.rb +++ b/metadata.rb @@ -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' \ No newline at end of file diff --git a/recipes/default.rb b/recipes/default.rb index 1dcd3a8..01521b8 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -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 @@ -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 \ No newline at end of file diff --git a/test/integration/default/serverspec/pbis-open_spec.rb b/test/integration/default/serverspec/pbis-open_spec.rb new file mode 100644 index 0000000..0b02a18 --- /dev/null +++ b/test/integration/default/serverspec/pbis-open_spec.rb @@ -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 \ No newline at end of file