Esempio n. 1
0
def test_result():
    t = """{{obj}}
    group g1 {{obj:id}}
"""
    eq_("""primitive d0 Dummy
    group g1 d0
""", handles.parse(t, {'obj': handles.value({'id': 'd0'}, 'primitive d0 Dummy')}))
    eq_("\n    group g1 \n", handles.parse(t, {}))
Esempio n. 2
0
def test_result():
    t = """{{obj}}
    group g1 {{obj:id}}
"""
    assert """primitive d0 Dummy
    group g1 d0
""" == handles.parse(
        t, {'obj': handles.value({'id': 'd0'}, 'primitive d0 Dummy')})
    assert "\n    group g1 \n" == handles.parse(t, {})
Esempio n. 3
0
def test_cib():
    t = """{{filesystem}}
{{exportfs}}
{{rootfs}}
{{virtual-ip}}
clone c-{{rootfs:id}} {{rootfs:id}}
group g-nfs
  {{exportfs:id}}
  {{virtual-ip:id}}
order base-then-nfs inf: {{filesystem:id}} g-nfs
colocation nfs-with-base inf: g-nfs {{filesystem:id}}
order rootfs-before-nfs inf: c-{{rootfs:id}} g-nfs:start
colocation nfs-with-rootfs inf: g-nfs c-{{rootfs:id}}
"""
    r = """primitive fs1 Filesystem
primitive efs exportfs
primitive rfs rootfs
primitive vip IPaddr2
  params ip=192.168.0.2
clone c-rfs rfs
group g-nfs
  efs
  vip
order base-then-nfs inf: fs1 g-nfs
colocation nfs-with-base inf: g-nfs fs1
order rootfs-before-nfs inf: c-rfs g-nfs:start
colocation nfs-with-rootfs inf: g-nfs c-rfs
"""
    v = {
        'filesystem':
        handles.value({'id': 'fs1'}, 'primitive fs1 Filesystem'),
        'exportfs':
        handles.value({'id': 'efs'}, 'primitive efs exportfs'),
        'rootfs':
        handles.value({'id': 'rfs'}, 'primitive rfs rootfs'),
        'virtual-ip':
        handles.value({'id': 'vip'},
                      'primitive vip IPaddr2\n  params ip=192.168.0.2'),
    }
    eq_(r, handles.parse(t, v))
Esempio n. 4
0
def test_cib():
    t = """{{filesystem}}
{{exportfs}}
{{rootfs}}
{{virtual-ip}}
clone c-{{rootfs:id}} {{rootfs:id}}
group g-nfs
  {{exportfs:id}}
  {{virtual-ip:id}}
order base-then-nfs inf: {{filesystem:id}} g-nfs
colocation nfs-with-base inf: g-nfs {{filesystem:id}}
order rootfs-before-nfs inf: c-{{rootfs:id}} g-nfs:start
colocation nfs-with-rootfs inf: g-nfs c-{{rootfs:id}}
"""
    r = """primitive fs1 Filesystem
primitive efs exportfs
primitive rfs rootfs
primitive vip IPaddr2
  params ip=192.168.0.2
clone c-rfs rfs
group g-nfs
  efs
  vip
order base-then-nfs inf: fs1 g-nfs
colocation nfs-with-base inf: g-nfs fs1
order rootfs-before-nfs inf: c-rfs g-nfs:start
colocation nfs-with-rootfs inf: g-nfs c-rfs
"""
    v = {
        'filesystem': handles.value({'id': 'fs1'}, 'primitive fs1 Filesystem'),
        'exportfs': handles.value({'id': 'efs'}, 'primitive efs exportfs'),
        'rootfs': handles.value({'id': 'rfs'}, 'primitive rfs rootfs'),
        'virtual-ip': handles.value({'id': 'vip'},
                                    'primitive vip IPaddr2\n  params ip=192.168.0.2'),
    }
    eq_(r, handles.parse(t, v))
Esempio n. 5
0
def test_result2():
    t = """{{obj}}
    group g1 {{obj:id}}
{{#obj}}
{{obj}}
{{/obj}}
"""
    eq_(
        """primitive d0 Dummy
    group g1 d0
primitive d0 Dummy
""",
        handles.parse(
            t, {'obj': handles.value({'id': 'd0'}, 'primitive d0 Dummy')}))
    eq_("\n    group g1 \n", handles.parse(t, {}))