Page MenuHomeDevCentral

D1684.id.diff
No OneTemporary

D1684.id.diff

diff --git a/_modules/convert.py b/_modules/convert.py
new file mode 100644
--- /dev/null
+++ b/_modules/convert.py
@@ -0,0 +1,36 @@
+# -*- 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

Mime Type
text/plain
Expires
Wed, Nov 6, 14:15 (12 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2231931
Default Alt Text
D1684.id.diff (1 KB)

Event Timeline