def runTest(self):
        dao = GecosAccessDataDAO()

        print "Try to load original data..."
        originalData = dao.load()

        print "Set test data..."
        newData = GecosAccessData()
        newData.set_url('test_url')
        newData.set_login('test_login')
        dao.save(newData)

        print "Load and check test data..."
        newData = dao.load()

        self.assertEqual(newData.get_url(), 'test_url')
        self.assertEqual(newData.get_login(), 'test_login')

        wddao = WorkstationDataDAO()
        wd = wddao.load()

        dao.delete(newData)
        self.assertFalse(os.path.isfile('/etc/gcc.control'))

        if originalData is not None:
            print "Restore original data..."
            dao.save(originalData)
            wddao.save(wd)
Esempio n. 2
0
    def runTest(self):
        obj = GecosAccessData()
        
        obj.set_url('test_url')
        self.assertEqual(obj.get_url(), 'test_url')
        self.assertEqual(obj.url, 'test_url')

        obj.set_login('test_login')
        self.assertEqual(obj.get_login(), 'test_login')
        self.assertEqual(obj.login, 'test_login')

        obj.set_password('test_password')
        self.assertEqual(obj.get_password(), 'test_password')
        self.assertEqual(obj.password, 'test_password')
Esempio n. 3
0
                                         workstationData.get_node_name())
        clean_connection_files_on_error()
        sys.exit()

    # Save Chef client certificate in a PEM file
    if not save_file('c:\\chef\\client.pem', client_pem):
        logging.error("There was an error while saving the client certificate")
        if not debug_mode:
            gecosCC.unregister_chef_node(gecosAccessData,
                                         workstationData.get_node_name())
        clean_connection_files_on_error()
        sys.exit()

    logging.info("- Create c:\\chef/client.rb")

    chef_admin_name = gecosAccessData.get_login()

    chef_url = gecosAccessData.get_url()
    chef_url = chef_url.split('//')[1].split(':')[0]
    chef_url = "https://" + chef_url + '/'

    if (conf is not None and conf.has_key("chef")
            and conf["chef"].has_key("chef_server_uri")
            and not 'localhost' in conf["chef"]["chef_server_uri"]):
        chef_url = conf["chef"]["chef_server_uri"]
        logging.debug("chef_url retrieved from GECOS auto conf")

    if (conf is not None and conf.has_key("chef")
            and conf["chef"].has_key("chef_admin_name")):
        chef_admin_name = conf["chef"]["chef_admin_name"]
        logging.debug("chef_admin_name retrieved from GECOS auto conf")