コード例 #1
0
def ctrl(ployconf, tempdir):
    from ploy import Controller
    import ploy.tests.dummy_plugin
    ctrl = Controller(tempdir.directory)
    ctrl.plugins = {'dummy': ploy.tests.dummy_plugin.plugin}
    ctrl.configfile = ployconf.path
    return ctrl
コード例 #2
0
ファイル: test_plain.py プロジェクト: Cloudxtreme/ploy-1
def ctrl(ployconf, tempdir, sshconfig):
    import ploy.plain
    ctrl = Controller(tempdir.directory)
    ctrl.plugins = {
        'plain': ploy.plain.plugin}
    ctrl.configfile = ployconf.path
    return ctrl
コード例 #3
0
ファイル: test_ploy.py プロジェクト: Cloudxtreme/ploy-1
 def testInstanceAugmentationProxiedMaster(self):
     import ploy.tests.dummy_proxy_plugin
     import ploy.plain
     self.configfile.fill([
         '[plain-instance:foo]',
         'somevalue = ham',
         '[dummy-master:master]',
         'instance = foo',
         '[dummy-instance:bar]',
         'dummy_value = egg'])
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     ctrl.plugins = {
         'dummy': ploy.tests.dummy_proxy_plugin.plugin,
         'plain': ploy.plain.plugin}
     # trigger augmentation of all instances
     instances = dict(ctrl.instances)
     # check the proxied value, which is only accessible through the instance config
     assert 'somevalue' in instances['master'].config
     assert instances['master'].config['somevalue'] == 'ham'
     # we check that the main config is updated for the remaining values,
     # not only the individual instance configs
     assert 'dummy_value' in ctrl.config['dummy-instance']['bar']
     assert ctrl.config['dummy-instance']['bar']['dummy_value'] == 'egg massaged'
     assert 'dummy_augmented' in ctrl.config['dummy-instance']['bar']
     assert ctrl.config['dummy-instance']['bar']['dummy_augmented'] == 'augmented massaged'
コード例 #4
0
ファイル: test_ploy.py プロジェクト: ployground/ploy
    def testInstanceAugmentationProxiedMaster(self):
        import ploy.tests.dummy_proxy_plugin
        import ploy.plain

        self.configfile.fill(
            [
                "[plain-instance:foo]",
                "somevalue = ham",
                "[dummy-master:master]",
                "instance = foo",
                "[dummy-instance:bar]",
                "dummy_value = egg",
            ]
        )
        ctrl = Controller(configpath=self.directory)
        ctrl.configfile = self.configfile.path
        ctrl.plugins = {"dummy": ploy.tests.dummy_proxy_plugin.plugin, "plain": ploy.plain.plugin}
        # trigger augmentation of all instances
        instances = dict(ctrl.instances)
        # check the proxied value, which is only accessible through the instance config
        assert "somevalue" in instances["master"].config
        assert instances["master"].config["somevalue"] == "ham"
        # we check that the main config is updated for the remaining values,
        # not only the individual instance configs
        assert "dummy_value" in ctrl.config["dummy-instance"]["bar"]
        assert ctrl.config["dummy-instance"]["bar"]["dummy_value"] == "egg massaged"
        assert "dummy_augmented" in ctrl.config["dummy-instance"]["bar"]
        assert ctrl.config["dummy-instance"]["bar"]["dummy_augmented"] == "augmented massaged"
コード例 #5
0
def ctrl(ployconf):
    from ploy import Controller
    import ploy_virtualbox
    ployconf.fill(['[vb-instance:foo]'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {'virtualbox': ploy_virtualbox.plugin}
    yield ctrl
コード例 #6
0
def ctrl(ployconf):
    from ploy import Controller
    import ploy_virtualbox
    ployconf.fill([
        '[vb-instance:foo]'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {'virtualbox': ploy_virtualbox.plugin}
    yield ctrl
コード例 #7
0
ファイル: conftest.py プロジェクト: aaron1801/bsdploy
def ctrl(ployconf, tempdir):
    from ploy import Controller
    import ploy.tests.dummy_plugin
    ctrl = Controller(tempdir.directory)
    ctrl.plugins = {
        'dummy': ploy.tests.dummy_plugin.plugin}
    ctrl.configfile = ployconf.path
    return ctrl
コード例 #8
0
ファイル: test_fabric.py プロジェクト: ployground/ploy_fabric
def ctrl(ployconf):
    import ploy_fabric
    import ploy.tests.dummy_plugin
    ctrl = Controller(ployconf.directory)
    ctrl.plugins = {
        'dummy': ploy.tests.dummy_plugin.plugin,
        'fabric': ploy_fabric.plugin}
    ctrl.configfile = ployconf.path
    return ctrl
コード例 #9
0
ファイル: test_ploy.py プロジェクト: ployground/ploy
    def testInstanceAugmentation(self):
        import ploy.tests.dummy_plugin

        self.configfile.fill(["[dummy-instance:foo]"])
        ctrl = Controller(configpath=self.directory)
        ctrl.configfile = self.configfile.path
        ctrl.plugins = {"dummy": ploy.tests.dummy_plugin.plugin}
        assert "dummy_augmented" in ctrl.instances["foo"].config
        assert ctrl.instances["foo"].config["dummy_augmented"] == "augmented massaged"
コード例 #10
0
ファイル: test_ploy.py プロジェクト: ployground/ploy
 def testConflictingPluginCommandName(self):
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     ctrl.plugins = dict(dummy=dict(get_commands=lambda x: [("ssh", None)]))
     with patch("ploy.log") as LogMock:
         with pytest.raises(SystemExit):
             ctrl([])
     LogMock.error.assert_called_with(
         "Command name '%s' of '%s' conflicts with existing command name.", "ssh", "dummy"
     )
コード例 #11
0
ファイル: test_ploy.py プロジェクト: Cloudxtreme/ploy-1
 def testConflictingPluginCommandName(self):
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     ctrl.plugins = dict(dummy=dict(
         get_commands=lambda x: [
             ('ssh', None)]))
     with patch('ploy.log') as LogMock:
         with pytest.raises(SystemExit):
             ctrl([])
     LogMock.error.assert_called_with("Command name '%s' of '%s' conflicts with existing command name.", 'ssh', 'dummy')
コード例 #12
0
ファイル: test_ploy.py プロジェクト: Cloudxtreme/ploy-1
 def testInstanceAugmentation(self):
     import ploy.tests.dummy_plugin
     self.configfile.fill([
         '[dummy-instance:foo]'])
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     ctrl.plugins = {
         'dummy': ploy.tests.dummy_plugin.plugin}
     assert 'dummy_augmented' in ctrl.instances['foo'].config
     assert ctrl.instances['foo'].config['dummy_augmented'] == 'augmented massaged'
コード例 #13
0
ファイル: test_ezjail.py プロジェクト: fschulze/ploy_ezjail
def ctrl(ployconf):
    from ploy import Controller
    import ploy_ezjail
    ployconf.fill([
        '[ez-master:warden]',
        '[ez-instance:foo]',
        'ip = 10.0.0.1'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {'ezjail': ploy_ezjail.plugin}
    yield ctrl
コード例 #14
0
def ctrl(ployconf, iocage_tag):
    from ploy import Controller
    import ploy_iocage
    lines = ['[ioc-master:warden]', '[ioc-instance:foo]', 'ip = 10.0.0.1']
    if iocage_tag is not 'foo':
        lines.append('iocage-tag = %s' % iocage_tag)
    ployconf.fill(lines)
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {'iocage': ploy_iocage.plugin}
    return ctrl
コード例 #15
0
ファイル: conftest.py プロジェクト: witsch/ploy_ansible
def ctrl(ployconf):
    from ploy import Controller
    import ploy_ansible
    import ploy.tests.dummy_plugin
    ployconf.fill([
        '[dummy-instance:foo]'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {
        'dummy': ploy.tests.dummy_plugin.plugin,
        'ansible': ploy_ansible.plugin}
    return ctrl
コード例 #16
0
ファイル: test_proxy.py プロジェクト: kernt/ploy
def ctrl(ployconf):
    from ploy import Controller
    import ploy.plain
    import ploy.tests.dummy_proxy_plugin
    ployconf.fill([''])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {
        'dummy': ploy.tests.dummy_proxy_plugin.plugin,
        'plain': ploy.plain.plugin}
    ctrl.configfile = ployconf.path
    return ctrl
コード例 #17
0
ファイル: test_ploy.py プロジェクト: Cloudxtreme/ploy-1
 def testInvalidInstanceName(self):
     import ploy.tests.dummy_plugin
     self.configfile.fill([
         '[dummy-instance:fo o]'])
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     ctrl.plugins = {'dummy': ploy.tests.dummy_plugin.plugin}
     with patch('ploy.common.log') as LogMock:
         with pytest.raises(SystemExit):
             ctrl(['./bin/ploy', 'ssh', 'bar'])
     LogMock.error.assert_called_with("Invalid instance name 'fo o'. An instance name may only contain letters, numbers, dashes and underscores.")
コード例 #18
0
def ctrl(ployconf):
    from ploy import Controller
    import ploy.plain
    import ploy.tests.dummy_proxy_plugin
    ployconf.fill([''])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {
        'dummy': ploy.tests.dummy_proxy_plugin.plugin,
        'plain': ploy.plain.plugin
    }
    ctrl.configfile = ployconf.path
    return ctrl
コード例 #19
0
ファイル: test_ploy.py プロジェクト: ployground/ploy
    def testConflictingInstanceShortName(self):
        import ploy.tests.dummy_plugin
        import ploy.plain

        self.configfile.fill(["[dummy-instance:foo]", "[plain-instance:foo]"])
        ctrl = Controller(configpath=self.directory)
        ctrl.configfile = self.configfile.path
        ctrl.plugins = {"dummy": ploy.tests.dummy_plugin.plugin, "plain": ploy.plain.plugin}
        with patch("sys.stderr") as StdErrMock:
            with pytest.raises(SystemExit):
                ctrl(["./bin/ploy", "ssh", "bar"])
        output = "".join(x[0][0] for x in StdErrMock.write.call_args_list)
        assert "(choose from 'default-foo', 'plain-foo')" in output
コード例 #20
0
def ctrl(ployconf, iocage_tag):
    from ploy import Controller
    import ploy_iocage
    lines = [
        '[ioc-master:warden]',
        '[ioc-instance:foo]',
        'ip = 10.0.0.1']
    if iocage_tag is not 'foo':
        lines.append('iocage-tag = %s' % iocage_tag)
    ployconf.fill(lines)
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {'iocage': ploy_iocage.plugin}
    return ctrl
コード例 #21
0
def ctrl(ployconf, ezjail_name):
    from ploy import Controller
    import ploy_ezjail
    lines = [
        '[ez-master:warden]',
        '[ez-instance:foo]',
        'ip = 10.0.0.1']
    if ezjail_name is not 'foo':
        lines.append('ezjail-name = %s' % ezjail_name)
    ployconf.fill(lines)
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {'ezjail': ploy_ezjail.plugin}
    return ctrl
コード例 #22
0
ファイル: test_ploy.py プロジェクト: ployground/ploy
    def testInvalidInstanceName(self):
        import ploy.tests.dummy_plugin

        self.configfile.fill(["[dummy-instance:fo o]"])
        ctrl = Controller(configpath=self.directory)
        ctrl.configfile = self.configfile.path
        ctrl.plugins = {"dummy": ploy.tests.dummy_plugin.plugin}
        with patch("ploy.common.log") as LogMock:
            with pytest.raises(SystemExit):
                ctrl(["./bin/ploy", "ssh", "bar"])
        LogMock.error.assert_called_with(
            "Invalid instance name 'fo o'. An instance name may only contain letters, numbers, dashes and underscores."
        )
コード例 #23
0
ファイル: test_roles.py プロジェクト: aaronky/bsdploy
def ctrl(ployconf, tempdir):
    from ploy import Controller
    import bsdploy
    import ploy_ezjail
    import ploy_ansible
    ployconf.fill([
        '[ez-master:jailhost]'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {
        'bsdploy': bsdploy.plugin,
        'ezjail': ploy_ezjail.plugin,
        'ansible': ploy_ansible.plugin}
    ctrl.configfile = ployconf.path
    return ctrl
コード例 #24
0
def ctrl(ployconf, tempdir):
    from ploy import Controller
    import bsdploy
    import ploy_ezjail
    import ploy_ansible
    ployconf.fill(['[ez-master:jailhost]'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {
        'bsdploy': bsdploy.plugin,
        'ezjail': ploy_ezjail.plugin,
        'ansible': ploy_ansible.plugin
    }
    ctrl.configfile = ployconf.path
    return ctrl
コード例 #25
0
ファイル: test_ploy.py プロジェクト: Cloudxtreme/ploy-1
 def testConflictingInstanceShortName(self):
     import ploy.tests.dummy_plugin
     import ploy.plain
     self.configfile.fill([
         '[dummy-instance:foo]',
         '[plain-instance:foo]'])
     ctrl = Controller(configpath=self.directory)
     ctrl.configfile = self.configfile.path
     ctrl.plugins = {
         'dummy': ploy.tests.dummy_plugin.plugin,
         'plain': ploy.plain.plugin}
     with patch('sys.stderr') as StdErrMock:
         with pytest.raises(SystemExit):
             ctrl(['./bin/ploy', 'ssh', 'bar'])
     output = "".join(x[0][0] for x in StdErrMock.write.call_args_list)
     assert "(choose from 'default-foo', 'plain-foo')" in output
コード例 #26
0
ファイル: conftest.py プロジェクト: ployground/ploy_ansible2
def ctrl(ployconf):
    from ploy import Controller
    import ploy_ansible
    import ploy.tests.dummy_plugin
    ployconf.fill([
        '[dummy-instance:foo]',
        'host = foo'])
    ctrl = Controller(ployconf.directory)
    ctrl.configfile = ployconf.path
    ctrl.plugins = {
        'dummy': ploy.tests.dummy_plugin.plugin,
        'ansible': ploy_ansible.plugin}
    if hasattr(ploy_ansible, 'display'):
        ploy_ansible.display._deprecations.clear()
        ploy_ansible.display._warns.clear()
        ploy_ansible.display._errors.clear()
    return ctrl
コード例 #27
0
ファイル: test_bsdploy.py プロジェクト: saidi6882/bsdploy
def ctrl(ployconf, tempdir):
    from ploy import Controller
    import bsdploy
    import ploy.plain
    import ploy_ezjail
    import ploy_fabric
    ployconf.fill(
        ['[ez-master:jailhost]', '[instance:foo]', 'master = jailhost'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {
        'bsdploy': bsdploy.plugin,
        'ezjail': ploy_ezjail.plugin,
        'fabric': ploy_fabric.plugin,
        'plain': ploy.plain.plugin
    }
    ctrl.configfile = ployconf.path
    return ctrl
コード例 #28
0
ファイル: test_bsdploy.py プロジェクト: fschulze/bsdploy
def ctrl(ployconf, tempdir):
    from ploy import Controller
    import bsdploy
    import ploy.plain
    import ploy_ezjail
    import ploy_fabric
    ployconf.fill([
        '[ez-master:jailhost]',
        '[instance:foo]',
        'master = jailhost'])
    ctrl = Controller(configpath=ployconf.directory)
    ctrl.plugins = {
        'bsdploy': bsdploy.plugin,
        'ezjail': ploy_ezjail.plugin,
        'fabric': ploy_fabric.plugin,
        'plain': ploy.plain.plugin}
    ctrl.configfile = ployconf.path
    return ctrl
コード例 #29
0
 def ctrl(self, ployconf):
     from ploy import Controller
     import ploy.tests.dummy_plugin
     ployconf.fill([
         '[dummy-master:warden]',
         '[dummy-master:master]',
         '[dummy-master:another]',
         '[dummy-instance:foo]',
         'master = warden',
         '[dummy-instance:bar]',
         'master = master',
         '[dummy-instance:ham]',
         'master = warden master',
         '[dummy-instance:egg]'])
     ctrl = Controller(configpath=ployconf.directory)
     ctrl.plugins = {
         'dummy': ploy.tests.dummy_plugin.plugin}
     ctrl.configfile = ployconf.path
     yield ctrl
コード例 #30
0
ファイル: test_common.py プロジェクト: Cloudxtreme/ploy-1
 def ctrl(self, ployconf):
     from ploy import Controller
     import ploy.tests.dummy_plugin
     ployconf.fill([
         '[dummy-master:warden]',
         '[dummy-master:master]',
         '[dummy-master:another]',
         '[dummy-instance:foo]',
         'master = warden',
         '[dummy-instance:bar]',
         'master = master',
         '[dummy-instance:ham]',
         'master = warden master',
         '[dummy-instance:egg]'])
     ctrl = Controller(configpath=ployconf.directory)
     ctrl.plugins = {
         'dummy': ploy.tests.dummy_plugin.plugin}
     ctrl.configfile = ployconf.path
     yield ctrl