Exemplo n.º 1
0
    def test_set(self):

        engine = PlumberyEngine()
        DimensionDataNodeDriver.connectionCls.conn_classes = (
            None, DimensionDataMockHttp)
        DimensionDataMockHttp.type = None
        self.region = DimensionDataNodeDriver(*DIMENSIONDATA_PARAMS)

        file = os.path.abspath(
            os.path.dirname(__file__))+'/fixtures/dummy_rsa.pub'

        settings = {
            'keys': [ "*hello-there*" ],
            }

        with self.assertRaises(ValueError):
            engine.set_settings(settings)

        settings = {
            'keys': [ file ],
            }

        engine.set_settings(settings)
        self.assertTrue(isinstance(engine.get_shared_key_files(), list))
        self.assertTrue(file in engine.get_shared_key_files())

        settings = {
            'safeMode': False,
            'polishers': [
                {'ansible': {}},
                {'configure': {}},
                ],
            'keys': [ file, file ],
            }

        engine.set_settings(settings)
        self.assertEqual(engine.safeMode, False)
        self.assertTrue(isinstance(engine.get_shared_key_files(), list))
        self.assertTrue(file in engine.get_shared_key_files())

        engine.add_facility(myFacility)
        self.assertEqual(len(engine.facilities), 1)

        self.assertEqual(engine.get_shared_user(), 'root')
        engine.set_shared_user('ubuntu')
        self.assertEqual(engine.get_shared_user(), 'ubuntu')

        engine.set_shared_secret('fake_secret')
        self.assertEqual(engine.get_shared_secret(), 'fake_secret')

        random = engine.get_secret('random')
        self.assertEqual(len(random), 9)
        self.assertEqual(engine.get_secret('random'), random)

        engine.set_user_name('fake_name')
        self.assertEqual(engine.get_user_name(), 'fake_name')

        engine.set_user_password('fake_password')
        self.assertEqual(engine.get_user_password(), 'fake_password')
Exemplo n.º 2
0
    def test_set(self):

        engine = PlumberyEngine()
        DimensionDataNodeDriver.connectionCls.conn_classes = (
            None, DimensionDataMockHttp)
        DimensionDataMockHttp.type = None
        self.region = DimensionDataNodeDriver(*DIMENSIONDATA_PARAMS)

        settings = {
            'safeMode': False,
            'polishers': [
                {
                    'ansible': {}
                },
                {
                    'configure': {}
                },
            ]
        }

        engine.set_settings(settings)
        self.assertEqual(engine.safeMode, False)

        engine.add_facility(myFacility)
        self.assertEqual(len(engine.facilities), 1)

        self.assertEqual(engine.get_shared_user(), 'root')
        engine.set_shared_user('ubuntu')
        self.assertEqual(engine.get_shared_user(), 'ubuntu')

        engine.set_shared_secret('fake_secret')
        self.assertEqual(engine.get_shared_secret(), 'fake_secret')

        random = engine.get_secret('random')
        self.assertEqual(len(random), 9)
        self.assertEqual(engine.get_secret('random'), random)

        engine.set_user_name('fake_name')
        self.assertEqual(engine.get_user_name(), 'fake_name')

        engine.set_user_password('fake_password')
        self.assertEqual(engine.get_user_password(), 'fake_password')
    def test_set(self):

        engine = PlumberyEngine()
        DimensionDataNodeDriver.connectionCls.conn_classes = (
            None, DimensionDataMockHttp)
        DimensionDataMockHttp.type = None
        self.region = DimensionDataNodeDriver(*DIMENSIONDATA_PARAMS)

        settings = {
            'safeMode': False,
            'polishers': [
                {'ansible': {}},
                {'configure': {}},
                ]
            }

        engine.set_settings(settings)
        self.assertEqual(engine.safeMode, False)

        engine.add_facility(myFacility)
        self.assertEqual(len(engine.facilities), 1)

        self.assertEqual(engine.get_shared_user(), 'root')
        engine.set_shared_user('ubuntu')
        self.assertEqual(engine.get_shared_user(), 'ubuntu')

        engine.set_shared_secret('fake_secret')
        self.assertEqual(engine.get_shared_secret(), 'fake_secret')

        random = engine.get_secret('random')
        self.assertEqual(len(random), 9)
        self.assertEqual(engine.get_secret('random'), random)

        engine.set_user_name('fake_name')
        self.assertEqual(engine.get_user_name(), 'fake_name')

        engine.set_user_password('fake_password')
        self.assertEqual(engine.get_user_password(), 'fake_password')
Exemplo n.º 4
0
    def test_set(self):

        engine = PlumberyEngine()
        DimensionDataNodeDriver.connectionCls.conn_classes = (
            None, DimensionDataMockHttp)
        DimensionDataMockHttp.type = None
        self.region = DimensionDataNodeDriver(*DIMENSIONDATA_PARAMS)

        file = os.path.abspath(
            os.path.dirname(__file__)) + '/fixtures/dummy_rsa.pub'

        settings = {
            'keys': ["*hello-there*"],
        }

        with self.assertRaises(ValueError):
            engine.set_settings(settings)

        settings = {
            'keys': [file],
        }

        engine.set_settings(settings)
        self.assertTrue(isinstance(engine.get_shared_key_files(), list))
        self.assertTrue(file in engine.get_shared_key_files())

        settings = {
            'safeMode': False,
            'polishers': [
                {
                    'ansible': {}
                },
                {
                    'configure': {}
                },
            ],
            'keys': [file, file],
        }

        engine.set_settings(settings)
        self.assertEqual(engine.safeMode, False)
        self.assertTrue(isinstance(engine.get_shared_key_files(), list))
        self.assertTrue(file in engine.get_shared_key_files())

        engine.add_facility(myFacility)
        self.assertEqual(len(engine.facilities), 1)

        self.assertEqual(engine.get_shared_user(), 'root')
        engine.set_shared_user('ubuntu')
        self.assertEqual(engine.get_shared_user(), 'ubuntu')

        engine.set_shared_secret('fake_secret')
        self.assertEqual(engine.get_shared_secret(), 'fake_secret')

        random = engine.get_secret('random')
        self.assertEqual(len(random), 9)
        self.assertEqual(engine.get_secret('random'), random)

        engine.set_user_name('fake_name')
        self.assertEqual(engine.get_user_name(), 'fake_name')

        engine.set_user_password('fake_password')
        self.assertEqual(engine.get_user_password(), 'fake_password')