Prevent the enroll/deploy commands from running without venv
Running them without sourcing the venv configuration results in a very confusing error message from ansible. Prevent that. Change-Id: I0cc408b475134eb76d3229b9cccefb9555b4bcba
This commit is contained in:
parent
e5f928ee46
commit
2fb9e13c02
@ -191,7 +191,18 @@ def cmd_install(args):
|
||||
"See documentation for next steps")
|
||||
|
||||
|
||||
def ensure_inside_venv():
|
||||
try:
|
||||
import oslo_config # noqa
|
||||
except ImportError:
|
||||
sys.exit("This command must be executed inside the Bifrost virtual "
|
||||
"environment. Try:\n"
|
||||
f" $ source {VENV}/bin/activate\n"
|
||||
" $ export OS_CLOUD=bifrost")
|
||||
|
||||
|
||||
def configure_inventory(args):
|
||||
ensure_inside_venv()
|
||||
inventory = os.path.join(PLAYBOOKS, 'inventory', 'bifrost_inventory.py')
|
||||
if not args.inventory:
|
||||
os.environ['BIFROST_INVENTORY_SOURCE'] = 'ironic'
|
||||
|
Loading…
Reference in New Issue
Block a user