summaryrefslogtreecommitdiffstats
path: root/filters/cluster/rm/apache/__init__.py
blob: f90fbf0822509e34357720c143f3f1f7866c9a8b (plain)
1
2
3
4
5
6
7
8
9
10
11
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# -*- coding: UTF-8 -*-
# Copyright 2015 Red Hat, Inc.
# Part of clufter project
# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

from ....utils_cib import ResourceSpec


ccsflat2pcsprelude = '''\
    <!--
        apache ~ apache
     -->
    <xsl:when test="name() = 'apache'">
''' + (
        ResourceSpec('ocf:heartbeat:apache').xsl_attrs
) + '''
        <!-- INSTANCE_ATTRIBUTES -->
        <instance_attributes id="{concat($Prefix, '-ATTRS')}">
            <!-- configfile ~ config_file (if present) -->
            <xsl:if test="@config_file">
                <nvpair id="{concat($Prefix, '-ATTRS-configfile')}"
                        name="configfile"
                        value="{@config_file}"/>
            </xsl:if>
            <!-- options ~ httpd_options (if present; + name, server_root) -->
            <nvpair id="{concat($Prefix, '-ATTRS-options')}"
                    name="options">
                <xsl:attribute name="value">
                    <xsl:value-of select="concat(
                        ' -D', @name
                    )"/>
                    <xsl:if test="@server_root">
                        <xsl:value-of select="concat(
                            ' -d &quot;', @server_root, '&quot;'
                        )"/>
                    </xsl:if>
                    <xsl:if test="@httpd_options">
                        <xsl:value-of select="concat(
                            ' ', @httpd_options
                        )"/>
                    </xsl:if>
                </xsl:attribute>
            </nvpair>
            <!-- httpd ~ httpd (if present, see rhbz#952132) -->
            <xsl:if test="@httpd">
                <nvpair id="{concat($Prefix, '-ATTRS-httpd')}"
                        name="httpd"
                        value="{@httpd}"/>
            </xsl:if>
        </instance_attributes>

        <!-- OPERATIONS -->
        <operations>
            <xsl:if test="@shutdown_wait">
            <op id="{concat($Prefix, '-OPS-stop')}"
                name="stop"
                interval="0"
                timeout="{concat(@shutdown_wait, 's')}"/>
            </xsl:if>
        </operations>
    </xsl:when>
'''

###

from ....filters.ccs_artefacts import artefact_cond_ra

ccs_artefacts = ''.join((
    artefact_cond_ra('@httpd',
                     kind='B', desc='path to httpd binary'),
    artefact_cond_ra('@server_root',
                     kind='D', desc='ServerRoot'),
    artefact_cond_ra('@config_file[../@server_root]',
                     xpath="concat(../@server_root, '/', .)",
                     kind='A', desc='configuration file'),
))