Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't seem to get a failed future on delete of non-existent object #117

Closed
eswenson1 opened this issue Jan 13, 2022 · 3 comments
Closed

Comments

@eswenson1
Copy link

If I do effectively this:

val fut = (k8s usingNamespace namespace delete[ConfigMap] name).map { r => Right(r) }.recover {
      case t: Throwable =>
        Left(t)
    }

    println(Await.result(fut, Duration.Inf))

I can repeatedly execute the above, with no Left(...) ever being returned. The first time, of course, it should succeed, but in subsequent invocations, it should raise an exception.

The corresponding code works fine for create (and other CRUD) operations:

//    val fut = (k8s usingNamespace namespace create configMap).map { r => Right(r) }.recover {
//      case t: Throwable =>
//        Left(t)
//    }

Attempting to invoke more than once will return a Left, such as this one:

Left(skuber.api.client.package$K8SException: Status(v1,Status,ListMeta(,,None),Some(Failure),Some(configmaps "foo22" already exists),Some(AlreadyExists),Some({"name":"foo22","kind":"configmaps"}),Some(409)))

In the case of delete, if the object doesn't exist, we see:

[INFO] [01/13/2022 15:30:00.738] [default-akka.actor.default-dispatcher-4] [skuber.api] [Response: non-ok status returned - Status(v1,Status,ListMeta(,,None),Some(Failure),Some(configmaps "foo22" not found),Some(NotFound),Some({"name":"foo22","kind":"configmaps"}),Some(404))
Right(())

Clearly, the non-200 status (404) is returned, but skuber doesn't appear to raise an exception.

I'm using:

"io.github.hagay3" %% "skuber" % "2.7.0",

@hagay3
Copy link
Owner

hagay3 commented Jan 14, 2022

@eswenson1
Thanks for the details and raising this issue
I will take a look and see how to fix the issue

@hagay3
Copy link
Owner

hagay3 commented Jan 14, 2022

@eswenson1
Released new version with a fix, please let me know if it fixed the issue.

"io.github.hagay3" %% "skuber" % "2.7.4"

@eswenson1
Copy link
Author

Thanks much @hagay3. I updated my project with 2.7.4 and am now getting exceptions on non-existent objects upon attempted deletes. I appreciate the fast turnaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants