summaryrefslogtreecommitdiff
path: root/docker/utils
diff options
context:
space:
mode:
authorMazz Mosley <mazz@houseofmnowster.com>2015-08-17 11:29:52 +0100
committerMazz Mosley <mazz@houseofmnowster.com>2015-08-26 16:02:03 +0100
commit35b30e69df3b772f6e684405a8f10cb31039e661 (patch)
tree5ee0fc3c51e6bbdffafa31bc82ac2a43807b501d /docker/utils
parent90538cf0a38f177b7b8e8252c54405c8fd54c70a (diff)
downloaddocker-py-35b30e69df3b772f6e684405a8f10cb31039e661.tar.gz
Remove validation of supported log drivers
By having this hardcoded list of log drivers, it is a bottleneck to us supporting more log drivers. The daemon already validates if a log driver is valid or not, so rather than duplicating that validation, let's pass the log_driver along. This allows support for new/more log drivers as they become supported in docker without having to wait for both docker-py and docker-compose to support them. Keeping the current list of log driver types for backwards compatibility. Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
Diffstat (limited to 'docker/utils')
-rw-r--r--docker/utils/types.py18
1 files changed, 5 insertions, 13 deletions
diff --git a/docker/utils/types.py b/docker/utils/types.py
index 6ef9687..8271a0d 100644
--- a/docker/utils/types.py
+++ b/docker/utils/types.py
@@ -20,21 +20,17 @@ class DictType(dict):
class LogConfig(DictType):
- types = LogConfigTypesEnum
def __init__(self, **kwargs):
- type_ = kwargs.get('type', kwargs.get('Type'))
- config = kwargs.get('config', kwargs.get('Config'))
- if type_ not in self.types._values:
- raise ValueError("LogConfig.type must be one of ({0})".format(
- ', '.join(self.types._values)
- ))
+ log_driver_type = kwargs.get('type', kwargs.get('Type'))
+ config = kwargs.get('config', kwargs.get('Config')) or {}
+
if config and not isinstance(config, dict):
raise ValueError("LogConfig.config must be a dictionary")
super(LogConfig, self).__init__({
- 'Type': type_,
- 'Config': config or {}
+ 'Type': log_driver_type,
+ 'Config': config
})
@property
@@ -43,10 +39,6 @@ class LogConfig(DictType):
@type.setter
def type(self, value):
- if value not in self.types._values:
- raise ValueError("LogConfig.type must be one of {0}".format(
- ', '.join(self.types._values)
- ))
self['Type'] = value
@property