Can't deploy local charm via API
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-jujuclient |
Triaged
|
Critical
|
Tim Van Steenburgh |
Bug Description
The steps used to deploy a local charm via the api under juju1 no longer work on juju2 (beta15).
Here's a python script to repro. You'll need the latest lp:python-jujuclient, which you can install from source or from ppa:tvansteenbu
tvansteenburgh@
#!/usr/bin/env python3
import logging
import ssl
from jujuclient.
log = logging.
# Constants, change these for your environment
API_SERVER = '10.0.4.52'
USER = 'user-admin'
PASSWORD = 'd7247825e7df51
CHARM_DIR = '/home/
if __name__ == "__main__":
logging.
# Login to controller
endpoint = 'wss://%s:17070' % (API_SERVER)
controller = Environment(
controller.
# Login to default model
models = controller.
for m in models[
if m['model']['name'] == 'default':
model = Environment(
# Workaround for certificatge failure (hack)
ssl.
# Upload a local charm to the model
res = model.add_
log.
# Turn on rpc debugging so we can see raw api calls
model._debug = True
# Deploy the uploaded charm
res = model.deploy(
log.
And here's the output of running it. As you can see, the local charm is uploaded successfully and we get a charm-url back, but then when we try to deploy the charm using that url, it doesn't work:
tvansteenburgh@
DEBUG:_
DEBUG:jujuclien
{
"params": {
"applications": [
{
"config": {},
}
]
},
"request-id": 2,
"version": 1,
"request": "Deploy",
"type": "Application"
}
DEBUG:jujuclien
{
"request-id": 2,
"response": {
"results": [
{
"error": {
"code": "not found"
}
}
]
}
}
DEBUG:_
Changed in juju: | |
status: | New → Triaged |
importance: | Undecided → High |
milestone: | none → 2.0-beta17 |
Changed in juju: | |
importance: | High → Critical |
Changed in juju: | |
assignee: | nobody → Katherine Cox-Buday (cox-katherine-e) |
affects: | juju → python-jujuclient |
Changed in python-jujuclient: | |
milestone: | 2.0-beta17 → none |
Turns out that model.uuid is None since the Environment is instantiated with a bare IP endpoint, and the model uuid is not passed in. The effect is the the charm is uploaded to the controller instead of the model. So it gets a valid charm-url back, but it's from the controller, not the model, so when you try to deploy that charm in the model, it's not found.
Totally not a bug in juju.
@katco, I'm sorry for wasting your time. Thanks for your patience and helpfulness.