Page MenuHomeDevCentral

D2554.id6453.diff
No OneTemporary

D2554.id6453.diff

diff --git a/Makefile b/Makefile
new file mode 100644
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,28 @@
+# -------------------------------------------------------------
+# Nasqueron - API
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Description: Build API files
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+API_FILES=infra/servers.json
+YAML_TO_JSON=_utils/yaml2json.py
+
+RM=rm -f
+
+# -------------------------------------------------------------
+# Main targets
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+all: $(API_FILES)
+
+clean:
+ ${RM} ${API_FILES}
+
+# -------------------------------------------------------------
+# API targets
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+infra/servers.json:
+ ${YAML_TO_JSON} infra/datasource.yml servers > infra/servers.json
diff --git a/_utils/yaml2json.py b/_utils/yaml2json.py
new file mode 100755
--- /dev/null
+++ b/_utils/yaml2json.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python3
+
+# -------------------------------------------------------------
+# Nasqueron - API
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Description: Create a JSON document from a YAML datasource
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+
+import json
+import sys
+import yaml
+
+
+# -------------------------------------------------------------
+# Convert
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+def to_json(source_path, key=None):
+ with open(source_path) as fd:
+ data = yaml.safe_load(fd)
+
+ if key:
+ data = data[key]
+
+ return json.dumps(data, indent=4)
+
+
+# -------------------------------------------------------------
+# Application entry point
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+def run(source_path, key=None):
+ print(to_json(source_path, key))
+
+
+if __name__ == "__main__":
+ argc = len(sys.argv)
+
+ if argc < 2:
+ print(f"Usage: {sys.argv[0]} <YAML datasource> [key to take]", file=sys.stderr)
+ sys.exit(1)
+
+ run(*sys.argv[1:3])
diff --git a/index.html b/index.html
--- a/index.html
+++ b/index.html
@@ -15,6 +15,7 @@
<ul>
<li><strong><a href="/servers-log/all.json">/servers-log/all.json</a></strong> — Servers log</li>
<li><strong><a href="/docker/registry">/docker/registry</a></strong> — Docker registry API</li>
+ <li><strong><a href="/infra/servers.json">/infra/servers.json</a></strong> — Servers list</li>
</ul>
<h2>Tools</h2>
<ul>
diff --git a/infra/datasource.yml b/infra/datasource.yml
new file mode 100644
--- /dev/null
+++ b/infra/datasource.yml
@@ -0,0 +1,31 @@
+servers:
+
+ windriver:
+ name: WindRiver
+ hostname: windriver.nasqueron.org
+ description: Development server
+ configurator: salt
+
+ ysul:
+ name: Ysul
+ hostname: ysul.nasqueron.org
+ description: Development server (legacy)
+ configurator: salt
+
+ cloudhugger:
+ name: CloudHugger
+ hostname: cloudhugger.nasqueron.org
+ description: OpenSearch testing
+ configurator: salt
+
+ docker-001:
+ name: docker-001
+ hostname: docker-001.nasqueron.org
+ description: Docker engine (prod)
+ configurator: salt
+
+ dwellers:
+ name: Dwellers
+ hostname: dwellers.nasqueron.org
+ description: Docker engine (dev)
+ configurator: salt
diff --git a/infra/servers.json b/infra/servers.json
new file mode 100644
--- /dev/null
+++ b/infra/servers.json
@@ -0,0 +1,32 @@
+{
+ "windriver": {
+ "name": "WindRiver",
+ "hostname": "windriver.nasqueron.org",
+ "description": "Development server",
+ "configurator": "salt"
+ },
+ "ysul": {
+ "name": "Ysul",
+ "hostname": "ysul.nasqueron.org",
+ "description": "Development server (legacy)",
+ "configurator": "salt"
+ },
+ "cloudhugger": {
+ "name": "CloudHugger",
+ "hostname": "cloudhugger.nasqueron.org",
+ "description": "OpenSearch testing",
+ "configurator": "salt"
+ },
+ "docker-001": {
+ "name": "docker-001",
+ "hostname": "docker-001.nasqueron.org",
+ "description": "Docker engine (prod)",
+ "configurator": "salt"
+ },
+ "dwellers": {
+ "name": "Dwellers",
+ "hostname": "dwellers.nasqueron.org",
+ "description": "Docker engine (dev)",
+ "configurator": "salt"
+ }
+}
diff --git a/sites.json b/sites.json
--- a/sites.json
+++ b/sites.json
@@ -3,54 +3,54 @@
"id": "blog",
"title": "Nasqueron Blog",
"description": "Our blog",
- "shorcutKey": "b"
+ "shortcutKey": "b"
},
{
"id": "ci",
"title": "Continuous integration and development",
"description": "Jenkins installation",
- "shorcutKey": "j"
+ "shortcutKey": "j"
},
{
"id": "databases",
"title": "Nasqueron Databases",
"description": "Collection of databases, and small applications build on the top of these databases",
- "shorcutKey": "d"
+ "shortcutKey": "d"
},
{
"id": "forum",
"title": "Nasqueron Forum",
"description": "A bulletin board for discussions",
- "shorcutKey": "f"
+ "shortcutKey": "f"
},
{
"id": "notes",
"title": "Nasqueron Notes",
"description": "A service to publish quick notes, code snippets or annotatable images",
- "shorcutKey": "n"
+ "shortcutKey": "n"
},
{
"id": "planet",
"title": "Planet Nasqueron",
"description": "The blogs Nasqueron members enjoy",
- "shorcutKey": "p"
+ "shortcutKey": "p"
},
{
"id": "tools",
"title": "Nasqueron Tools",
"description": "Small utilities, gadgets & scripts to perform daily tasks",
- "shorcutKey": "t"
+ "shortcutKey": "t"
},
{
"id": "agora",
"title": "Agora",
"description": "Collection of notes about Nasqueron and other stuff",
- "shorcutKey": "w"
+ "shortcutKey": "w"
},
{
"id": "devcentral",
"title": "DevCentral",
"description": "Coding adventure game",
- "shorcutKey": "²"
+ "shortcutKey": "²"
}
]

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 30, 09:22 (21 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2272761
Default Alt Text
D2554.id6453.diff (6 KB)

Event Timeline