Closed beliaev-maksim closed 1 year ago
Hi Maksim, this is not expected. jhack nuke
without further arguments will attempt to nuke the current model. However it seems that jhack can't determine which model is current, because of the output of juju status
, no model has a trailing "*"
.
Can you confirm that you are running that from a controller that HAS a current model?
If so, and you are running it from a snap and a VM, this is probably a duplicate of #30
Yes, it had a model
If I remember it right, once I put a model name it worked fine. However, I don't think we need to print the entire traceback when no model is provided
That's not the issue. The issue is that juju status
SHOULD show the current model. The fact that it doesn't, suggests that the process doesn't have access to local/share/juju
as it should
I cannot reproduce it any more on my environment
ok, let me know if it comes up again
@PietroPasotti I was able to reproduce it.
First, I had 5 models, then I nuked my current model, all is good. However, you see, there is no active model now
ubuntu@charm-dev:~$ juju models
Controller: tutorial-controller
Model Cloud/Region Type Status Units Access Last connection
charm-model microk8s/localhost kubernetes available 2 admin 3 minutes ago
controller microk8s/localhost kubernetes available 1 admin just now
test microk8s/localhost kubernetes available - admin 2023-01-17
then I try to nuke test
model, it fails.
ubuntu@charm-dev:~$ jhack nuke test
Traceback (most recent call last):
File "/snap/jhack/166/bin/jhack", line 8, in <module>
sys.exit(main())
File "/snap/jhack/166/lib/python3.8/site-packages/jhack/main.py", line 152, in main
app()
File "/snap/jhack/166/lib/python3.8/site-packages/typer/main.py", line 214, in __call__
return get_command(self)(*args, **kwargs)
File "/snap/jhack/166/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/snap/jhack/166/lib/python3.8/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/snap/jhack/166/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/snap/jhack/166/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/snap/jhack/166/lib/python3.8/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/snap/jhack/166/lib/python3.8/site-packages/typer/main.py", line 500, in wrapper
return callback(**use_params) # type: ignore
File "/snap/jhack/166/lib/python3.8/site-packages/jhack/utils/nuke.py", line 488, in nuke
_nuke(obj, **kwargs)
File "/snap/jhack/166/lib/python3.8/site-packages/jhack/utils/nuke.py", line 263, in _nuke
nukeables = _gather_nukeables(
File "/snap/jhack/166/lib/python3.8/site-packages/jhack/utils/nuke.py", line 209, in _gather_nukeables
model or current_model(),
File "/snap/jhack/166/lib/python3.8/site-packages/jhack/helpers.py", line 187, in current_model
return next(filter(key, all_models)).strip("*")
StopIteration
next, you switch to any model and rerun nuke, it works.
I could recommend either fixing the error message or automatically switch to another model
Yeah, unless you're running nuke
without arguments, it shouldn't bork because it can't find any current model.
That's a bug. Will work on it.
Should be fixed on edge
If you run nuke, you get an exception. However, this is an expected error (OR?)
if yes, then traceback should be truncated and only error message left