Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3769779
notifications.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
notifications.py
View Options
# -------------------------------------------------------------
# Salt — Node execution module
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Description: Build Notifications center configuration
# License: BSD-2-Clause
# -------------------------------------------------------------
import
copy
def
get_credentials
():
try
:
services
=
__pillar__
[
"notifications_credentials"
][
"services"
]
except
KeyError
:
services
=
[]
return
{
"services"
:
[
_build_service_config
(
service
)
for
service
in
services
]}
def
_build_service_config
(
service
):
built_service
=
copy
.
deepcopy
(
service
)
if
"secret"
in
service
:
built_service
[
"secret"
]
=
__salt__
[
"credentials.get_token"
](
service
[
"secret"
])
return
built_service
# -------------------------------------------------------------
# Build triggers
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def
get_dockerhub_triggers
():
repositories
=
__pillar__
.
get
(
"notifications_dockerhub_triggers"
,
{})
return
{
repository
:
_get_dockerhub_trigger
(
key
)
for
repository
,
key
in
repositories
.
items
()
}
def
_get_dockerhub_trigger
(
key
):
secret
=
__salt__
[
"vault.read_secret"
](
key
)
return
{
"source"
:
secret
[
"source"
],
"trigger"
:
secret
[
"trigger"
],
}
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Mon, Nov 25, 16:53 (19 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2257374
Default Alt Text
notifications.py (1 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment