How to use bundlewrap - 10 common examples

To help you get started, we’ve selected a few bundlewrap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bundlewrap / bundlewrap / tests / integration / bw_apply_symlinks.py View on Github external
"test": {
                'symlinks': {
                    join(str(tmpdir), "link"): {
                        'target': join(str(tmpdir), "dir2"),
                    },
                },
            },
        },
        nodes={
            "localhost": {
                'bundles': ["test"],
                'os': host_os(),
            },
        },
    )
    stdout, stderr, rcode = run("bw apply localhost", path=str(tmpdir))
    assert rcode == 0
    assert readlink(join(str(tmpdir), "link")) == join(str(tmpdir), "dir2")
github bundlewrap / bundlewrap / tests / integration / bw_apply_autoonly.py View on Github external
},
                    join(str(tmpdir), "baz"): {
                        'content_type': 'any',
                    },
                },
            },
        },
        nodes={
            "localhost": {
                'bundles': ["test", "test2"],
                'os': host_os(),
            },
        },
    )

    run("bw apply -o bundle:test localhost", path=str(tmpdir))
    assert exists(join(str(tmpdir), "foo"))
    assert exists(join(str(tmpdir), "bar"))
    assert not exists(join(str(tmpdir), "baz"))
github bundlewrap / bundlewrap / tests / integration / bw_diff.py View on Github external
"files": {
                    "/tmp/test": {
                        'content': "one",
                    },
                },
            },
            "bundle2": {
                "files": {
                    "/tmp/test": {
                        'content': "two",
                    },
                },
            },
        },
    )
    stdout, stderr, rcode = run("bw diff -i file:/tmp/test -- node1 node2", path=str(tmpdir))
    assert b"one" in stdout
    assert b"two" in stdout
    assert stderr == b""
    assert rcode == 0
github bundlewrap / bundlewrap / tests / integration / bw_metadata.py View on Github external
'bundles': ["test"],
            },
        },
    )
    with open(join(str(tmpdir), "bundles", "test", "metadata.py"), 'w') as f:
        f.write(
"""
@metadata_reactor
def plusone(metadata):
    return {'foo': metadata.get('bar', 0) + 1 }

@metadata_reactor
def plustwo(metadata):
    return {'bar': metadata.get('foo', 0) + 2 }
""")
    stdout, stderr, rcode = run("bw metadata node1", path=str(tmpdir))
    assert rcode == 1
github bundlewrap / bundlewrap / tests / integration / bw_diff.py View on Github external
"files": {
                    "/tmp/foo": {
                        'content': "two",
                    },
                },
            },
            "bundle3": {
                "files": {
                    "/tmp/bar": {
                        'content': "common",
                    },
                },
            },
        },
    )
    stdout, stderr, rcode = run("bw diff node1 node2", path=str(tmpdir))
    assert b"/tmp/foo" in stdout
    assert b"/tmp/bar" not in stdout
    assert stderr == b""
    assert rcode == 0
github bundlewrap / bundlewrap / tests / integration / secrets.py View on Github external
def test_encrypt(tmpdir):
    make_repo(tmpdir)

    stdout, stderr, rcode = run("bw debug -c 'print(repo.vault.encrypt(\"test\"))'", path=str(tmpdir))
    assert stderr == b""
    assert rcode == 0

    stdout, stderr, rcode = run("bw debug -c 'print(repo.vault.decrypt(\"{}\"))'".format(stdout.decode('utf-8').strip()), path=str(tmpdir))
    assert stdout == b"test\n"
    assert stderr == b""
    assert rcode == 0
github bundlewrap / bundlewrap / tests / integration / secrets.py View on Github external
def test_encrypt(tmpdir):
    make_repo(tmpdir)

    stdout, stderr, rcode = run("bw debug -c 'print(repo.vault.encrypt(\"test\"))'", path=str(tmpdir))
    assert stderr == b""
    assert rcode == 0

    stdout, stderr, rcode = run("bw debug -c 'print(repo.vault.decrypt(\"{}\"))'".format(stdout.decode('utf-8').strip()), path=str(tmpdir))
    assert stdout == b"test\n"
    assert stderr == b""
    assert rcode == 0
github bundlewrap / bundlewrap / tests / integration / bw_apply_files.py View on Github external
'files': {
                    join(str(tmpdir), "foo.bin"): {
                        'content_type': 'base64',
                        'content': b64encode("ö".encode('latin-1')),
                    },
                },
            },
        },
        nodes={
            "localhost": {
                'bundles': ["test"],
                'os': host_os(),
            },
        },
    )
    run("bw apply localhost", path=str(tmpdir))
    with open(join(str(tmpdir), "foo.bin"), 'rb') as f:
        content = f.read()
    assert content.decode('latin-1') == "ö"
github bundlewrap / bundlewrap / tests / integration / bw_nodes.py View on Github external
def test_template_node_cascade(tmpdir):
    make_repo(
        tmpdir,
        nodes={
            "node1": {'template_node': "node2"},
            "node2": {'template_node': "node1"},
        },
    )
    stdout, stderr, rcode = run("BW_TABLE_STYLE=grep bw nodes node1 dummy", path=str(tmpdir))
    assert rcode == 1
github bundlewrap / bundlewrap / tests / integration / secrets.py View on Github external
def test_human_password(tmpdir):
    make_repo(tmpdir)

    stdout, stderr, rcode = run("bw debug -c 'print(repo.vault.human_password_for(\"hello world\"))'", path=str(tmpdir))
    assert stdout == b"Xaint-Heep-Pier-Tikl-76\n"
    assert stderr == b""
    assert rcode == 0