forked from juju/python-libjuju
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provide true charm origin for charmhub to locate and deploy charms fr…
- Loading branch information
Showing
2 changed files
with
50 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
""" | ||
This example: | ||
1. Connects to the current model | ||
2. Deploy a bundle from charmhub and waits until it reports itself active | ||
3. Destroys the unit and application | ||
""" | ||
from juju import loop | ||
from juju.model import Model | ||
|
||
|
||
async def main(): | ||
model = Model() | ||
print("Connecting to model") | ||
# connect to current model with current user, per Juju CLI | ||
await model.connect() | ||
|
||
try: | ||
print("Deploying lma-light") | ||
applications = await model.deploy("ch:lma-light", channel="edge", trust=True) | ||
|
||
print("Waiting for active") | ||
await model.wait_for_idle(status="active") | ||
|
||
print("Removing lma-light") | ||
for application in applications: | ||
await application.remove() | ||
finally: | ||
print("Disconnecting from model") | ||
await model.disconnect() | ||
|
||
|
||
if __name__ == "__main__": | ||
loop.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters