-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds resource support for charmhub deployments
- Loading branch information
Showing
4 changed files
with
90 additions
and
7 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,35 @@ | ||
""" | ||
This example: | ||
1. Connects to the current model | ||
2. Deploy a charm 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') | ||
await model.connect() | ||
|
||
try: | ||
print('Deploying ') | ||
application = await model.deploy( | ||
'ch:snappass-test', | ||
application_name='snappass' | ||
) | ||
|
||
print('Waiting for active') | ||
await model.block_until( | ||
lambda: all(unit.workload_status == 'active' | ||
for unit in application.units)) | ||
|
||
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
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
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