Exemplo n.º 1
0
def test_admin_token_auth(mocker):
    mock_calls = mock.Mock()
    mocker.patch("octane.util.keystone.add_admin_token_auth",
                 new=mock_calls.add)
    mocker.patch("octane.util.keystone.remove_admin_token_auth",
                 new=mock_calls.remove)
    mocker.patch("octane.util.subprocess.call", new=mock_calls.subprocess)
    with keystone.admin_token_auth("fakefilename", "fakepipelines"):
        mock_calls.let()
    expected_calls = [
        mock.call.add("fakefilename", "fakepipelines"),
        mock.call.let(),
        mock.call.remove("fakefilename", "fakepipelines"),
        mock.call.subprocess(["systemctl", "restart", "openstack-keystone"]),
    ]
    assert mock_calls.mock_calls == expected_calls
Exemplo n.º 2
0
 def restore(self):
     subprocess.call(["systemctl", "stop"] + self.services)
     with keystone.admin_token_auth(magic_consts.KEYSTONE_PASTE,
                                    magic_consts.KEYSTONE_PIPELINES):
         puppet.apply_all_tasks()
Exemplo n.º 3
0
 def restore(self):
     keystone.unset_default_domain_id(magic_consts.KEYSTONE_CONF)
     with keystone.admin_token_auth(magic_consts.KEYSTONE_PASTE,
                                    magic_consts.KEYSTONE_PIPELINES):
         super(KeystoneArchivator, self).restore()