Fix indentations

This commit is contained in:
Alexander Grothe
2017-03-02 09:06:19 +01:00
parent 5219bdc4e5
commit 54c7d091fd
6 changed files with 160 additions and 187 deletions

View File

@@ -13,10 +13,10 @@ drivers:
sundtek: auto
ddvb-dkms: auto
extra_packages:
- vim
- tree
- w-scan
extra_packages:
- vim
- tree
- w-scan
vdr:
user: vdr

View File

@@ -1,43 +1,43 @@
#!/usr/bin/env python3
# This script sends a multicast message and awaits responses by Sat>IP servers.
# returns the boolean variable 'satip_detected' as json
import json
import socket
import sys
import time
#!/usr/bin/env python3
# This script sends a multicast message and awaits responses by Sat>IP servers.
# returns the boolean variable 'satip_detected' as json
import json
import socket
import sys
import time
SSDP_ADDR = "239.255.255.250"
SSDP_PORT = 1900
# SSDP_MX = max delay for server response
# a value of 2s is recommended by the SAT>IP specification 1.2.2
SSDP_MX = 2
SSDP_ST = "urn:ses-com:device:SatIPServer:1"
SSDP_ADDR = "239.255.255.250"
SSDP_PORT = 1900
# SSDP_MX = max delay for server response
# a value of 2s is recommended by the SAT>IP specification 1.2.2
SSDP_MX = 2
SSDP_ST = "urn:ses-com:device:SatIPServer:1"
ssdpRequest = "\r\n".join((
"M-SEARCH * HTTP/1.1",
"HOST: %s:%d" % (SSDP_ADDR, SSDP_PORT),
"MAN: \"ssdp:discover\"",
"MX: %d" % (SSDP_MX),
"ST: %s" % (SSDP_ST),
"\r\n"))
ssdpRequest = "\r\n".join((
"M-SEARCH * HTTP/1.1",
"HOST: %s:%d" % (SSDP_ADDR, SSDP_PORT),
"MAN: \"ssdp:discover\"",
"MX: %d" % (SSDP_MX),
"ST: %s" % (SSDP_ST),
"\r\n"))
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# according to Sat>IP Specification 1.2.2, p. 20
# a client should send three requests within 100 ms with a ttl of 2
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
sock.settimeout(SSDP_MX + 0.5)
for _ in range(3):
sock.sendto(ssdpRequest.encode('ascii'), (SSDP_ADDR, SSDP_PORT))
time.sleep(0.03)
try:
response = sock.recv(1000).decode()
if response and "SERVER:" in response:
got_response = True
else:
raise ValueError('No satip server detected')
except (socket.timeout, ValueError):
got_response = False
finally:
print(json.dumps(
{'satip_detected': got_response}
))
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# according to Sat>IP Specification 1.2.2, p. 20
# a client should send three requests within 100 ms with a ttl of 2
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
sock.settimeout(SSDP_MX + 0.5)
for _ in range(3):
sock.sendto(ssdpRequest.encode('ascii'), (SSDP_ADDR, SSDP_PORT))
time.sleep(0.03)
try:
response = sock.recv(1000).decode()
if response and "SERVER:" in response:
got_response = True
else:
raise ValueError('No satip server detected')
except (socket.timeout, ValueError):
got_response = False
finally:
print(json.dumps(
{'satip_detected': got_response}
))

View File

@@ -1,15 +0,0 @@
---
# file: local_facts.yml
- name: create directory for local facts
file:
dest: /etc/ansible/facts.d
state: directory
- name: copy facts script for USB- and PCI(e)-IDs
copy:
src: files/hardware.facts.py
dest: /etc/ansible/facts.d/hardware.facts
mode: '0775'
- name: get local facts
setup:

View File

@@ -1,11 +1,12 @@
---
# This playbook sets up the basic packages an directories for a yaVDR installation
# file: roles/yavdr-common/tasks/main.yml
- name: apt | prevent automatic installation of recommended packages
template:
src: templates/90-norecommends.j2
dest: /etc/apt/apt.conf.d/90norecommends
src: templates/90-norecommends.j2
dest: /etc/apt/apt.conf.d/90norecommends
- name: add yaVDR PPAs
apt_repository:
@@ -39,13 +40,6 @@
- usbutils
- xfsprogs
- name: install and execute local fact scripts
- include:
- tasks/local_facts.yml
---
# file: local_facts.yml
- name: create directory for local facts
file:
dest: /etc/ansible/facts.d