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
8363571d
Commit
8363571d
authored
7 years ago
by
marchettim
Committed by
Gerrit Code Review
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Add better status messages"
parents
0d20edf9
5a0f6e44
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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
+22
-6
22 additions, 6 deletions
juju-charms/layers/pingpong/reactive/pingpong.py
with
22 additions
and
6 deletions
juju-charms/layers/pingpong/reactive/pingpong.py
+
22
−
6
View file @
8363571d
...
...
@@ -10,20 +10,29 @@ from charms.reactive import (
remove_state
as
remove_flag
,
set_state
as
set_flag
,
when
,
when_not
,
)
import
charms.sshproxy
from
subprocess
import
(
Popen
,
CalledProcessError
,
PIPE
,
)
#
from subprocess import (
#
Popen,
#
CalledProcessError,
#
PIPE,
#
)
cfg
=
config
()
@when
(
'
config.changed
'
)
@when
(
'
config.changed
'
,
'
sshproxy.configured
'
)
def
config_changed
():
"""
Verify the configuration.
Verify that the charm has been configured
"""
(
validated
,
output
)
=
charms
.
sshproxy
.
verify_ssh_credentials
()
if
not
validated
:
status_set
(
'
blocked
'
,
'
Unable to verify SSH credentials: {}
'
.
format
(
output
))
if
all
(
k
in
cfg
for
k
in
[
'
mode
'
]):
if
cfg
[
'
mode
'
]
in
[
'
ping
'
,
'
pong
'
]:
set_flag
(
'
pingpong.configured
'
)
...
...
@@ -32,6 +41,13 @@ def config_changed():
status_set
(
'
blocked
'
,
'
Waiting for configuration
'
)
@when
(
'
config.changed
'
)
@when_not
(
'
sshproxy.configured
'
)
def
invalid_credentials
():
status_set
(
'
blocked
'
,
'
Waiting for SSH credentials.
'
)
pass
def
is_ping
():
if
cfg
[
'
mode
'
]
==
'
ping
'
:
return
True
...
...
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