From b099af48b3ae5d576ffb9a36dc791dd33dc9ad20 Mon Sep 17 00:00:00 2001 From: Jacek Bzdak Date: Sat, 28 Dec 2013 10:36:53 +0100 Subject: [PATCH 01/12] moved runner changes to different branch --- provy/core/runner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/provy/core/runner.py b/provy/core/runner.py index 865fa2f..e8671db 100644 --- a/provy/core/runner.py +++ b/provy/core/runner.py @@ -42,7 +42,11 @@ def provision_server(server, provfile_path, password, prov): 'path': dirname(provfile_path), 'owner': server['user'], 'cleanup': [], - 'registered_loaders': [] + 'registered_loaders': [], + '__provy': { + 'current_server': server, + 'host_string': host_string + } } aggregate_node_options(server, context) From b455377b105ddf98dfe05aae31f066585653ed75 Mon Sep 17 00:00:00 2001 From: Jacek Bzdak Date: Sat, 28 Dec 2013 10:55:10 +0100 Subject: [PATCH 02/12] Added server name to server dict. --- provy/core/runner.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/provy/core/runner.py b/provy/core/runner.py index e8671db..8e88628 100644 --- a/provy/core/runner.py +++ b/provy/core/runner.py @@ -6,6 +6,7 @@ It's recommended not to tinker with this module, as it might prevent your provyfile from working. ''' +from copy import copy from os.path import abspath, dirname, join @@ -24,7 +25,7 @@ def run(provfile_path, server_name, password, extra_options): build_prompt_options(servers, extra_options) for server in servers: - provision_server(server, provfile_path, password, prov) + provision_server(server_name, server, provfile_path, password, prov) def print_header(msg): @@ -34,9 +35,10 @@ def print_header(msg): print "*" * len(msg) -def provision_server(server, provfile_path, password, prov): +def provision_server(name, server, provfile_path, password, prov): host_string = "%s@%s" % (server['user'], server['address'].strip()) - + server = copy(server) + server['name'] = name context = { 'abspath': dirname(abspath(provfile_path)), 'path': dirname(provfile_path), From 60e107021678e56b1e4f9c790334566212ab2817 Mon Sep 17 00:00:00 2001 From: Jacek Bzdak Date: Sat, 28 Dec 2013 11:23:24 +0100 Subject: [PATCH 03/12] Moved from server dict to server class. --- provy/core/runner.py | 32 ++++++++++++------------ provy/core/server.py | 58 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 17 deletions(-) create mode 100644 provy/core/server.py diff --git a/provy/core/runner.py b/provy/core/runner.py index 8e88628..dbf639a 100644 --- a/provy/core/runner.py +++ b/provy/core/runner.py @@ -16,6 +16,8 @@ from provy.core.errors import ConfigurationError from jinja2 import FileSystemLoader, ChoiceLoader +from .server import ProvyServer + def run(provfile_path, server_name, password, extra_options): module_name = provyfile_module_from(provfile_path) @@ -25,7 +27,7 @@ def run(provfile_path, server_name, password, extra_options): build_prompt_options(servers, extra_options) for server in servers: - provision_server(server_name, server, provfile_path, password, prov) + provision_server(ProvyServer.from_dict(server_name, server), provfile_path, prov) def print_header(msg): @@ -35,19 +37,15 @@ def print_header(msg): print "*" * len(msg) -def provision_server(name, server, provfile_path, password, prov): - host_string = "%s@%s" % (server['user'], server['address'].strip()) - server = copy(server) - server['name'] = name +def provision_server(server, provfile_path, prov): context = { 'abspath': dirname(abspath(provfile_path)), 'path': dirname(provfile_path), - 'owner': server['user'], + 'owner': server.username, 'cleanup': [], 'registered_loaders': [], '__provy': { - 'current_server': server, - 'host_string': host_string + 'current_server': server } } @@ -58,19 +56,19 @@ def provision_server(name, server, provfile_path, password, prov): ]) context['loader'] = loader - print_header("Provisioning %s..." % host_string) + print_header("Provisioning %s..." % server.host_string) - settings_dict = dict(host_string=host_string, password=password) - if 'ssh_key' in server and server['ssh_key']: - settings_dict['key_filename'] = server['ssh_key'] + settings_dict = dict(host_string=server.host_string, password=server.password) + if server.ssh_key is not None: + settings_dict['key_filename'] = server.ssh_key with _settings(**settings_dict): - context['host'] = server['address'] - context['user'] = server['user'] + context['host'] = server.address + context['user'] = server.username role_instances = [] try: - for role in server['roles']: + for role in server.roles: context['role'] = role instance = role(prov, context) role_instances.append(instance) @@ -82,11 +80,11 @@ def provision_server(name, server, provfile_path, password, prov): for role in context['cleanup']: role.cleanup() - print_header("%s provisioned!" % host_string) + print_header("%s provisioned!" % server.host_string) def aggregate_node_options(server, context): - for key, value in server.get('options', {}).iteritems(): + for key, value in server.options.iteritems(): context[key] = value diff --git a/provy/core/server.py b/provy/core/server.py new file mode 100644 index 0000000..e897df8 --- /dev/null +++ b/provy/core/server.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +from copy import copy + + +class ProvyServer(object): + + def __init__(self, name, address, username, roles= tuple(), password=None): + """ + :param name: Logical name of the server + :param address: Address of the server + :param username: Username you log into + :param roles: List of roles for the server + :param password: Login password + """ + super(ProvyServer, self).__init__() + self.name = name + + self.address = address + self.roles = list(roles) + self.username = username + self.password = password + self.options = {} + self.ssh_key = None + + @staticmethod + def from_dict(name, server_dict): + d = copy(server_dict) + d['name'] = name + s = ProvyServer.__new__(ProvyServer) + s.__setstate__(d) + return s + + @property + def host_string(self): + return "{}@{}".format(self.username, self.address) + + def __getstate__(self): + dict = { + "name": self.name, + "address": self.address, + "roles": self.roles, + "username": self.username, + "options": self.options, + "ssh_key": self.ssh_key + } + if self.password is not None: + dict['password'] = self.password + return dict + + def __setstate__(self, state): + self.name = state['name'].strip() + self.address = state['address'].strip() + self.roles = state.get("roles", []) + self.username = state['user'].strip() + self.password = state.get('password', None) + self.options = state.get('options', {}) + self.ssh_key = state.get('ssh_key', []) + From b6bdf7897c5e95143a2caa7eed139c362e585bed Mon Sep 17 00:00:00 2001 From: Jacek Bzdak Date: Sat, 28 Dec 2013 11:53:17 +0100 Subject: [PATCH 04/12] Added xml coverage output. --- coverage.xml | 2855 +++++++++++++++++++++++++++++++++++++ local/__init__.py | 11 + local/test_synchronize.py | 25 + 3 files changed, 2891 insertions(+) create mode 100644 coverage.xml create mode 100644 local/__init__.py create mode 100644 local/test_synchronize.py diff --git a/coverage.xml b/coverage.xml new file mode 100644 index 0000000..7aba176 --- /dev/null +++ b/coverage.xml @@ -0,0 +1,2855 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/local/__init__.py b/local/__init__.py new file mode 100644 index 0000000..77efec4 --- /dev/null +++ b/local/__init__.py @@ -0,0 +1,11 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# flake8: noqa + +''' +provy's core classes. The modules in this namespace are the ones that run provy. +''' + +from provy.core.roles import Role +from provy.core.runner import run +from provy.core.utils import AskFor diff --git a/local/test_synchronize.py b/local/test_synchronize.py new file mode 100644 index 0000000..52db11e --- /dev/null +++ b/local/test_synchronize.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +from provy.more.debian.files.synchronize import RsyncSynchronize, VersionSynchronizeRole + +class SyncFile(RsyncSynchronize): + def provision(self): + super(SyncFile, self).provision() + self.synchronize_path('local', "/tmp/test-rsync", debug=True) + +class VersionSync(VersionSynchronizeRole): + + def provision(self): + super(VersionSync, self).provision() + self.synchronize_path(1, 'local', "/tmp/test-version", debug=True) + + +servers = { + 'test': { + 'jb': { + 'address': '192.168.56.90', + 'user': 'jb', + 'roles': [SyncFile, VersionSync] + } + }, + "prod": {} +} \ No newline at end of file From 47b002c54dadf1999aeed277ab30bb447c8396e6 Mon Sep 17 00:00:00 2001 From: Jacek Bzdak Date: Sat, 28 Dec 2013 13:09:20 +0100 Subject: [PATCH 05/12] Server is a class, nanget item access --- provy/core/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provy/core/utils.py b/provy/core/utils.py index 820d4a8..b2ac2c8 100644 --- a/provy/core/utils.py +++ b/provy/core/utils.py @@ -50,5 +50,5 @@ def __init__(self, key, question): self.question = question def get_value(self, server): - value = getpass("[Server at %s] - %s: " % (server['address'], self.question)) + value = getpass("[Server at %s] - %s: " % (server.address, self.question)) return value From 24da63a5fff30ee41b67cd2fbc660cc46a8453e6 Mon Sep 17 00:00:00 2001 From: Jacek Bzdak Date: Sat, 28 Dec 2013 13:10:02 +0100 Subject: [PATCH 06/12] server --- provy/core/server.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/provy/core/server.py b/provy/core/server.py index e897df8..b404810 100644 --- a/provy/core/server.py +++ b/provy/core/server.py @@ -6,18 +6,18 @@ class ProvyServer(object): def __init__(self, name, address, username, roles= tuple(), password=None): """ - :param name: Logical name of the server + :param name: Logical name of the server (key under which it resides + in the provy file) :param address: Address of the server :param username: Username you log into :param roles: List of roles for the server :param password: Login password """ super(ProvyServer, self).__init__() - self.name = name - - self.address = address + self.name = name.strip() + self.address = address.strip() self.roles = list(roles) - self.username = username + self.username = username.strip() self.password = password self.options = {} self.ssh_key = None From 8e4dcfd0a753cd1f9b63ddae2490d0fcffbee917 Mon Sep 17 00:00:00 2001 From: Jacek Bzdak Date: Sat, 28 Dec 2013 13:21:09 +0100 Subject: [PATCH 07/12] Finnal runner changes (tests passing) --- provy/core/runner.py | 31 +++++++++++--------- provy/core/server.py | 4 +-- tests/unit/core/test_runner.py | 12 ++++---- tests/unit/core/test_server.py | 52 ++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 21 deletions(-) create mode 100644 tests/unit/core/test_server.py diff --git a/provy/core/runner.py b/provy/core/runner.py index dbf639a..4972961 100644 --- a/provy/core/runner.py +++ b/provy/core/runner.py @@ -27,14 +27,14 @@ def run(provfile_path, server_name, password, extra_options): build_prompt_options(servers, extra_options) for server in servers: - provision_server(ProvyServer.from_dict(server_name, server), provfile_path, prov) + provision_server(server, provfile_path, prov) def print_header(msg): - print - print "*" * len(msg) - print msg - print "*" * len(msg) + print() + print("*" * len(msg)) + print(msg) + print("*" * len(msg)) def provision_server(server, provfile_path, prov): @@ -90,18 +90,20 @@ def aggregate_node_options(server, context): def build_prompt_options(servers, extra_options): for server in servers: - for option_name, option in server.get('options', {}).iteritems(): + for option_name, option in server.options.iteritems(): if isinstance(option, AskFor): if option.key in extra_options: value = extra_options[option.key] else: value = option.get_value(server) - server['options'][option_name] = value + server.options[option_name] = value def get_servers_for(prov, server_name): - return get_items(prov, server_name, 'servers', lambda item: isinstance(item, dict) and 'address' in item) - + result = [] + for name, server in get_items(prov, server_name, 'servers', lambda item: isinstance(item, dict) and 'address' in item): + result.append(ProvyServer.from_dict(name, server)) + return result def get_items(prov, item_name, item_key, test_func): if not hasattr(prov, item_key): @@ -109,23 +111,26 @@ def get_items(prov, item_name, item_key, test_func): items = getattr(prov, item_key) + key = None + for item_part in item_name.split('.'): + key = item_part items = items[item_part] found_items = [] - recurse_items(items, test_func, found_items) + recurse_items(items, test_func, found_items, key) return found_items -def recurse_items(col, test_func, found_items): +def recurse_items(col, test_func, found_items, key=None): if not isinstance(col, dict): return if test_func(col): - found_items.append(col) + found_items.append([key, col]) else: for key, val in col.iteritems(): if test_func(val): - found_items.append(val) + found_items.append([key, val]) else: recurse_items(val, test_func, found_items) diff --git a/provy/core/server.py b/provy/core/server.py index b404810..68e6472 100644 --- a/provy/core/server.py +++ b/provy/core/server.py @@ -39,7 +39,7 @@ def __getstate__(self): "name": self.name, "address": self.address, "roles": self.roles, - "username": self.username, + "user": self.username, "options": self.options, "ssh_key": self.ssh_key } @@ -54,5 +54,5 @@ def __setstate__(self, state): self.username = state['user'].strip() self.password = state.get('password', None) self.options = state.get('options', {}) - self.ssh_key = state.get('ssh_key', []) + self.ssh_key = state.get('ssh_key', None) diff --git a/tests/unit/core/test_runner.py b/tests/unit/core/test_runner.py index 9e0d5f6..63afb6f 100644 --- a/tests/unit/core/test_runner.py +++ b/tests/unit/core/test_runner.py @@ -33,11 +33,11 @@ def foo_macher(item): recurse_items(collection, foo_macher, found_items) expected_items = [ - 'foo name', - 'some foo truck', - ['foo', 'bar'], - { - 'foo': 'something undescribable', - }, + ['my name', 'foo name'], + ['car', 'some foo truck'], + ['books', + ['foo', 'bar']], + ['others', + {'foo': 'something undescribable'}] ] self.assertListEqual(sorted(found_items), sorted(expected_items), found_items) diff --git a/tests/unit/core/test_server.py b/tests/unit/core/test_server.py new file mode 100644 index 0000000..b34fa0d --- /dev/null +++ b/tests/unit/core/test_server.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- + +import unittest +from provy.core.server import ProvyServer + + +class TestServer(unittest.TestCase): + + def test_init(self): + roles = (object, object) + server = ProvyServer("foo", "testserver", "user", roles) + self.assertIsNone(server.password) + self.assertIsInstance(server.roles, list) + + def test_getstste(self): + roles = (object, object) + server = ProvyServer("foo", "testserver", "user", roles) + self.assertEqual( + server.__getstate__(), + {'address': 'testserver', + 'name': 'foo', + 'options': {}, + 'roles': list(roles), + 'ssh_key': None, + 'user': 'user'}) + + def test_getstste_with_password(self): + roles = (object, object) + server = ProvyServer("foo", "testserver", "user", roles, password="pass") + self.assertEqual( + server.__getstate__(), + {'address': 'testserver', + 'name': 'foo', + 'options': {}, + 'roles': list(roles), + 'ssh_key': None, + 'user': 'user', + 'password': 'pass'}) + + def test_setstate(self): + roles = (object, object) + server = ProvyServer("foo", "testserver", "user", roles) + server.__setstate__({ + 'name': " bar ", + "address" : ' foo ', + 'user': ' user ', + }) + self.assertEqual(server.name, 'bar') + self.assertEqual(server.address, 'foo') + self.assertEqual(server.username, 'user') + + From 00947554cb585d5600916f8bc9acfc8837cec184 Mon Sep 17 00:00:00 2001 From: Jacek Bzdak Date: Sat, 28 Dec 2013 13:23:06 +0100 Subject: [PATCH 08/12] Slight compatibility change --- provy/core/runner.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/provy/core/runner.py b/provy/core/runner.py index 4972961..16c312d 100644 --- a/provy/core/runner.py +++ b/provy/core/runner.py @@ -20,6 +20,7 @@ def run(provfile_path, server_name, password, extra_options): + module_name = provyfile_module_from(provfile_path) prov = import_module(module_name) servers = get_servers_for(prov, server_name) @@ -27,7 +28,7 @@ def run(provfile_path, server_name, password, extra_options): build_prompt_options(servers, extra_options) for server in servers: - provision_server(server, provfile_path, prov) + provision_server(server, provfile_path, prov, password) def print_header(msg): @@ -37,7 +38,7 @@ def print_header(msg): print("*" * len(msg)) -def provision_server(server, provfile_path, prov): +def provision_server(server, provfile_path, prov, password): context = { 'abspath': dirname(abspath(provfile_path)), 'path': dirname(provfile_path), @@ -58,7 +59,7 @@ def provision_server(server, provfile_path, prov): print_header("Provisioning %s..." % server.host_string) - settings_dict = dict(host_string=server.host_string, password=server.password) + settings_dict = dict(host_string=server.host_string, password=password) if server.ssh_key is not None: settings_dict['key_filename'] = server.ssh_key From 2b48ac0238775130a2071e804122d041886e59f5 Mon Sep 17 00:00:00 2001 From: Jacek Bzdak Date: Sat, 28 Dec 2013 13:43:39 +0100 Subject: [PATCH 09/12] Removed stale file --- coverage.xml | 2855 -------------------------------------------------- 1 file changed, 2855 deletions(-) delete mode 100644 coverage.xml diff --git a/coverage.xml b/coverage.xml deleted file mode 100644 index 7aba176..0000000 --- a/coverage.xml +++ /dev/null @@ -1,2855 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 2debd47cf5d9beacc481cd96d3e12a370e465986 Mon Sep 17 00:00:00 2001 From: Jacek Bzdak Date: Sat, 28 Dec 2013 13:45:36 +0100 Subject: [PATCH 10/12] Removed unnecessary files --- local/__init__.py | 11 ----------- local/test_synchronize.py | 25 ------------------------- 2 files changed, 36 deletions(-) delete mode 100644 local/__init__.py delete mode 100644 local/test_synchronize.py diff --git a/local/__init__.py b/local/__init__.py deleted file mode 100644 index 77efec4..0000000 --- a/local/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# flake8: noqa - -''' -provy's core classes. The modules in this namespace are the ones that run provy. -''' - -from provy.core.roles import Role -from provy.core.runner import run -from provy.core.utils import AskFor diff --git a/local/test_synchronize.py b/local/test_synchronize.py deleted file mode 100644 index 52db11e..0000000 --- a/local/test_synchronize.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -from provy.more.debian.files.synchronize import RsyncSynchronize, VersionSynchronizeRole - -class SyncFile(RsyncSynchronize): - def provision(self): - super(SyncFile, self).provision() - self.synchronize_path('local', "/tmp/test-rsync", debug=True) - -class VersionSync(VersionSynchronizeRole): - - def provision(self): - super(VersionSync, self).provision() - self.synchronize_path(1, 'local', "/tmp/test-version", debug=True) - - -servers = { - 'test': { - 'jb': { - 'address': '192.168.56.90', - 'user': 'jb', - 'roles': [SyncFile, VersionSync] - } - }, - "prod": {} -} \ No newline at end of file From 121be003460b3a2d9eb9be8824628cd5e24cdd64 Mon Sep 17 00:00:00 2001 From: Jacek Bzdak Date: Sat, 28 Dec 2013 13:47:06 +0100 Subject: [PATCH 11/12] ... --- provy/core/runner.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/provy/core/runner.py b/provy/core/runner.py index 16c312d..a55e8a2 100644 --- a/provy/core/runner.py +++ b/provy/core/runner.py @@ -6,7 +6,7 @@ It's recommended not to tinker with this module, as it might prevent your provyfile from working. ''' -from copy import copy + from os.path import abspath, dirname, join @@ -32,10 +32,10 @@ def run(provfile_path, server_name, password, extra_options): def print_header(msg): - print() - print("*" * len(msg)) - print(msg) - print("*" * len(msg)) + print + print "*" * len(msg) + print msg + print "*" * len(msg) def provision_server(server, provfile_path, prov, password): From c80157342628a1f2303458224e23b411eaca70e4 Mon Sep 17 00:00:00 2001 From: Jacek Bzdak Date: Sat, 28 Dec 2013 13:48:32 +0100 Subject: [PATCH 12/12] Another small fix --- provy/core/runner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/provy/core/runner.py b/provy/core/runner.py index a55e8a2..d060031 100644 --- a/provy/core/runner.py +++ b/provy/core/runner.py @@ -28,7 +28,7 @@ def run(provfile_path, server_name, password, extra_options): build_prompt_options(servers, extra_options) for server in servers: - provision_server(server, provfile_path, prov, password) + provision_server(server, provfile_path, password, prov) def print_header(msg): @@ -38,7 +38,7 @@ def print_header(msg): print "*" * len(msg) -def provision_server(server, provfile_path, prov, password): +def provision_server(server, provfile_path, password, prov): context = { 'abspath': dirname(abspath(provfile_path)), 'path': dirname(provfile_path),