Skip to content

Commit

Permalink
Merge pull request #89 from ccin2p3/logging_parameters
Browse files Browse the repository at this point in the history
Custom logging manifest
  • Loading branch information
kreczko committed May 2, 2018
2 parents 7458cd3 + 10405b1 commit 4b40beb
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 12 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ Puppetforge: https://forge.puppetlabs.com/HEPPuppet/htcondor
3. [Setup - The basics of getting started with htcondor](#setup)
4. [Singularity container support](#singularity)
5. [Kerberos authentication support](#kerberos)
6. [Limitations - OS compatibility, etc.](#limitations)
7. [Development - Guide for contributing to the module](#development)
6. [Additional logging parameters](#logging)
7. [Limitations - OS compatibility, etc.](#limitations)
8. [Development - Guide for contributing to the module](#development)
* [Contributing to the htcondor module](#contributing)
* [Running tests - A quick guide](#running-tests)

Expand Down Expand Up @@ -110,6 +111,20 @@ krb_mapfile_entries => {'REALM1' =>'realm1', 'REALM2' => 'realm2'},
```
This will deploy a map file containing the entries listed in the `krb_mapfile_entries` hash. The keytab, however, is not deployed through this module and has to be placed to a path corresponding to `krb_srv_keytab`, with the appropriate owner and mode.

## Logging
If you want HTCondor to use custom logging parameters, you may specify `use_custom_logs` and the `logging_parameters` hash with the `{parameter_name => desired_value}` form. For example:
```
use_custom_logs => true,
$logging_parameters => { 'SCHEDD_DEBUG' => 'D_NETWORK,D_PROTOCOL', NEGOTIATOR_DEBUG' => 'D_FULLDEBUG', ... }
```
Please note that no verification is applied, you have to carefully check your syntax to ensure daemons will restart correctly.

If you want HTCondor to log to syslog, there's a specific `log_to_syslog` boolean predefined, which defaults to false. To enable it:
```
use_custom_logs => true,
log_to_syslog => true,
```

## Limitations
### General

Expand Down
27 changes: 17 additions & 10 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
$is_worker = $htcondor::is_worker
$managers = $htcondor::managers
$use_shared_port = $htcondor::use_shared_port
$use_custom_logs = $htcondor::use_custom_logs
$use_debug_notify = $htcondor::use_debug_notify

# purge all non-managed config files from /etc/condor/config.d
Expand All @@ -22,7 +23,11 @@
# SharedPort service configuration
$sharedport_class = 'htcondor::config::sharedport'

# Logging params configuration
$logging_class = 'htcondor::config::logging'

class { $common_class: }
contain "${common_class}"
$more_than_two_managers = size($managers) > 1
$run_ganglia = $ganglia_cluster_name != undef

Expand All @@ -44,27 +49,29 @@
}
}

if $use_custom_logs {
class { $logging_class: }
contain "${logging_class}"
}

if $use_shared_port {
class { $sharedport_class: }
anchor { 'htcondor::common_config_done':
require => [ Class[$common_class], Class[$sharedport_class] ],
}
} else {
anchor { 'htcondor::common_config_done':
require => Class[$common_class]
}
contain "${sharedport_class}"
}

if $is_scheduler {
class { 'htcondor::config::scheduler': require => Anchor['htcondor::common_config_done'], }
class { 'htcondor::config::scheduler': }
contain 'htcondor::config::scheduler'
}

if $is_manager {
class { 'htcondor::config::manager': require => Anchor['htcondor::common_config_done'], }
class { 'htcondor::config::manager': }
contain 'htcondor::config::manager'
}

if $is_worker {
class { 'htcondor::config::worker': require => Anchor['htcondor::common_config_done'], }
class { 'htcondor::config::worker': }
contain 'htcondor::config::worker'
}

}
21 changes: 21 additions & 0 deletions manifests/config/logging.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
class htcondor::config::logging(
$log_to_syslog = $htcondor::log_to_syslog,
$logging_parameters = $htcondor::logging_parameters,
$template_logging = $htcondor::template_logging,
$condor_user = $htcondor::condor_user,
$condor_group = $htcondor::condor_group,
)
{

file { '/etc/condor/config.d/14_logging.config':
content => template($template_logging),
require => Package['condor'],
owner => $condor_user,
group => $condor_group,
mode => '0644',
notify => Exec['/usr/sbin/condor_reconfig'],
}
}

# vim: ft=puppet
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
$template_workernode = $htcondor::params::template_workernode,
$template_defrag = $htcondor::params::template_defrag,
$template_sharedport = $htcondor::params::template_sharedport,
$template_logging = $htcondor::params::template_logging,
$template_singularity = $htcondor::params::template_singularity,
$template_highavailability =
$htcondor::params::template_highavailability,
Expand Down Expand Up @@ -219,6 +220,9 @@
$use_shared_port = $htcondor::params::use_shared_port,
$shared_port = $htcondor::params::shared_port,
$shared_port_collector_name = $htcondor::params::shared_port_collector_name,
$use_custom_logs = $htcondor::params::use_custom_logs,
$log_to_syslog = $htcondor::params::log_to_syslog,
$logging_parameters = $htcondor::params::logging_parameters,
$use_singularity = $htcondor::params::use_singularity,
$singularity_path = $htcondor::params::singularity_path,
$force_singularity_jobs = $htcondor::params::force_singularity_jobs,
Expand Down
7 changes: 7 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@
$shared_port = hiera('shared_port', 9618)
$shared_port_collector_name = hiera('shared_port_collector_name', 'collector')

# Custom logging config
$use_custom_logs = hiera('use_custom_logs', false)
$log_to_syslog = hiera('log_to_syslog', false)
$logging_parameters = hiera('logging_parameters', {})

# Singularity configuration
$use_singularity = hiera('use_singularity', false)
$singularity_path = hiera('singularity_path', '/usr/bin/singularity')
Expand Down Expand Up @@ -179,6 +184,8 @@
)
$template_sharedport = hiera('template_sharedport', "${module_name}/27_shared_port.config.erb"
)
$template_logging = hiera('template_logging', "${module_name}/14_logging.config.erb"
)
$template_singularity = hiera('template_singularity', "${module_name}/50_singularity.config.erb"
)
}
7 changes: 7 additions & 0 deletions templates/14_logging.config.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
LOG_TO_SYSLOG = <%= @log_to_syslog %>
<% if @logging_parameters.any? -%>
<% @logging_parameters.each do |param, value| -%>
<%=param -%> = <%=value %>
<% end -%>
<% end -%>

0 comments on commit 4b40beb

Please sign in to comment.