This commit is contained in:
mwiegand 2021-06-21 13:40:47 +02:00
parent 1a5e3cd388
commit ca0966a33b
3 changed files with 12 additions and 7 deletions
bundles
apt
influxdb2
libs

View file

@ -32,7 +32,7 @@ actions = {
hosts = {}
for source in node.metadata.get('apt/sources'):
host = urlparse(source.split()[1]).hostname
host = repo.libs.apt.AptSource(source).url.hostname
hosts\
.setdefault(host, set())\
.add(source)

View file

@ -0,0 +1,2 @@
#sudo systemctl unmask influxdb.service
#sudo systemctl start influxdb

View file

@ -1,15 +1,18 @@
# https://manpages.debian.org/jessie/apt/sources.list.5.de.html
from urllib.parse import urlparse
from re import search, sub
from re import match, search, sub
class AptSource():
def __init__(self, string):
self.options = {
k:v.split('=') for k,v in (
e.split('=') for e in search(r'\[(.*)\]', string)[1].split()
)
}
if match(r'\[.*\]', string):
self.options = {
k:v.split('=') for k,v in (
e.split('=') for e in search(r'\[(.*)\]', string)[1].split()
)
}
else:
self.options = {}
parts = sub(r'\[.*\]', '', string).split()
self.type = parts[0]
self.url = urlparse(parts[1])