Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up tests #484

Draft
wants to merge 16 commits into
base: modulesync
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 36 additions & 45 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* [`cassandra::java`](#cassandra--java): A class to install Java and JNA packages.
* [`cassandra::optutils`](#cassandra--optutils): A class to install the optional Cassandra tools package.
* [`cassandra::params`](#cassandra--params): This class is meant to be called from the locp-cassandra module. It sets variables according to platform.
* [`cassandra::schema`](#cassandra--schema): A class to maintain the database schema. Please note that cqlsh expects Python 2.7 to be installed. This may be a problem of older distributions (CentOS 6 for example).
* [`cassandra::schema`](#cassandra--schema): A class to maintain the database schema.
* [`cassandra::system::swapoff`](#cassandra--system--swapoff): Disable swap on the node as suggested at http://docs.datastax.com/en/landing_page/doc/landing_page/recommendedSettingsLinux.html
* [`cassandra::system::sysctl`](#cassandra--system--sysctl): Set Sysctl (kernel runtime parameters) as suggested in http://docs.datastax.com/en/landing_page/doc/landing_page/recommendedSettingsLinux.htm
* [`cassandra::system::transparent_hugepage`](#cassandra--system--transparent_hugepage): Disable Transparant Huge Pages as suggested in http://docs.datastax.com/en/landing_page/doc/landing_page/recommendedSettingsLinux.html.
Expand Down Expand Up @@ -72,7 +72,6 @@ The following parameters are available in the `cassandra` class:
* [`service_refresh`](#-cassandra--service_refresh)
* [`settings`](#-cassandra--settings)
* [`snitch_properties_file`](#-cassandra--snitch_properties_file)
* [`systemctl`](#-cassandra--systemctl)

##### <a name="-cassandra--baseline_settings"></a>`baseline_settings`

Expand Down Expand Up @@ -406,16 +405,6 @@ full path name would be *config_path*/*snitch_properties_file*.

Default value: `'cassandra-rackdc.properties'`

##### <a name="-cassandra--systemctl"></a>`systemctl`

Data type: `string`

The full path to the systemctl command. Only
needed when the package is installed. Will silently continue if the
executable does not exist.

Default value: `$cassandra::params::systemctl`

### <a name="cassandra--apache_repo"></a>`cassandra::apache_repo`

An optional class that will allow a suitable repository to be configured
Expand Down Expand Up @@ -776,12 +765,12 @@ Default value: `'cassandra/dse.yaml.erb'`

##### <a name="-cassandra--dse--file_lines"></a>`file_lines`

Data type: `hash`
Data type: `Hash`

A hash of values that are passed to
`create_resources` as a `file_line` resource.

Default value: `undef`
Default value: `{}`

##### <a name="-cassandra--dse--service_refresh"></a>`service_refresh`

Expand All @@ -794,13 +783,13 @@ Default value: `true`

##### <a name="-cassandra--dse--settings"></a>`settings`

Data type: `hash`
Data type: `Hash`

Unless this attribute is set to a hash (which is
then placed as YAML inside `dse.yaml`) then the `dse.yaml` is left
unchanged.

Default value: `undef`
Default value: `{}`

### <a name="cassandra--firewall_ports"></a>`cassandra::firewall_ports`

Expand Down Expand Up @@ -1028,7 +1017,9 @@ It sets variables according to platform.

### <a name="cassandra--schema"></a>`cassandra::schema`

A class to maintain the database schema. Please note that cqlsh expects Python 2.7 to be installed. This may be a problem of older distributions (CentOS 6 for example).
A class to maintain the database schema.

* **Note** cqlsh expects Python 2.7. This may be a problem on older distributions (CentOS 6 for example).

#### Parameters

Expand Down Expand Up @@ -1580,15 +1571,15 @@ Default value: `$title`

Data type: `Boolean`


Use Red Hat software collections

Default value: `$cassandra::params::use_scl`

##### <a name="-cassandra--schema--cql_type--scl_name"></a>`scl_name`

Data type: `String[1]`


Name of the software collection to use

Default value: `$cassandra::params::scl_name`

Expand Down Expand Up @@ -1669,15 +1660,15 @@ The name of the table that the index is to be associated with.

Data type: `Boolean`


Use Red Hat software collections

Default value: `$cassandra::params::use_scl`

##### <a name="-cassandra--schema--index--scl_name"></a>`scl_name`

Data type: `String[1]`


Name of the software collection to use

Default value: `$cassandra::params::scl_name`

Expand Down Expand Up @@ -1760,15 +1751,15 @@ Default value: `{}`

Data type: `Boolean`


Use Red Hat software collections

Default value: `$cassandra::params::use_scl`

##### <a name="-cassandra--schema--keyspace--scl_name"></a>`scl_name`

Data type: `String[1]`


Name of the software collection to use

Default value: `$cassandra::params::scl_name`

Expand All @@ -1790,9 +1781,9 @@ The following parameters are available in the `cassandra::schema::permission` de
* [`ensure`](#-cassandra--schema--permission--ensure)
* [`keyspace_name`](#-cassandra--schema--permission--keyspace_name)
* [`permission_name`](#-cassandra--schema--permission--permission_name)
* [`table_name`](#-cassandra--schema--permission--table_name)
* [`use_scl`](#-cassandra--schema--permission--use_scl)
* [`scl_name`](#-cassandra--schema--permission--scl_name)
* [`table_name`](#-cassandra--schema--permission--table_name)

##### <a name="-cassandra--schema--permission--user_name"></a>`user_name`

Expand Down Expand Up @@ -1826,6 +1817,22 @@ Data type: `string`

Can be one of the following:

Default value: `'ALL'`

##### <a name="-cassandra--schema--permission--use_scl"></a>`use_scl`

Data type: `Boolean`

Use Red Hat software collections

Default value: `$cassandra::params::use_scl`

##### <a name="-cassandra--schema--permission--scl_name"></a>`scl_name`

Data type: `String[1]`

Name of the software collection to use

* 'ALTER' - ALTER KEYSPACE, ALTER TABLE, CREATE INDEX, DROP INDEX.
* 'AUTHORIZE' - GRANT, REVOKE.
* 'CREATE' - CREATE KEYSPACE, CREATE TABLE.
Expand All @@ -1836,7 +1843,7 @@ Can be one of the following:
If the permission_name is set to 'ALL', this will set all of the specific
permissions listed.

Default value: `'ALL'`
Default value: `$cassandra::params::scl_name`

##### <a name="-cassandra--schema--permission--table_name"></a>`table_name`

Expand All @@ -1848,22 +1855,6 @@ tables within the keyspace.

Default value: `undef`

##### <a name="-cassandra--schema--permission--use_scl"></a>`use_scl`

Data type: `Boolean`



Default value: `$cassandra::params::use_scl`

##### <a name="-cassandra--schema--permission--scl_name"></a>`scl_name`

Data type: `String[1]`



Default value: `$cassandra::params::scl_name`

### <a name="cassandra--schema--table"></a>`cassandra::schema::table`

Create or drop tables within the schema.
Expand Down Expand Up @@ -1940,15 +1931,15 @@ Default value: `$title`

Data type: `Boolean`


Use Red Hat software collections

Default value: `$cassandra::params::use_scl`

##### <a name="-cassandra--schema--table--scl_name"></a>`scl_name`

Data type: `String[1]`


Name of the software collection to use

Default value: `$cassandra::params::scl_name`

Expand Down Expand Up @@ -2030,15 +2021,15 @@ Default value: `$title`

Data type: `Boolean`


Use Red Hat software collections

Default value: `$cassandra::params::use_scl`

##### <a name="-cassandra--schema--user--scl_name"></a>`scl_name`

Data type: `String[1]`


Name of the software collection to use

Default value: `$cassandra::params::scl_name`

2 changes: 1 addition & 1 deletion lib/facter/cassandramajorversion.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# Extract the major version from the cassandrarelease fact.
# @caveats
# @note
# Requires that the cassandrarelease has been successfully retrieved.
# @return [integer] The major version of the Cassandra instance.
# @see cassandrarelease
Expand Down
2 changes: 1 addition & 1 deletion lib/facter/cassandraminorversion.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# Extract the minor version from the cassandrarelease fact.
# @caveats
# @note
# Requires that the cassandrarelease has been successfully retrieved.
# @return [integer] The minor version of the Cassandra instance.
# @see cassandrarelease
Expand Down
2 changes: 1 addition & 1 deletion lib/facter/cassandrapatchversion.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# Extract the patch version from the cassandrarelease fact.
# @caveats
# @note
# Requires that the cassandrarelease has been successfully retrieved.
# @return [integer] The patch version of the Cassandra instance.
# @see cassandrarelease
Expand Down
4 changes: 2 additions & 2 deletions lib/facter/cassandrarelease.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

# Extract the release string from the running Cassandra instance.
#
# @resolution
# @note
# Runs the command "nodetool version".
# @caveats
# @note
# The Cassandra service needs to be running, otherwise the fact will be
# undefined.
# @return [string] The version string (e.g. 3.0.1).
Expand Down
9 changes: 0 additions & 9 deletions manifests/datastax_agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,6 @@
package { $package_name:
ensure => $package_ensure,
require => Class['cassandra'],
notify => Exec['datastax_agent_reload_systemctl'],
}

exec { 'datastax_agent_reload_systemctl':
command => "${cassandra::params::systemctl} daemon-reload",
onlyif => "test -x ${cassandra::params::systemctl}",
path => ['/usr/bin', '/bin'],
refreshonly => true,
notify => Service['datastax-agent'],
}

file { $address_config_file:
Expand Down
12 changes: 6 additions & 6 deletions manifests/dse.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# @param config_file [string] The full path to the DSE configuration file.
# @param config_file_mode [string] The mode for the DSE configuration file.
# @param dse_yaml_tmpl [string] A path to a template for the `dse.yaml` file.
# @param file_lines [hash] A hash of values that are passed to
# @param file_lines A hash of values that are passed to
# `create_resources` as a `file_line` resource.
# @param service_refresh [boolean] Whether or not the Cassandra service
# should be refreshed if the DSE configuration files are changed.
# @param settings [hash] Unless this attribute is set to a hash (which is
# @param settings Unless this attribute is set to a hash (which is
# then placed as YAML inside `dse.yaml`) then the `dse.yaml` is left
# unchanged.
# @example Configure a cluster with LDAP authentication
Expand Down Expand Up @@ -49,9 +49,9 @@
$config_file = '/etc/dse/dse.yaml',
$config_file_mode = '0644',
$dse_yaml_tmpl = 'cassandra/dse.yaml.erb',
$file_lines = undef,
Hash $file_lines = {},
$service_refresh = true,
$settings = undef,
Hash $settings = {},
) {
include cassandra
include stdlib
Expand All @@ -62,7 +62,7 @@
$notifications = []
}

if is_hash($file_lines) {
if $file_lines != {} {
$default_file_line = {
require => Package['cassandra'],
notify => $notifications,
Expand All @@ -71,7 +71,7 @@
create_resources(file_line, $file_lines, $default_file_line)
}

if is_hash($settings) {
if $settings != {} {
file { $config_file:
ensure => file,
owner => 'cassandra',
Expand Down
14 changes: 1 addition & 13 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# @param commitlog_directory_mode [string] The mode for the
# `commitlog_directory` is ignored unless `commitlog_directory` is
# specified.
# @param manage_config_file [boolean] Whether or not to manage the cassandra configuration
# @param manage_config_file Whether or not to manage the cassandra configuration
# file.
# @param config_file_mode [string] The permissions mode of the cassandra configuration
# file.
Expand Down Expand Up @@ -124,9 +124,6 @@
# attribute.
# @param snitch_properties_file [string] The name of the snitch properties file. The
# full path name would be *config_path*/*snitch_properties_file*.
# @param systemctl [string] The full path to the systemctl command. Only
# needed when the package is installed. Will silently continue if the
# executable does not exist.
class cassandra (
$baseline_settings = {},
$cassandra_2356_sleep_seconds = 5,
Expand Down Expand Up @@ -158,7 +155,6 @@
$service_refresh = true,
$settings = {},
$snitch_properties_file = 'cassandra-rackdc.properties',
$systemctl = $cassandra::params::systemctl,
) inherits cassandra::params {
if $service_provider != undef {
Service {
Expand Down Expand Up @@ -248,14 +244,6 @@
package { 'cassandra':
ensure => $package_ensure,
name => $package_name,
notify => Exec['cassandra_reload_systemctl'],
}

exec { 'cassandra_reload_systemctl':
command => "${systemctl} daemon-reload",
onlyif => "test -x ${systemctl}",
path => ['/usr/bin', '/bin'],
refreshonly => true,
}

file { $config_path:
Expand Down
2 changes: 0 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
$jna_package_name = 'libjna-java'
$optutils_package_name = 'cassandra-tools'
$sysctl_file = '/etc/sysctl.d/10-cassandra.conf'
$systemctl = '/bin/systemctl'
$use_scl = false
$scl_name = 'nodefault'
}
Expand All @@ -35,7 +34,6 @@
$java_package = 'java-1.8.0-openjdk-headless'
$jna_package_name = 'jna'
$optutils_package_name = 'cassandra22-tools'
$systemctl = '/usr/bin/systemctl'
$use_scl = false
$scl_name = 'nodefault'
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/private/firewall_ports/rule.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

if size($ports) > 0 {
firewall { "${rule_number} - Cassandra (${rule_description}) - ${source}":
action => 'accept',
jump => 'accept',
dport => $ports,
proto => 'tcp',
source => $source,
Expand Down
Loading
Loading