On Mon, Apr 14, 2014 at 7:52 AM, Tim Penhey <tim.pen...@canonical.com>wrote:

> Hi folks,
>
> I noticed this at the end of last week, but shelved the thoughts until
> this weed as other things were taking priority.
>
> $ juju destroy-environment local -y
> [sudo] password for tim:
> ERROR readdirent: no such file or directory
> ERROR failed to destroy environment "local"
>
> If the environment is unusable, then you may run
>
>     juju destroy-environment --force
>
> to forcefully destroy the environment. Upon doing so, review
> your environment provider console for any resources that need
> to be cleaned up.
>
> ERROR exit status 1
>
>
> The first error there had me really confused:
> ERROR readdirent: no such file or directory
>
>
> After hacking the source locally to add a bucket load of debug
> statements, I found that it is actually the last part of the local
> provider Destroy method that is failing:
>
>         logger.Debugf("remove root dir: %v", env.config.rootDir())
>         // Finally, remove the data-dir.
>         if err := os.RemoveAll(env.config.rootDir()); err != nil &&
> !os.IsNotExist(err) {
>                 logger.Debugf("remove root dir failed: %v", err)
>                 return err
>         }
>
> The logging statements there is mine.  Running the command I get:
>
> 2014-04-13 23:45:21 DEBUG juju.provider.local environ.go:461 remove root
> dir: /home/tim/.juju/local
> 2014-04-13 23:45:21 DEBUG juju.provider.local environ.go:469 remove root
> dir failed: readdirent: no such file or directory
>
> but immediately after, I looked in the datadir:
>
> $ find /home/tim/.juju/local/
> find: `/home/tim/.juju/local/': No such file or directory
>
> So it looks like os.RemoveAll returned an error, and for what I'm not
> sure, but it did actually work.
>
> My first thought is to just ignore any error and hope that root is good
> enough to remove it, however that just feels icky.
>
> Suggestions anyone?


Most likely the RemoveAll raced with the kill -SIGABRT. When jujud catches
that signal, it'll remove data-dir.
The final Remove in os.RemoveAll can return IsNotExist if something else
removed the directory after the initial existence check.


>
> Tim
>
> --
> Juju-dev mailing list
> Juju-dev@lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju-dev
>
-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev

Reply via email to