wip
This commit is contained in:
parent
1a5e3cd388
commit
ca0966a33b
3 changed files with 12 additions and 7 deletions
|
@ -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)
|
||||
|
|
2
bundles/influxdb2/items.py
Normal file
2
bundles/influxdb2/items.py
Normal file
|
@ -0,0 +1,2 @@
|
|||
#sudo systemctl unmask influxdb.service
|
||||
#sudo systemctl start influxdb
|
15
libs/apt.py
15
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])
|
||||
|
|
Loading…
Reference in a new issue