Skip to content

Commit

Permalink
clean up configmethod a bit, another defined type abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
krorvik committed Jun 2, 2016
1 parent 1661f0b commit a8b53cb
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 30 deletions.
11 changes: 3 additions & 8 deletions manifests/kafka/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@

) {

$server_propertyfile = '/etc/kafka/server.properties'

$keys = keys(merge({}, $::confluent::kafka_server_properties))

confluent::property { $keys:
propertyfile => $server_propertyfile,
component => 'kafkaserver',
settingshash => $::confluent::kafka_server_properties,
::confluent::propertyfile { '/etc/kafka/server.properties':
propertyhash => $::confluent::kafka_server_properties,
component => 'kafka-server',
}

}
15 changes: 15 additions & 0 deletions manifests/propertyfile.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
define confluent::propertyfile (
$propertyhash,
$component,
) {

$keys = keys(merge({}, $propertyhash))

::confluent::property { $keys:
propertyfile => $name,
component => $component,
settingshash => $propertyhash,
}


}
9 changes: 2 additions & 7 deletions manifests/restservice/config.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
class confluent::restservice::config {

$restservice_propertyfile = '/etc/kafka-rest/kafka-rest.properties'

$keys = keys(merge({}, $::confluent::restservice_properties))

::confluent::property { $keys:
propertyfile => $restservice_propertyfile,
::confluent::propertyfile { '/etc/kafka-rest/kafka-rest.properties':
propertyhash => $::confluent::restservice_properties,
component => 'restservice',
settingshash => $::confluent::restservice_properties,
}

}
9 changes: 2 additions & 7 deletions manifests/schemaregistry/config.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
class confluent::schemaregistry::config {

$schemaregistry_propertyfile = '/etc/schema-registry/schema-registry.properties'

$keys = keys(merge({}, $::confluent::schemaregistry_properties))

::confluent::property { $keys:
propertyfile => $schemaregistry_propertyfile,
::confluent::propertyfile { '/etc/schema-registry/schema-registry.properties':
propertyhash => $::confluent::schemaregistry_properties,
component => 'schemaregistry',
settingshash => $::confluent::schemaregistry_properties,
}

}
9 changes: 2 additions & 7 deletions manifests/zookeeper/config.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
class confluent::zookeeper::config {

$zookeeper_propertyfile = '/etc/kafka/zookeeper.properties'

$keys = keys(merge({}, $::confluent::zookeeper_properties))

::confluent::property { $keys:
propertyfile => $zookeeper_propertyfile,
::confluent::propertyfile { '/etc/kafka/zookeeper.properties':
propertyhash =>$::confluent::zookeeper_properties,
component => 'zookeeper',
settingshash => $::confluent::zookeeper_properties,
}

}
2 changes: 2 additions & 0 deletions spec/classes/confluent__kafka__config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
context 'with default values do' do

it { should contain_class('confluent::kafka::config') }
it { should contain_confluent__propertyfile('/etc/kafka/server.properties') }


end

Expand Down
11 changes: 11 additions & 0 deletions spec/classes/confluent__propertyfile.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'spec_helper'

describe 'confluent::propertyfile' do

context 'with default values for all parameters' do

it { should contain_class('confluent::propertyfile') }

end

end
2 changes: 1 addition & 1 deletion spec/classes/confluent__restservice__config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
context 'with default values do' do

it { should contain_class('confluent::restservice::config') }
#it { should contain_file('/etc/kafka/kafka-rest-log4j.properties') }
it { should contain_confluent__propertyfile('/etc/kafka-rest/kafka-rest.properties') }

end

Expand Down
1 change: 1 addition & 0 deletions spec/classes/confluent__schemaregistry__config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
context 'with default values do' do

it { should contain_class('confluent::schemaregistry::config') }
it { should contain_confluent__propertyfile('/etc/schema-registry/schema-registry.properties') }

end

Expand Down
1 change: 1 addition & 0 deletions spec/classes/confluent__zookeeper__config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
context 'with default values do' do

it { should contain_class('confluent::zookeeper::config') }
it { should contain_confluent__propertyfile('/etc/kafka/zookeeper.properties') }

end

Expand Down

0 comments on commit a8b53cb

Please sign in to comment.