/
base.py
49 lines (34 loc) · 1.16 KB
/
base.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- coding: utf-8 -*-
import logging
from ..common.subject import Subject
from ..common.dynamiccli import DynamicCliMixin
log = logging.getLogger(__name__)
class UpdateProtocol(Subject, DynamicCliMixin):
"""Base class for all update protocols that use a simple http GET protocol."""
_updateurl = None
theip = None
hostname = None # this holds the desired dns hostname
def __init__(self):
"""Initializer."""
self.updateurl = self._updateurl
super(UpdateProtocol, self).__init__()
def updateUrl(self):
return self.updateurl
def service_url(self):
return self.updateUrl()
def url(self):
return self.updateUrl()
@staticmethod
def configuration_key():
"""
Return a human readable string identifying the protocol.
Must be implemented by all updater subclasses.
"""
return "none_base_class"
@staticmethod
def configuration_key_prefix():
"""
Return a human readable string classifying this class as an updater.
Must be not be implemented or overwritten in updater subclasses.
"""
return "updater"