def test_create_and_delete(self): """test creation and deletion of 1 site""" sites.create_site(self.ldb, self.ldb.get_config_basedn(), "testsamba") self.assertRaises(sites.SiteAlreadyExistsException, sites.create_site, self.ldb, self.ldb.get_config_basedn(), "testsamba") sites.delete_site(self.ldb, self.ldb.get_config_basedn(), "testsamba") self.assertRaises(sites.SiteNotFoundException, sites.delete_site, self.ldb, self.ldb.get_config_basedn(), "testsamba")
def run(self, sitename, H=None, sambaopts=None, credopts=None, versionopts=None): lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp, fallback_machine=True) samdb = SamDB(url=H, session_info=system_session(), credentials=creds, lp=lp) samdb.transaction_start() try: sites.delete_site(samdb, samdb.get_config_basedn(), sitename) samdb.transaction_commit() except sites.SiteException, e: samdb.transaction_cancel() raise CommandError("Error while removing site %s, error: %s" % (sitename, str(e)))
def run(self, sitename, H=None, sambaopts=None, credopts=None, versionopts=None): lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp, fallback_machine=True) samdb = SamDB(url=H, session_info=system_session(), credentials=creds, lp=lp) samdb.transaction_start() try: sites.delete_site(samdb, samdb.get_config_basedn(), sitename) samdb.transaction_commit() except sites.SiteException as e: samdb.transaction_cancel() raise CommandError( "Error while removing site %s, error: %s" % (sitename, str(e))) self.outf.write("Site %s removed!\n" % sitename)
def test_delete(self): """test removal of 1 site""" self.ldb_admin.transaction_start() ok = sites.delete_site(self.ldb_admin, self.ldb_admin.get_config_basedn(), "testsamba") self.ldb_admin.transaction_commit() self.assertRaises(sites.SiteNotFoundException, sites.delete_site, self.ldb_admin, self.ldb_admin.get_config_basedn(), "testsamba")
def run(self, sitename, sambaopts=None, credopts=None, versionopts=None): lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp, fallback_machine=True) url = lp.private_path("sam.ldb") if not os.path.exists(url): raise CommandError("secret database not found at %s " % url) samdb = SamDB(url=url, session_info=system_session(), credentials=creds, lp=lp) samdb.transaction_start() try: ok = sites.delete_site(samdb, samdb.get_config_basedn(), sitename) samdb.transaction_commit() except sites.SiteException, e: samdb.transaction_cancel() raise CommandError("Error while removing site %s, error: %s" % (sitename, str(e)))
def tearDown(self): self.samdb.transaction_start() sites.delete_site(self.samdb, self.config_dn, self.sitename) sites.delete_site(self.samdb, self.config_dn, self.sitename2) self.samdb.transaction_commit() super(SitesSubnetCmdTestCase, self).tearDown()
def tearDown(self): self.ldb.transaction_start() sites.delete_site(self.ldb, self.basedn, self.sitename) sites.delete_site(self.ldb, self.basedn, self.sitename2) self.ldb.transaction_commit() super(SimpleSubnetTests, self).tearDown()