Skip to content

Commit

Permalink
Merge pull request #74 from enovance/lint
Browse files Browse the repository at this point in the history
Lint puppet code and add puppetdoc documentation
  • Loading branch information
Emilien Macchi committed Dec 15, 2014
2 parents 05c57ed + 6a6033d commit d0e77de
Show file tree
Hide file tree
Showing 9 changed files with 192 additions and 21 deletions.
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ source "https://rubygems.org"

group :development, :test do
gem 'puppetlabs_spec_helper', :require => false
gem 'puppet-lint', '~> 0.3.2'
gem 'puppet-lint-param-docs'
gem 'metadata-json-lint'
gem 'puppet-syntax'
gem 'puppet-lint'
gem 'rake', '10.1.0'
gem 'rspec', '< 2.99'
gem 'puppet-syntax'
end

if puppetversion = ENV['PUPPET_VERSION']
Expand Down
8 changes: 7 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ exclude_tests_paths = ['pkg/**/*','vendor/**/*','spec/**/*','examples/**/*']
PuppetLint.configuration.ignore_paths = exclude_tests_paths
PuppetSyntax.exclude_paths = exclude_tests_paths

desc "Validate the metadata.json syntax"
task :validate_metadata_json do
$stderr.puts "---> syntax:metadata.json"
sh "metadata-json-lint metadata.json"
end

task(:default).clear
task :default => [:syntax,:lint,:spec]
task :default => [:syntax,:lint,:validate_metadata_json,:spec]

namespace :module do
desc "Build #{NAME} module (in a clean env) Please use this for puppetforge"
Expand Down
10 changes: 5 additions & 5 deletions examples/site.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
) {

class { 'role_ceph':
fsid => $::fsid,
auth_type => 'cephx',
fsid => $::fsid,
auth_type => 'cephx',
}

ceph::mon { $id:
monitor_secret => $::mon_secret,
mon_port => 6789,
mon_addr => $ipaddress_eth2,
mon_addr => $::ipaddress_eth2,
}

}
Expand All @@ -61,8 +61,8 @@
node /ceph-osd.?\.test/ {

class { 'role_ceph':
fsid => $::fsid,
auth_type => 'cephx',
fsid => $::fsid,
auth_type => 'cephx',
}

class { 'ceph::osd' :
Expand Down
17 changes: 15 additions & 2 deletions manifests/apt/ceph.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,21 @@
#
# == Parameters
#
# [*release*] The ceph release name
# Optional. Default to bobtail
# [*release*]
# (Optional) The ceph release name
# Default to 'bobtail'
#
# [*apt_key_source*]
# (Optional) The source URL of APT GPG key
# Defaults to 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc'
#
# [*apt_key_id*]
# (Optional) The GPG ID of Ceph key
# Defaults to '17ED316D'
#
# [*apt_source_location*]
# (Optional) A custom APT repository for Ceph packages
# Defaults to 'http://ceph.com/debian-${release}/'
#
# == Dependencies
#
Expand Down
134 changes: 131 additions & 3 deletions manifests/conf.pp
Original file line number Diff line number Diff line change
@@ -1,11 +1,139 @@
# Creates the ceph configuration file
#
# == Parameters
# [*fsid*] The cluster's fsid.
#
# [*fsid*]
# The cluster's fsid.
# Mandatory. Get one with `uuidgen -r`.
#
# [*auth_type*] Auth type.
# Optional. none or 'cephx'. Defaults to 'cephx'.
# [*auth_type*]
# (Optional) Auth type, could be 'none' or 'cephx'.
# Defaults to 'cephx'.
#
# [*signatures_require*]
# (Optional) If set to true, Ceph requires signatures on all message traffic
# between the Ceph Client and the Ceph Storage Cluster, and between daemons
# comprising the Ceph Storage Cluster.
# Defaults to 'undef'
#
# [*signatures_cluster*]
# (Optional) If set to true, Ceph requires signatures on all message traffic
# between Ceph daemons comprising the Ceph Storage Cluster.
# Defaults to 'undef'
#
# [*signatures_service*]
# (Optional) If set to true, Ceph requires signatures on all message traffic
# between Ceph Clients and the Ceph Storage Cluster.
# Defaults to 'undef'
#
# [*signatures_sign_msgs*]
# (Optional) If the Ceph version supports message signing, Ceph will sign all
# messages so they cannot be spoofed.
# Defaults to 'undef'
#
# [*pool_default_size*]
# (Optional) Sets the number of replicas for objects in the pool. The default
# value is the same as ceph osd pool set {pool-name} size {size}.
# Defaults to '3'
#
# [*pool_default_pg_num*]
# (Optional) The default number of placement groups for a pool. The default
# value is the same as pg_num with mkpool.
# Defaults to '1024'
#
# [*pool_default_pgp_num*]
# (Optional) The default number of placement groups for placement for a pool.
# The default value is the same as pgp_num with mkpool. PG and PGP should be
# equal (for now).
# Defaults to '1024'
#
# [*pool_default_min_size*]
# (Optional) Sets the minimum number of written replicas for objects in the
# pool in order to acknowledge a write operation to the client. If minimum is
# not met, Ceph will not acknowledge the write to the client. This setting
# ensures a minimum number of replicas when operating in degraded mode.
# Defaults to 'undef'
#
# [*pool_default_crush_rule*]
# (Optional) The default CRUSH rule to use when creating a replicated pool.
# Default to 'undef'
#
# [*journal_size_mb*]
# (Optional) The size of the journal in megabytes. If this is 0, and the
# journal is a block device, the entire block device is used. Since v0.54,
# this is ignored if the journal is a block device, and the entire block
# device is used.
# Defaults to '4096'
#
# [*cluster_network*]
# (Optional) The IP address and netmask of the cluster (back-side) network
# (e.g., 10.0.0.0/24). Set in [global]. You may specify comma-delimited
# subnets.
# Defaults to 'undef'
#
# [*public_network*]
# (Optional) The IP address and netmask of the public (front-side) network
# (e.g., 192.168.0.0/24). Set in [global]. You may specify comma-delimited
# subnets.
# Defaults to 'undef'
#
# [*mon_init_members*]
# (Optional) The IDs of initial monitors in a cluster during startup. If
# specified, Ceph requires an odd number of monitors to form an initial quorum
# (e.g., 3).
# Defaults to 'undef'
#
# [*mon_data*]
# (Optional) The monitor's data location
# Defaults to '/var/lib/ceph/mon/mon.$id'
#
# [*osd_data*]
# (Optional) The path to the OSDs data. You must create the directory when
# deploying Ceph. You should mount a drive for OSD data at this mount point.
# We do not recommend changing the default.
# Default to '/var/lib/ceph/osd/ceph-$id'
#
# [*osd_journal*]
# (Optional) The path to the OSD’s journal. This may be a path to a file or a
# block device (such as a partition of an SSD). If it is a file, you must
# create the directory to contain it. We recommend using a drive separate from
# the osd data drive.
# Defaults to 'undef'
#
# [*mds_data*]
# (Optional) The mds's data location
# Defaults to '/var/lib/ceph/mds/mds.$id'
#
# [*enable_service*]
# (Optional) Enable or not Ceph services at boot time
# Defaults to 'false'
#
# [*conf_owner*]
# (Optional) Username or id of Ceph configuration files owner
# Defaults to 'root'
#
# [*conf_group*]
# (Optional) Username or id of Ceph configuration files group
# Defaults to '0'
#
# [*config*]
# (Optional) A custom configuration, using keys/values
# Defaults to '{}'
#
# [*osd_recovery_max_active*]
# (Optional) The number of active recovery requests per OSD at one time. More
# requests will accelerate recovery, but the requests places an increased load
# on the cluster.
# Defaults to '1'
#
# [*osd_max_backfills*]
# (Optional) The maximum number of backfills allowed to or from a single OSD
# Defaults to '1'
#
# [*osd_recovery_op_priority*]
# (Optional) The priority set for recovery operations. It is relative to osd
# client op priority.
# Defaults to '1'
#
# == Dependencies
#
Expand Down
2 changes: 1 addition & 1 deletion manifests/key.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

exec { "ceph-key-${name}":
command => "ceph-authtool ${keyring_path} --create-keyring --name='client.${name}' --add-key='${secret}'",
unless => "grep ${secret} ${keyring_path}",
unless => "grep ${secret} ${keyring_path}",
require => Package['ceph'],
}

Expand Down
9 changes: 4 additions & 5 deletions manifests/mds.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#
# Copyright 2012 eNovance <[email protected]>
#

define ceph::mds (
$fsid,
$auth_type = 'cephx',
Expand All @@ -43,10 +42,10 @@
$mds_data_expanded = "${mds_data}/mds.${name}"

file { $mds_data_expanded:
ensure => directory,
owner => 'root',
group => 0,
mode => '0755',
ensure => directory,
owner => 'root',
group => 0,
mode => '0755',
}

exec { 'ceph-mds-keyring':
Expand Down
9 changes: 7 additions & 2 deletions manifests/osd.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
#
# == Parameters
#
# [*osd_addr*] The osd's address.
# Optional. Defaults to the $ipaddress fact.
# [*public_address*]
# (Optional) The IP address for the public (front-side) network. Set for each daemon.
# Defaults to '$::ipaddress'
#
# [*cluster_address*]
# (Optional) The IP address for the cluster (back-side) network. Set for each daemon.
# Defaults to '$::ipaddress'
#
# == Dependencies
#
Expand Down
18 changes: 18 additions & 0 deletions manifests/yum/ceph.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Configure yum repository
#
# == Parameters
#
# [*release*]
# (Optional) The ceph release name
# Default to 'cuttlefish'
#
# == Dependencies
#
# none
#
# == Authors
#
# Francois Charlier [email protected]
#
# == Copyright
#
# Copyright 2012 eNovance <[email protected]>
#
class ceph::yum::ceph (
$release = 'cuttlefish'
) {
Expand Down

0 comments on commit d0e77de

Please sign in to comment.