Commit 079eb339 authored by Joshua Timberman's avatar Joshua Timberman Committed by Seth Vargo
Browse files

[COOK-3736] Add OmniOS support


Signed-off-by: default avatarSeth Vargo <sethvargo@gmail.com>
parent f46584eb
......@@ -11,6 +11,10 @@ platforms:
- recipe[apt]
- name: centos-6.4
- name: centos-5.9
- name: omnios-r151006c
driver_config:
box: omnios-r151006c
box_url: http://omnios.omniti.com/media/OmniOS_r151006c-r1.box
suites:
- name: default
......@@ -22,8 +26,10 @@ suites:
attributes:
rsyslog:
use_relp: true
# CentOS and OmniOS do not support relp
excludes:
- centos-5.9 # Centos5 does not support relp
- centos-5.9
- omnios-r151006c
- name: client
run_list:
- recipe[rsyslog::client]
......
......@@ -12,6 +12,7 @@ Tested on:
- Ubuntu 9.10
- Ubuntu 10.04
- RedHat 6.3
- OmniOS r151006c
### Other
To use the `recipe[rsyslog::client]` recipe, you'll need to set up the `rsyslog.server_search` or `rsyslog.server_ip` attributes. See the __Recipes__ and __Examples__ sections below.
......
......@@ -52,3 +52,27 @@ Development
9. Mark the JIRA ticket as "Fix Provided"
For more information, see [Opscode's Contribution Guidelines](https://wiki.opscode.com/display/chef/How+to+Contribute).
Testing OmniOS
--------------
This patch to test-kitchen is required to test using the OmniOS box,
as the path to `pkgadd` (`/usr/sbin`) is not in the default `vagrant`
user's path when logging in without a TTY.
https://github.com/opscode/test-kitchen/pull/164
If your local version of Vagrant is 1.2.0 or higher, you may need to
install the `vagrant-guest-omnios` plugin to get OS detection for
OmniOS to work properly.
https://github.com/clintoncwolfe/vagrant-guest-omnios
TL;DR:
vagrant plugin install vagrant-guest-omnios
The Solaris package which is installed on OmniOS does not create
symlinks in `/usr/bin` for the various Chef binaries.
https://github.com/opscode/test-kitchen/issues/213
......@@ -56,6 +56,10 @@ when 'smartos'
default['rsyslog']['config_prefix'] = '/opt/local/etc'
default['rsyslog']['modules'] = %w(immark imsolaris imtcp imudp)
default['rsyslog']['group'] = 'root'
when 'omnios'
default['rsyslog']['service_name'] = 'system/rsyslogd'
default['rsyslog']['modules'] = %w(immark imsolaris imtcp imudp)
default['rsyslog']['group'] = 'root'
end
# 50-default template attributes
......
......@@ -47,7 +47,6 @@ template "#{node['rsyslog']['config_prefix']}/rsyslog.d/50-default.conf" do
owner 'root'
group 'root'
mode '0644'
variables(:facility_logs => node['rsyslog']['default_facility_logs'])
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
end
......@@ -56,13 +55,30 @@ if platform_family?('rhel') && node['platform_version'].to_i < 6
service 'syslog' do
action [:stop, :disable]
end
# syslog needs to be stopped before rsyslog can be started on SmartOS
elsif platform_family?('smartos')
elsif platform_family?('smartos', 'omnios')
# syslog needs to be stopped before rsyslog can be started on SmartOS, OmniOS
service 'system-log' do
action :disable
end
end
if platform_family?('omnios')
# manage the SMF manifest on OmniOS
template '/var/svc/manifest/system/rsyslogd.xml' do
source 'omnios-manifest.xml.erb'
owner 'root'
group 'root'
mode '0644'
notifies :run, 'execute[import rsyslog manifest]', :immediately
end
execute 'import rsyslog manifest' do
action :nothing
command 'svccfg import /var/svc/manifest/system/rsyslogd.xml'
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
end
end
service node['rsyslog']['service_name'] do
supports :restart => true, :reload => true, :status => true
action [:enable, :start]
......
......@@ -7,7 +7,7 @@ describe 'rsyslog::client' do
$stdout.stub(:puts)
end
it 'exists fatally' do
it 'exits fatally' do
expect { ChefSpec::ChefRunner.new.converge('rsyslog::client') }.to raise_error(SystemExit)
end
end
......
......@@ -210,12 +210,35 @@ describe 'rsyslog::default' do
end
context 'system-log service' do
{ 'omnios' => '151002', 'smartos' => 'joyent_20130111T180733Z' }.each do |p, pv|
let(:chef_run) do
ChefSpec::ChefRunner.new(platform: p, version: pv).converge('rsyslog::default')
end
it "stops the system-log service on #{p}" do
expect(chef_run).to disable_service('system-log')
end
end
end
context 'on OmniOS' do
let(:chef_run) do
ChefSpec::ChefRunner.new(platform: 'smartos', version: 'joyent_20130111T180733Z').converge('rsyslog::default')
ChefSpec::ChefRunner.new(platform: 'omnios', version: '151002').converge('rsyslog::default')
end
let(:template) { chef_run.template('/var/svc/manifest/system/rsyslogd.xml') }
let(:execute) { chef_run.execute('import rsyslog manifest') }
it 'creates the custom SMF manifest' do
expect(chef_run).to create_file(template.path)
end
it 'notifies svccfg to import the manifest' do
expect(template).to notify('execute[import rsyslog manifest]', :run)
end
it 'stops the system-log service on SmartOS' do
expect(chef_run).to disable_service('system-log')
it 'notifies rsyslog to restart when importing the manifest' do
expect(execute).to notify('service[system/rsyslogd]', :restart)
end
end
......
......@@ -6,7 +6,3 @@ Berkshelf.ui.mute do
berksfile = Berkshelf::Berksfile.from_file('Berksfile')
berksfile.install(path: 'vendor/cookbooks', only: 'integration')
end
RSpec.configure do |config|
config.expect_with(:rspec) { |c| c.syntax = :expect }
end
# Generated by Chef for <%= node['fqdn'] %>
# For more information see rsyslog.conf(5) and /etc/rsyslog.conf
<% @facility_logs.each do |key, value| %>
<% node['rsyslog']['default_facility_logs'].each do |key, value| %>
<%= key %> <%= value %>
<% end %>
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='<%= node['rsyslog']['service_name'] %>' type='service' version='0'>
<create_default_instance enabled='true'/>
<single_instance/>
<dependency name='network' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/milestone/network:default'/>
</dependency>
<dependency name='filesystem' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<method_context/>
<exec_method name='start' type='method' exec='/opt/omni/sbin/rsyslogd -f %{config_file}' timeout_seconds='60'/>
<exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'/>
<property_group name='startd' type='framework'>
<propval name='duration' type='astring' value='contract'/>
<propval name='ignore_error' type='astring' value='core,signal'/>
</property_group>
<property_group name='application' type='application'>
<propval name='config_file' type='astring' value='<%= node["rsyslog"]["config_prefix"] %>/rsyslog.conf'/>
</property_group>
<stability value='Evolving'/>
<template>
<common_name>
<loctext xml:lang='C'>rsyslog daemon</loctext>
</common_name>
</template>
</service>
</service_bundle>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment