Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F44414608
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/Makefile b/Makefile
index cdfd969..239fb9b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,64 +1,66 @@
# -------------------------------------------------------------
# Salt - Operations repository
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Description: Allow to generate repository or API content
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
HOST_NAME != hostname -s
HOST_DOMAIN != hostname -d
API_DIR=/var/wwwroot/$(HOST_DOMAIN)/$(HOST_NAME)/datasources/infra
RM=rm -f
MKDIR=mkdir -p
MV=mv
# -------------------------------------------------------------
# Main targets
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_default: repo
all: repo api
clean: clean-repo clean-api
test:
(cd _tests && make)
# -------------------------------------------------------------
# Build targets - repository
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
repo: roles/webserver-content/init.sls \
roles/webserver-core/nginx/files/ocsp-ca-certs.pem \
.git/hooks/pre-commit
-roles/webserver-content/init.sls:
+roles/webserver-content/init.sls: webserver-content-index
+
+webserver-content-index:
tmpfile=`mktemp /tmp/make-rOPS-generate-webcontent-index.XXXXXX` ; \
utils/generate-webcontent-index.py > "$$tmpfile" ;\
${MV} "$$tmpfile" roles/webserver-content/init.sls
roles/webserver-core/nginx/files/ocsp-ca-certs.pem:
utils/generate-ocsp-bundle.sh > roles/webserver-core/nginx/files/ocsp-ca-certs.pem
.git/hooks/pre-commit:
pre-commit install
clean-repo:
${RM} roles/webserver-content/init.sls .git/hooks/pre-commit
${RM} roles/webserver-core/nginx/files/ocsp-ca-certs.pem
# -------------------------------------------------------------
# Build targets - API
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
api: $(API_DIR)/all-states.json
$(API_DIR)/all-states.json:
${MKDIR} ${API_DIR}
utils/show-local-states.py > ${API_DIR}/all-states.json
clean-api:
${RM} ${API_DIR}/all-states.json
diff --git a/utils/generate-webcontent-index.py b/utils/generate-webcontent-index.py
index 39ee4d0..5205b6c 100755
--- a/utils/generate-webcontent-index.py
+++ b/utils/generate-webcontent-index.py
@@ -1,77 +1,79 @@
#!/usr/bin/env python3
# -------------------------------------------------------------
# rOPS — regenerate roles/webserver-content/init.sls
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2017-11-24
# Description: Read the web_content_sls pillar entry
# and regenerate the webserver-content include.
# License: BSD-2-Clause
# -------------------------------------------------------------
import yaml
# -------------------------------------------------------------
# Table of contents
# -------------------------------------------------------------
#
# :: Configuration
# :: Update code
# :: Run task
#
# -------------------------------------------------------------
# -------------------------------------------------------------
# Configuration
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
config = {
"pillar": "pillar/webserver/sites.sls",
"states": "roles/webserver-content/init.sls",
}
# -------------------------------------------------------------
# Update code
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def do_update(pillar_file, file_to_update):
print_header(file_to_update)
print("\ninclude:")
for site in get_sites(pillar_file):
print(" - {}".format(site))
+ print("")
+ print(" - ._generic")
def get_pillar_entry(pillar_file, key):
with open(pillar_file) as fd:
pillar = yaml.safe_load(fd.read())
return pillar[key]
def get_sites(pillar_file):
sites = get_pillar_entry(pillar_file, "web_content_sls")
- return sorted(
+ return sorted(set(
[site for sublist in [sites[role] for role in sites] for site in sublist]
- )
+ ))
def print_header(file_to_update):
with open(file_to_update) as fd:
for line in fd:
if not line.startswith("#"):
break
print(line, end="")
# -------------------------------------------------------------
# Run task
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if __name__ == "__main__":
do_update(config["pillar"], config["states"])
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Aug 18, 23:09 (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4001155
Default Alt Text
(4 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment