Пример #1
0
 def _use(self, name, withstatus):
     # Choose a shadow cib for further changes. If the name
     # provided is empty, then choose the live (cluster) cib.
     # Don't allow ' in shadow names
     if not name or name == "live":
         if withstatus:
             cib_status.load("live")
         if constants.tmp_cib:
             utils.ext_cmd("%s -D '%s' --force" % (self.extcmd, utils.get_cib_in_use()))
             constants.tmp_cib = False
         utils.clear_cib_in_use()
     else:
         utils.set_cib_in_use(name)
         if withstatus:
             cib_status.load("shadow:%s" % name)
     return True
Пример #2
0
 def _use(self, name, withstatus):
     # Choose a shadow cib for further changes. If the name
     # provided is empty, then choose the live (cluster) cib.
     # Don't allow ' in shadow names
     if not name or name == "live":
         if withstatus:
             cib_status.load("live")
         if constants.tmp_cib:
             utils.ext_cmd("%s -D '%s' --force" % (self.extcmd, utils.get_cib_in_use()))
             constants.tmp_cib = False
         utils.clear_cib_in_use()
     else:
         utils.set_cib_in_use(name)
         if withstatus:
             cib_status.load("shadow:%s" % name)
     return True
Пример #3
0
def test_shadowcib():
    assert utils.get_cib_in_use() == ""
    utils.set_cib_in_use("foo")
    assert utils.get_cib_in_use() == "foo"
    utils.clear_cib_in_use()
    assert utils.get_cib_in_use() == ""