Exemple #1
0
    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")
Exemple #2
0
    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)))
Exemple #3
0
    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)
Exemple #4
0
    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")
Exemple #5
0
    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")
Exemple #6
0
    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")
Exemple #7
0
    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)))
Exemple #8
0
    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)))
Exemple #9
0
 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()
Exemple #10
0
 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()
Exemple #11
0
 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()
Exemple #12
0
 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()