Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3769640
convert.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
876 B
Referenced Files
None
Subscribers
None
convert.py
View Options
# -*- coding: utf-8 -*-
# -------------------------------------------------------------
# Salt — Convert execution module
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2018-09-08
# Description: Functions related to data format conversions
# License: BSD-2-Clause
# -------------------------------------------------------------
import
json
def
to_json_from_pillar_key
(
key
):
"""
A function to output a pillar key in JSON.
CLI Example::
salt-call --local convert.to_json "Hello world"
"""
data
=
__pillar__
.
get
(
key
,
{})
return
to_json
(
data
)
def
to_json
(
data
):
"""
A function to convert data to JSON.
CLI Example::
salt-call --local convert.to_json "Hello world"
"""
return
json
.
dumps
(
data
,
indent
=
4
,
sort_keys
=
True
)
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Mon, Nov 25, 16:19 (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260524
Default Alt Text
convert.py (876 B)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment