diff --git a/bundles/apt/items.py b/bundles/apt/items.py index 48024ba..00bbcca 100644 --- a/bundles/apt/items.py +++ b/bundles/apt/items.py @@ -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) diff --git a/bundles/influxdb2/items.py b/bundles/influxdb2/items.py new file mode 100644 index 0000000..e2201a7 --- /dev/null +++ b/bundles/influxdb2/items.py @@ -0,0 +1,2 @@ +#sudo systemctl unmask influxdb.service +#sudo systemctl start influxdb diff --git a/libs/apt.py b/libs/apt.py index 4cb8030..a673798 100644 --- a/libs/apt.py +++ b/libs/apt.py @@ -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])