Skip to content

Commit

Permalink
Add new quiet-down and cancel-quiet-down actions to the charm
Browse files Browse the repository at this point in the history
  • Loading branch information
alejdg committed Feb 6, 2020
1 parent 24b0a7a commit dd212cb
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
6 changes: 5 additions & 1 deletion actions.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
restart:
description: Wait for all jobs to be completed and restart jenkins.
upgrade:
description: Upgrade jenkins package when using bundle.
description: Upgrade jenkins package when using bundle.
quiet-down:
description: Put Jenkins in a Quiet mode. In that mode Jenkins doesn’t start any build.
cancel-quiet-down:
description: Cancel quiet mode.
24 changes: 24 additions & 0 deletions actions/cancel-quiet-down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/local/sbin/charm-env python3

from charmhelpers.core.hookenv import (
action_fail,
action_set,
)

from charms.apt import status_set

from charms.layer.jenkins.api import Api


def cancel_quiet_down():
api = Api()
api.cancel_quiet_down()
status_set("active", "Jenkins is running")
action_set({'output': "Quiet mode has been cancelled",
'outcome': 'Success'})


try:
cancel_quiet_down()
except Exception as e:
action_fail("Failed to put jenkins in Quiet mode: {}".format(str(e)))
24 changes: 24 additions & 0 deletions actions/quiet-down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/local/sbin/charm-env python3

from charmhelpers.core.hookenv import (
action_fail,
action_set,
)

from charms.apt import status_set

from charms.layer.jenkins.api import Api


def quiet_down():
api = Api()
api.quiet_down()
status_set("maintenance", "Jenkins is in Quiet mode")
action_set({'output': "Jenkins has been put in Quiet mode",
'outcome': 'Success'})


try:
quiet_down()
except Exception as e:
action_fail("Failed to put jenkins in Quiet mode: {}".format(str(e)))

0 comments on commit dd212cb

Please sign in to comment.