Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

COOK-4086, add omnios support

Signed-off-by: Sean OMeara <someara@opscode.com>
  • Loading branch information...
commit 14612d63fddaeb4e924348cf7ea83f9f3a4c42a5 1 parent 14fc7d7
@jtimberman jtimberman authored someara committed
View
23 .kitchen.yml
@@ -5,49 +5,38 @@ driver_config:
platforms:
- name: ubuntu-12.04
- driver_config:
- box: opscode-ubuntu-12.04
- box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box
run_list:
- recipe[apt]
- name: ubuntu-10.04
- driver_config:
- box: opscode-ubuntu-10.04
- box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-10.04_provisionerless.box
run_list:
- recipe[apt]
- name: centos-6.4
- driver_config:
- box: opscode-centos-6.4
- box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box
-
- name: centos-5.9
- driver_config:
- box: opscode-centos-5.9
- box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-5.9_provisionerless.box
+- name: omnios-r151006c
+ driver:
+ box: omnios-r151006c
+ box_url: http://omnios.omniti.com/media/OmniOS_Text_r151006c.iso
+ run_list:
+ - recipe[fake::omnios]
suites:
- name: default
run_list:
- recipe[postfix]
- attributes: {}
- name: aliases
run_list:
- recipe[postfix::aliases]
- attributes: {}
- name: client
run_list:
- recipe[postfix::client]
- attributes: {}
- name: server
run_list:
- recipe[postfix::server]
- attributes: {}
- name: sasl_auth
run_list:
View
5 Berksfile
@@ -3,6 +3,7 @@ site :opscode
metadata
group :integration do
- cookbook "apt"
- cookbook "yum"
+ cookbook 'apt'
+ cookbook 'yum'
+ cookbook 'fake', :path => 'test/fixtures/cookbooks/fake'
end
View
6 attributes/default.rb
@@ -29,6 +29,10 @@
when 'smartos'
default['postfix']['conf_dir'] = '/opt/local/etc/postfix'
default['postfix']['aliases_db'] = '/opt/local/etc/postfix/aliases'
+when 'omnios'
+ default['postfix']['conf_dir'] = '/opt/omni/etc/postfix'
+ default['postfix']['aliases_db'] = 'opt/omni/etc/postfix/aliases'
+ default['postfix']['uid'] = 11
else
default['postfix']['conf_dir'] = '/etc/postfix'
default['postfix']['aliases_db'] = '/etc/aliases'
@@ -59,7 +63,7 @@
when 'rhel'
cafile = '/etc/pki/tls/cert.pem'
else
- cafile = '/etc/postfix/cacert.pem'
+ cafile = "#{node['postfix']['conf_dir']}/cacert.pem"
end
if node['postfix']['use_procmail']
View
4 files/default/tests/minitest/aliases_test.rb
@@ -19,8 +19,8 @@
describe 'postfix::aliases' do
include Helpers::Postfix
- it 'manages /etc/aliases' do
- file('/etc/aliases').must_match(/^# This file is generated by Chef for/)
+ it 'manages aliases' do
+ file("#{node['postfix']['conf_dir']}/aliases").must_match(/^# This file is generated by Chef for/)
end
end
View
2  files/default/tests/minitest/default_test.rb
@@ -32,7 +32,7 @@
end
it 'configures postfix main.cf' do
- file('/etc/postfix/main.cf').must_match(/^# Generated by Chef for /)
+ file("#{node['postfix']['conf_dir']}/main.cf").must_match(/^# Generated by Chef for /)
end
end
View
4 files/default/tests/minitest/sasl_auth_test.rb
@@ -18,8 +18,8 @@
describe 'postfix::sasl_auth' do
include Helpers::Postfix
- it 'manages /etc/postfix/sasl_passwd' do
- file('/etc/postfix/sasl_passwd').must_match(/^# This file is generated by Chef for/)
+ it "manages postfix sasl_passwd" do
+ file("#{node['potfix']['conf_dir']}/sasl_passwd").must_match(/^# This file is generated by Chef for/)
end
it 'configures postfix to use /etc/postfix/sasl_passwd' do
View
1  recipes/aliases.rb
@@ -18,6 +18,7 @@
execute 'update-postfix-aliases' do
command 'newaliases'
+ environment :PATH => "#{ENV['PATH']}:/opt/omni/bin:/opt/omni/sbin" if platform_family?('omnios')
action :nothing
end
View
34 recipes/default.rb
@@ -36,6 +36,40 @@
notifies :start, 'service[postfix]'
not_if '/usr/bin/test /etc/alternatives/mta -ef /usr/sbin/sendmail.postfix'
end
+when 'omnios'
+ manifest_path = ::File.join(Chef::Config[:file_cache_path], "manifest-postfix.xml")
+
+ # we need to manage the postfix group and user
+ # and then subscribe to the package install because it creates a
+ # postdrop group and adds postfix user to it.
+ group 'postfix' do
+ append true
+ end
+
+ user 'postfix' do
+ uid node['postfix']['uid']
+ gid 'postfix'
+ home '/var/spool/postfix'
+ subscribes :manage, 'package[postfix]'
+ notifies :run, 'execute[/opt/omni/sbin/postfix set-permissions]', :immediately
+ end
+
+ # we don't guard this because if the user creation was successful (or happened out of band), then this won't get executed when the action is :nothing.
+ execute '/opt/omni/sbin/postfix set-permissions'
+
+ template manifest_path do
+ source 'manifest-postfix.xml.erb'
+ owner 'root'
+ group 'root'
+ mode 00644
+ notifies :run, "execute[load postfix manifest]", :immediately
+ end
+
+ execute "load postfix manifest" do
+ action :nothing
+ command "svccfg import #{manifest_path}"
+ notifies :restart, "service[postfix]"
+ end
end
if !node['postfix']['sender_canonical_map_entries'].empty?
View
8 recipes/sasl_auth.rb
@@ -48,11 +48,17 @@
end
template node['postfix']['sasl_password_file'] do
+ command "postmap #{node['postfix']['conf_dir']}/sasl_passwd"
+ environment :PATH => "#{ENV['PATH']}:/opt/omni/bin:/opt/omni/sbin" if platform_family?('omnios')
+ action :nothing
+end
+
+template "#{node['postfix']['conf_dir']}/sasl_passwd" do
source 'sasl_passwd.erb'
owner 'root'
group 'root'
mode 0400
notifies :run, 'execute[postmap-sasl_passwd]', :immediately
notifies :restart, 'service[postfix]'
- variables(settings: node['postfix']['sasl'])
+ variables(:settings => node['postfix']['sasl'])
end
View
84 templates/default/manifest-postfix.xml.erb
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+-->
+
+<service_bundle type="manifest" name="SFEpostfix:postfix">
+ <service name="network/smtp/postfix" type="service" version="1">
+ <create_default_instance enabled="false" />
+ <single_instance />
+ <dependency name="network" grouping="require_all" restart_on="error" type="service">
+ <service_fmri value="svc:/milestone/network:default" />
+ </dependency>
+
+ <dependency name="filesystem-local" grouping="require_all" restart_on="error" type="service">
+ <service_fmri value="svc:/system/filesystem/local" />
+ </dependency>
+
+ <dependency name="name-services" grouping="require_all" restart_on="refresh" type="service">
+ <service_fmri value="svc:/milestone/name-services" />
+ </dependency>
+
+ <dependency name="system-log" grouping="optional_all" restart_on="error" type="service">
+ <service_fmri value="svc:/system/system-log" />
+ </dependency>
+
+ <!--
+ If autofs is enabled, wait for it to get users" home
+ directories.
+ -->
+ <dependency name="autofs" grouping="optional_all" restart_on="error" type="service">
+ <service_fmri value="svc:/system/filesystem/autofs" />
+ </dependency>
+
+ <dependent name="postfix_multi-user" grouping="optional_all" restart_on="none">
+ <service_fmri value="svc:/milestone/multi-user" />
+ </dependent>
+
+ <exec_method type="method" name="start"
+ exec="/opt/omni/sbin/postfix start"
+ timeout_seconds="180" />
+
+ <exec_method type="method" name="stop"
+ exec="/opt/omni/sbin/postfix stop"
+ timeout_seconds="60" />
+
+ <exec_method type="method" name="restart"
+ exec="/opt/omni/sbin/postfix reload"
+ timeout_seconds="60" />
+
+ <stability value="Unstable" />
+
+ <template>
+ <common_name>
+ <loctext xml:lang="C">
+ Postfix Mailserver
+ </loctext>
+ </common_name>
+
+ <documentation>
+ <manpage title="postfix" section="1" manpath="/usr/local/man" />
+ </documentation>
+ </template>
+ </service>
+</service_bundle>
View
3  test/fixtures/cookbooks/fake/metadata.rb
@@ -0,0 +1,3 @@
+name "fake"
+version "0.0.1"
+description "Not a real cookbook, used for testing only."
View
5 test/fixtures/cookbooks/fake/recipes/omnios.rb
@@ -0,0 +1,5 @@
+execute "pkg set-publisher -g http://pkg.omniti.com/omniti-ms/ ms.omniti.com" do
+ not_if "pkg publisher ms.omniti.com"
+end
+
+execute "pkg refresh --full"
Please sign in to comment.
Something went wrong with that request. Please try again.