Skip to content
Snippets Groups Projects
Commit 13506ddb authored by Lukáš Krupčík's avatar Lukáš Krupčík
Browse files

zmena struktury pro skripty

parent d4fb13e0
No related branches found
No related tags found
5 merge requests!368Update prace.md to document the change from qprace to qprod as the default...,!367Update prace.md to document the change from qprace to qprod as the default...,!366Update prace.md to document the change from qprace to qprod as the default...,!323extended-acls-storage-section,!49Add changes
Pipeline #
Showing
with 5 additions and 216 deletions
......@@ -25,7 +25,8 @@ spell check:
allow_failure: true
script:
#- npm i markdown-spellcheck -g
- mdspell '**/*.md' '!docs.it4i/module*.md' '!docs.it4i/anselm-cluster-documentation/software/omics-master/overview.md' '!docs.it4i/downtimes_history.md' -rns --en-us
- mdspell '**/*.md' '!docs.it4i/module*.md' '!docs.it4i/anselm-/add
cluster-documentation/software/omics-master/overview.md' '!docs.it4i/downtimes_history.md' -rns --en-us
ext_links:
stage: test
......@@ -46,10 +47,10 @@ mkdocs:
script:
#- apt-get update
#- apt-get -y install git
- bash add_version.sh
- bash get_modules.sh
- bash scripts/add_version.sh
- bash scripts/get_modules.sh
- mkdocs build
- bash clean_json.sh site/mkdocs/search_index.json
- bash scripts/clean_json.sh site/mkdocs/search_index.json
- sed -i 's,href="" title=",href="/" title=",g' site/404.html
artifacts:
paths:
......
File moved
File moved
File moved
File moved
File moved
File moved
##!/usr/bin/env python
#
# Copyright (C) 2016 IT4Innovations
#
##
import json
import os
import re
import xmlrpclib
def software_list(class_path):
"""List software from given module class"""
os.chdir(class_path)
software_list = next(os.walk('.'))[1]
# In case that there is 'all' module
if 'all' in software_list:
software_list.remove('all')
return software_list
def get_software_versions(software_path):
"""List available versions of software"""
os.chdir(software_path)
return next(os.walk('.'))[2]
def get_module_description(module_path):
"""Return software homepage URL and description"""
url = ""
description = " "
with open(module_path) as f:
content = f.read()
data = re.search(r"module-whatis\s{(Description: )?(.+)\s-\sHomepage:\s(\S+)}",
content, re.DOTALL)
try:
description = data.group(2)
url = data.group(3)
except AttributeError:
pass
return url, description
def push_to_portal(page):
"""Push HTML page to the user portal"""
remote = 'https://admin_write_modules_table:IcifomHantyi@docs.it4i.cz/'
server = xmlrpclib.ServerProxy(remote)
xmlout = server.xmlrpc_salomon_list_of_modules(page)
if __name__ == "__main__":
BASE_MODULES_DIR = '/apps/modules/'
SKIP_DIRS = ['all']
HTML_SOURCE_DATA = {}
os.chdir(BASE_MODULES_DIR)
subdirs = next(os.walk('.'))[1]
# Delete unwanted directories
for dir in SKIP_DIRS:
subdirs.remove(dir)
#print sorted(subdirs)
#subdirs = ['base']
# Create module class structure
print "# List of Available Modules"
for dir in sorted(subdirs):
class_path = os.path.join(BASE_MODULES_DIR, dir)
available_software = software_list(class_path)
#print available_software
print "\n###%s\n" % dir.title()
print "|Module|Description|Available versions|"
print "|--|--|--|"
HTML_SOURCE_DATA[dir] = {}
for soft in sorted(available_software, key=str.lower):
software_path = os.path.join(class_path, soft)
software_versions = get_software_versions(software_path)
# In case that there's not any available software version
if not software_versions:
continue
first_module_path = os.path.join(software_path, software_versions[0])
software_url, software_description = get_module_description(first_module_path)
#print software_description
HTML_SOURCE_DATA[dir][soft] = {'versions': [],
'url': software_url,
'description': software_description}
for version in software_versions:
HTML_SOURCE_DATA[dir][soft]['versions'].append(version)
#for version in software_versions:
# HTML_SOURCE_DATA[dir][soft]['versions'].append(version)
if software_url=="":
print "|**%s**|%s|<nobr>%s</nobr>|" % (soft," ".join(software_description.split()),'</br>'.join(software_versions))
else:
print "|**[%s](%s)**|%s|<nobr>%s</nobr>|" % (soft,software_url," ".join(software_description.split()),'</br>'.join(software_versions))
#json_obj = json.dumps(HTML_SOURCE_DATA, sort_keys=True, indent=4)
#push_to_portal(json_obj)
#print json_obj
#!/usr/bin/env python
#
# Copyright (C) 2016 IT4Innovations
#
import os
def software_list(class_path):
"""List software from given module class"""
os.chdir(class_path)
software_list = next(os.walk('.'))[1]
# In case that there is 'all' module
if 'all' in software_list:
software_list.remove('all')
return software_list
def get_software_versions(software_path):
"""List available versions of software"""
os.chdir(software_path)
return next(os.walk('.'))[2]
if __name__ == "__main__":
BASE_MODULES_DIR = '/apps/modules/'
SKIP_DIRS = ['all']
HTML_SOURCE_DATA = {}
os.chdir(BASE_MODULES_DIR)
subdirs = next(os.walk('.'))[1]
# Delete unwanted directories
for dir in SKIP_DIRS:
subdirs.remove(dir)
# Create module class structure
for dir in sorted(subdirs):
class_path = os.path.join(BASE_MODULES_DIR, dir)
available_software = software_list(class_path)
HTML_SOURCE_DATA[dir] = {}
for soft in sorted(available_software, key=str.lower):
software_path = os.path.join(class_path, soft)
software_versions = get_software_versions(software_path)
# In case that there's not any available software version
if not software_versions:
continue
first_module_path = os.path.join(software_path, software_versions[0])
HTML_SOURCE_DATA[dir][soft] = {'versions': []}
for version in software_versions:
HTML_SOURCE_DATA[dir][soft]['versions'].append(version)
print "%s|%s" % (soft.lower(),';'.join(software_versions))
#!/bin/bash
### MOTD and Downtime history
# autor: kru0052
# 2016 IT4Innovations
# version 1.0
###
printf "update"
wget -q http://www.it4i.cz/support/?lang=en
printf " ... OK\n"
i="index.html?lang=en"
HEAD=$(grep -n -m1 'class="matrix light-grey' "$i" |cut -f1 -d: | tr --delete '\n')
END=$(grep -n -m1 '<h3>Other</h3>' "$i" |cut -f1 -d: | tr --delete '\n')
LAST=$(wc -l "$i" | cut -f1 -d' ')
DOWN=$((LAST-END+2))
sed '1,'"$((HEAD-1))"'d' "$i" | sed -n -e :a -e '1,'"$DOWN"'!{P;N;D;};N;ba' | sed '/<div/d' > "TMP.html"
rm "/srv/downtime/$i"
title="Message of the day"
head=$(cat TMP.html | grep "rss-item-title" | cut -d ">" -f 2 | cut -d "<" -f 1)
date=$(cat TMP.html | grep "<i>" | cut -d ">" -f 2 | cut -d "<" -f 1 | cut -d " " -f 1)
info=$(cat TMP.html | grep "<p>" | cut -d ">" -f 2 | cut -d "<" -f 1)
rm /srv/downtime/TMP.html
echo ""
echo "$title"
echo "$date - $head"
echo "$info"
echo ""
# poovolene stavy - Salomon Maintenance, Anselm Maintenance, Back in Production, Infrastructure Maintenance, PBS Maintenance, SCRATCH Maintenance, HOME Maintenance, Salomon and Anselm Maintenance
if [ "$head" = "Salomon Maintenance" ] || [ "$head" = "Anselm Maintenance" ] || [ "$head" = "Back in Production" ] || [ "$head" = "Infrastructure Maintenance" ] || [ "$head" = "PBS Maintenance" ] || [ "$head" = "SCRATCH Maintenance" ] || [ "$head" = "HOME Maintenance" ] || [ "$head" = "Salomon and Anselm Maintenance" ]; then
dateDown=$(cat /srv/downtime/docs/index.md | sed -n '/---/{n;p;}' | cut -d "|" -f 2 | cut -d " " -f 1)
headDown=$(cat /srv/downtime/docs/index.md | sed -n '/---/{n;p;}' | cut -d "|" -f 3 | cut -d "*" -f 3)
echo "$date - $dateDown"
if [ "$date" = "$dateDown" ] && [ "$head" = "$headDown" ]; then
echo "Everything up-to-date..."
else
echo "Updating Downtime History..."
test=" |$date 00:00:00|**$head** $info|"
sed '/---/a '"$test"'' /srv/downtime/docs/index.md > /srv/downtime/TMP.md
cat /srv/downtime/TMP.md > /srv/downtime/docs/index.md
# rm /srv/downtime/TMP.md
fi
# echo "### $title" > docs/index.md
# echo "**$head**" >> docs/index.md
# echo "$date - $info" >> docs/index.md
else
echo "Downtime History not updated..."
fi
echo "# $title" > docs/motd.md
echo "**$head**" >> docs/motd.md
echo "$date - $info" >> docs/motd.md
time=$(date)
sed '$d' /srv/downtime/docs/index.md > /srv/downtime/TMP.md
cat /srv/downtime/TMP.md > /srv/downtime/docs/index.md
rm /srv/downtime/TMP.md
echo "updating $time" >> /srv/downtime/docs/index.md
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment