Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
devops
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osm
devops
Commits
15474010
Commit
15474010
authored
7 years ago
by
israelad
Committed by
marchettim
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add exception handling during config-changed hook
Signed-off-by:
Adam Israel
<
adam.israel@canonical.com
>
parent
24aaf3eb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
juju-charms/layers/pingpong/reactive/pingpong.py
+19
-12
19 additions, 12 deletions
juju-charms/layers/pingpong/reactive/pingpong.py
with
19 additions
and
12 deletions
juju-charms/layers/pingpong/reactive/pingpong.py
+
19
−
12
View file @
15474010
...
...
@@ -39,19 +39,26 @@ def config_changed():
Verify that the charm has been configured
"""
status_set
(
'
maintenance
'
,
'
Verifying configuration data...
'
)
(
validated
,
output
)
=
charms
.
sshproxy
.
verify_ssh_credentials
()
if
not
validated
:
status_set
(
'
blocked
'
,
'
Unable to verify SSH credentials: {}
'
.
format
(
output
))
return
if
all
(
k
in
cfg
for
k
in
[
'
mode
'
]):
if
cfg
[
'
mode
'
]
in
[
'
ping
'
,
'
pong
'
]:
set_flag
(
'
pingpong.configured
'
)
status_set
(
'
active
'
,
'
ready!
'
)
try
:
status_set
(
'
maintenance
'
,
'
Verifying configuration data...
'
)
(
validated
,
output
)
=
charms
.
sshproxy
.
verify_ssh_credentials
()
if
not
validated
:
status_set
(
'
blocked
'
,
'
Unable to verify SSH credentials: {}
'
.
format
(
output
))
return
status_set
(
'
blocked
'
,
'
Waiting for configuration
'
)
if
all
(
k
in
cfg
for
k
in
[
'
mode
'
]):
if
cfg
[
'
mode
'
]
in
[
'
ping
'
,
'
pong
'
]:
set_flag
(
'
pingpong.configured
'
)
status_set
(
'
active
'
,
'
ready!
'
)
return
status_set
(
'
blocked
'
,
'
Waiting for configuration
'
)
except
Exception
as
err
:
status_set
(
'
blocked
'
,
'
Waiting for valid configuration ({})
'
.
format
(
err
))
@when
(
'
config.changed
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment