Defined Type: phabricator::config

Defined in:
puppet/modules/phabricator/manifests/config.pp

Overview

Class: phabricator::config

This class sets a phabricator config value

Parameters

value

Configuration value

Parameters:

  • value (Any)


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'puppet/modules/phabricator/manifests/config.pp', line 12

define phabricator::config(
    $value,
){
    include ::phabricator

    $phab_dir = "${::phabricator::deploy_dir}/phabricator"
    # Get the value as a json string
    $json_value = ordered_json($value)
    # Strip leading/trailing quotes (if $value is a plain string don't
    # quote it because that will make `config set` sad)
    $arg_value = inline_template('<%= @json_value.gsub(/^"|"$/, "").to_s %>')
    # This still has one annyoing edge case: Phab's internal metadata
    # classifies mysql.port as a string rather than an integer for unknown
    # reasons. The jq check will fail on this every time since ordered_json()
    # will output a number and the local.json version it is compared against
    # is a quoted string.
    exec { "phab_set_${title}":
        command => "${phab_dir}/bin/config set ${title} '${arg_value}'",
        unless  => "/usr/bin/jq '.[\"${title}\"] == ${json_value}' ${phab_dir}/conf/local/local.json | /bin/grep -q true",
        require => [
            Git::Clone['phabricator'],
            Package['jq'],
        ],
        before  => Service['phd'],
    }
}