|
475 | 475 | }
|
476 | 476 | }
|
477 | 477 | } else {
|
478 |
| - $docker_run_inline_start = template('docker/docker-run-start.erb') |
479 |
| - $docker_run_inline_stop = template('docker/docker-run-stop.erb') |
| 478 | + $run_start_parameters = { |
| 479 | + 'before_start' => $before_start, |
| 480 | + 'remove_container_on_start' => $remove_container_on_start, |
| 481 | + 'docker_command' => $docker_command, |
| 482 | + 'remove_volume_on_start' => $remove_volume_on_start, |
| 483 | + 'sanitised_title' => $sanitised_title, |
| 484 | + 'pull_on_start' => $pull_on_start, |
| 485 | + 'image' => $image, |
| 486 | + 'verify_digest' => $verify_digest, |
| 487 | + 'docker_run_flags' => $docker_run_flags, |
| 488 | + 'command' => $command, |
| 489 | + 'after_create' => $after_create, |
| 490 | + 'net' => $net, |
| 491 | + 'valid_detach' => $valid_detach, |
| 492 | + 'after_start' => $after_start, |
| 493 | + } |
| 494 | + |
| 495 | + $docker_run_inline_start = epp('docker/docker-run-start.epp', $run_start_parameters) |
| 496 | + |
| 497 | + $run_stop_parameters = { |
| 498 | + 'before_stop' => $before_stop, |
| 499 | + 'docker_command' => $docker_command, |
| 500 | + 'stop_wait_time' => $stop_wait_time, |
| 501 | + 'sanitised_title' => $sanitised_title, |
| 502 | + 'remove_container_on_stop' => $remove_container_on_stop, |
| 503 | + 'remove_volume_on_stop' => $remove_volume_on_stop, |
| 504 | + 'after_stop' => $after_stop, |
| 505 | + } |
| 506 | + |
| 507 | + $docker_run_inline_stop = epp('docker/docker-run-stop.epp', $run_stop_parameters) |
480 | 508 |
|
481 | 509 | case $service_provider_real {
|
482 | 510 | 'systemd': {
|
483 | 511 | $initscript = "/etc/systemd/system/${service_prefix}${sanitised_title}.service"
|
484 | 512 | $startscript = "/usr/local/bin/docker-run-${sanitised_title}-start.sh"
|
485 | 513 | $stopscript = "/usr/local/bin/docker-run-${sanitised_title}-stop.sh"
|
486 | 514 | $startstop_template = 'docker/usr/local/bin/docker-run.sh.epp'
|
487 |
| - $init_template = 'docker/etc/systemd/system/docker-run.erb' |
| 515 | + $init_template = 'docker/etc/systemd/system/docker-run.epp' |
488 | 516 | $mode = '0644'
|
489 | 517 | $hasstatus = true
|
490 | 518 | }
|
491 | 519 | 'upstart': {
|
492 | 520 | $initscript = "/etc/init.d/${service_prefix}${sanitised_title}"
|
493 |
| - $init_template = 'docker/etc/init.d/docker-run.erb' |
| 521 | + $init_template = 'docker/etc/init.d/docker-run.epp' |
494 | 522 | $mode = '0750'
|
495 | 523 | $startscript = undef
|
496 | 524 | $stopscript = undef
|
|
589 | 617 | }
|
590 | 618 | }
|
591 | 619 |
|
| 620 | + if $service_provider_real == 'systemd' { |
| 621 | + $init_template_parameters = { |
| 622 | + 'depend_services_array' => $depend_services_array, |
| 623 | + 'sanitised_after_array' => $sanitised_after_array, |
| 624 | + 'service_prefix' => $service_prefix, |
| 625 | + 'sanitised_depends_array' => $sanitised_depends_array, |
| 626 | + 'title' => $title, |
| 627 | + 'have_systemd_v230' => $docker::params::have_systemd_v230, |
| 628 | + 'extra_systemd_parameters' => $extra_systemd_parameters, |
| 629 | + 'systemd_restart' => $systemd_restart, |
| 630 | + '_syslog_identifier' => $_syslog_identifier, |
| 631 | + 'syslog_facility' => $syslog_facility, |
| 632 | + 'sanitised_title' => $sanitised_title, |
| 633 | + 'remain_after_exit' => $remain_after_exit, |
| 634 | + 'service_name' => $service_name, |
| 635 | + } |
| 636 | + } elsif $service_provider_real == 'upstart' { |
| 637 | + $init_template_parameters = { |
| 638 | + 'sanitised_after_array' => $sanitised_after_array, |
| 639 | + 'service_prefix' => $service_prefix, |
| 640 | + 'sanitised_depends_array' => $sanitised_depends_array, |
| 641 | + 'depend_services_array' => $depend_services_array, |
| 642 | + 'docker_command' => $docker_command, |
| 643 | + 'sanitised_title' => $sanitised_title, |
| 644 | + 'docker_run_inline_start' => $docker_run_inline_start, |
| 645 | + 'docker_run_inline_stop' => $docker_run_inline_stop, |
| 646 | + } |
| 647 | + } |
| 648 | + |
592 | 649 | file { $initscript:
|
593 | 650 | ensure => file,
|
594 |
| - content => template($init_template), |
| 651 | + content => epp($init_template, $init_template_parameters), |
595 | 652 | seltype => 'container_unit_file_t',
|
596 | 653 | owner => 'root',
|
597 | 654 | group => $docker_group,
|
|
0 commit comments