Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
637 changes: 637 additions & 0 deletions sunbeam-python/sunbeam/commands/backup_restore.py

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions sunbeam-python/sunbeam/core/juju.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,23 @@ def run_action(
raise ActionFailedException(str(task))
return task.results

def get_application_actions(self, application: str, model: str) -> list[str]:
"""Return action names available for an application in a model."""
with self._model(model) as juju:
try:
actions = self.cli(
"actions",
application,
include_controller=False,
juju=juju,
)
except jubilant.CLIError as e:
raise JujuException(str(e)) from e

if not isinstance(actions, dict):
return []
return sorted(actions.keys())

def add_secret(self, model: str, name: str, data: dict, info: str) -> str:
"""Add secret to the model.

Expand Down
2 changes: 2 additions & 0 deletions sunbeam-python/sunbeam/provider/local/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
ClusterServiceUnavailableException,
ConfigItemNotFoundException,
)
from sunbeam.commands import backup_restore as backup_restore_cmds
from sunbeam.commands import refresh as refresh_cmds
from sunbeam.commands import resize as resize_cmds
from sunbeam.commands.configure import (
Expand Down Expand Up @@ -246,6 +247,7 @@ def register_cli(
cluster.add_command(remove)
cluster.add_command(resize_cmds.resize)
cluster.add_command(refresh_cmds.refresh)
cluster.add_command(backup_restore_cmds.backup_group)

def deployment_type(self) -> Tuple[str, Type[Deployment]]:
"""Retrieve the deployment type and class."""
Expand Down
2 changes: 2 additions & 0 deletions sunbeam-python/sunbeam/provider/maas/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from snaphelpers import Snap

from sunbeam.clusterd.service import ConfigItemNotFoundException
from sunbeam.commands import backup_restore as backup_restore_cmds
from sunbeam.commands import refresh as refresh_cmds
from sunbeam.commands import resize as resize_cmds
from sunbeam.commands.configure import (
Expand Down Expand Up @@ -269,6 +270,7 @@ def register_cli(
cluster.add_command(list_nodes)
cluster.add_command(resize_cmds.resize)
cluster.add_command(refresh_cmds.refresh)
cluster.add_command(backup_restore_cmds.backup_group)
cluster.add_command(remove_node)
cluster.add_command(destroy_deployment_cmd)
configure.add_command(configure_cmd)
Expand Down
Loading
Loading