示例#1
0
def main():
    io.activate()
    try:
        repo = Repository("")
    except NoSuchRepository:
        io.stderr("{} Not inside a bundlewrap repository".format(red("!")))
        sys.exit(1)
    my_path = pathlib.Path(__file__).parent.absolute()
    relpath = my_path.relative_to(repo.path)
    if not str(relpath).startswith("collections/"):
        io.stderr(
            "{} Collection should be installed to <repo>/collections".format(
                yellow("!")))
        sys.exit(1)
    install_dir(my_path / "hooks", repo.hooks_dir)
    install_dir(my_path / "libs", repo.libs_dir)
    install_dir(my_path / "items", repo.items_dir)
示例#2
0
def test_toml_conversion(tmpdir):
    make_repo(
        tmpdir,
        nodes={
            'node1': {
                'os': 'ubuntu',
                'metadata': {
                    "foo": {
                        "bar": "baz",
                    },
                },
            },
        },
    )
    repo = Repository(tmpdir)
    node = repo.get_node("node1")
    node.toml_save()

    assert get_file_contents(join(tmpdir, "nodes", "node1.toml")) == \
        b"""os = "ubuntu"
示例#3
0
from bundlewrap.repo import Repository
import os

dir_path = os.path.dirname(os.path.realpath(__file__))


repo = Repository(dir_path)


def generate():
    key = input("Enter the desired key: ")
    while True:
        unencrypted = input("Please enter the unencrypted PW: ")
        pw = repo.vault.encrypt(unencrypted, key=key)
        print(pw)
        pass


generate()