Skip to content
This repository has been archived by the owner on Jun 28, 2018. It is now read-only.

Commit

Permalink
Fixes #9157: Allows customizing the crane port.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Aug 26, 2015
1 parent 741979b commit 522afbe
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 13 deletions.
5 changes: 1 addition & 4 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
fixtures:
repositories:
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
apache: "git://github.com/puppetlabs/puppetlabs-apache.git"
foreman: "git://github.com/theforeman/puppet-foreman.git"
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
concat: "git://github.com/puppetlabs/puppetlabs-concat"
certs: "git://github.com/katello/puppet-certs.git"
common: "git://github.com/katello/puppet-common.git"
symlinks:
crane: "#{source_dir}"
2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Configure Crane
class crane::config {
file { '/etc/crane.conf':
ensure => file,
ensure => 'file',
mode => '0644',
owner => 'root',
group => 'root',
Expand Down
10 changes: 6 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
#
# $ca_cert:: Path to the SSL CA cert for https
#
# $port:: Port for Crane to run on
#
class crane (
$key = $crane::params::key,
$cert = $crane::params::cert,
$ca_cert = $crane::params::ca_cert,

$key = $crane::params::key,
$cert = $crane::params::cert,
$ca_cert = $crane::params::ca_cert,
$port = $crane::params::port,
) inherits crane::params {

class { '::crane::install': } ~>
Expand Down
54 changes: 54 additions & 0 deletions spec/classes/crane_config_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
require 'spec_helper'

describe 'crane' do
let :default_facts do
{
:fqdn => 'localhost.localdomain',
:concat_basedir => '/tmp',
:interfaces => '',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6.4',
:operatingsystemmajrelease => '6.4',
:osfamily => 'RedHat',
:processorcount => 3
}
end

context 'with no parameters' do
let :pre_condition do
"class {'crane':}"
end

let :facts do
default_facts
end

it "should set up the config file" do
should contain_file('/etc/crane.conf').
with({
'ensure' => 'file',
'owner' => 'root',
'group' => 'root',
'mode' => '0644',
}).
with_content(/^endpoint: localhost.localdomain:5000$/)
end
end

context 'with parameters' do
let :pre_condition do
"class {'crane':
port => 5001
}"
end

let :facts do
default_facts
end

it "should set the port" do
should contain_file('/etc/crane.conf').
with_content(/^endpoint: localhost.localdomain:5001$/)
end
end
end
4 changes: 0 additions & 4 deletions spec/classes/crane_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
}
end

let(:pre_condition) do
['include certs']
end

it { should contain_class('crane::install') }
it { should contain_class('crane::config') }
end
Expand Down

0 comments on commit 522afbe

Please sign in to comment.