Why can't I use --force in bundles?

This question recently came up and I wanted to put the logic down in writing to share the thinking on it.

Some commands, including deploy, have a --force flag that will bypass checking things like the series is a valid series for the charm, or that the lxd profile is deemed safe. This is mostly meant a development and testing tool. When a new series comes out one might want to be able to easily check “does this charm pass tests” or the like before going in and modifying the charm stating it supports a series it doesn’t. --force is a bypass of Juju enforcing best practices and as an operations tool it’s built on the idea of shared best practice expertise.

In light of this, a bundle is meant to be a reusable chunk of those best practices. When you install the openstack-base bundle it’s setup to get you a running OpenStack with some best practice config, versions, etc. These bundles aren’t often over analyzed and if a --force is required to make something work we want to make sure that users can’t accidentally do this. I compare this to the old sudo bash ... for scripts you find on the internet.

The standard for what goes into bundles high and so Juju doesn’t allow a --force in bundles so that they’re kept to a standard of best practices and encourages folks to engage upstream, update the charms for new series, and provide a little extra safety for end users.

1 Like

I don’t see why we can’t use --force for bundles, but we’d want to carefully decide what it means.

1 Like

As I bumped into this issue aswell, my resolution to this is to manually deploy the charm first:

juju deploy cs:foo --series baloo --force

… then, use the config yaml after that. Just give the cloud a few seconds to start the machines since they need to get proper indexes first…

juju deploy ./my-bundle.yaml

This works, since juju seems to be able to resolve the task of merging whatever the yaml config with what is already deployed in the current model. This is a feature I learned from @martin-hilton but is not very well documented?

One note is that you should be able to play with focal without the --force as of 2.7.5 (in candidate right now)

1 Like