FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-libjuju/examples/upgrade_local_charm_k8s.py at master · Maxcode123/python-libjuju · GitHub
Maxcode123
python-libjuju
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-libjuju
/
examples
/
upgrade_local_charm_k8s.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (35 loc) · 1.17 KB
Breadcrumbs
python-libjuju
/
examples
/
upgrade_local_charm_k8s.py
Copy path
File metadata and controls
46 lines (35 loc) · 1.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
This example:
1. Connects to the current model
2. Deploy a bundle and waits until it reports itself active
3. Upgrades the charm with a local path
4. Destroys the units and applications
"""
from
juju
import
jasyncio
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 bundle'
)
applications
=
await
model
.
deploy
(
'./examples/k8s-local-bundle/bundle.yaml'
,
)
print
(
'Waiting for active'
)
await
model
.
wait_for_idle
(
status
=
'active'
)
print
(
"Successfully deployed!"
)
local_path
=
'./examples/charms/onos.charm'
print
(
'Upgrading charm with %s'
%
local_path
)
await
applications
[
0
].
upgrade_charm
(
path
=
local_path
)
await
model
.
wait_for_idle
(
status
=
'active'
)
print
(
'Removing bundle'
)
for
application
in
applications
:
await
application
.
remove
()
finally
:
print
(
'Disconnecting from model'
)
await
model
.
disconnect
()
print
(
"Success"
)
if
__name__
==
'__main__'
:
jasyncio
.
run
(
main
())
Back
|
FazBrowse Home
|
New Git URL