Makes Service.config_hash a property

Signed-off-by: Frank Sachsenheim <funkyfuture@riseup.net>
This commit is contained in:
Frank Sachsenheim 2015-07-25 22:48:55 +02:00
parent 227584b864
commit dd738b380b

View File

@ -343,7 +343,7 @@ class Service(object):
config_hash = None config_hash = None
try: try:
config_hash = self.config_hash() config_hash = self.config_hash
except NoSuchImageError as e: except NoSuchImageError as e:
log.debug( log.debug(
'Service %s has diverged: %s', 'Service %s has diverged: %s',
@ -468,6 +468,7 @@ class Service(object):
else: else:
numbers.add(c.number) numbers.add(c.number)
@property
def config_hash(self): def config_hash(self):
return json_hash(self.config_dict()) return json_hash(self.config_dict())
@ -585,7 +586,7 @@ class Service(object):
container_options['name'] = self.get_container_name(number, one_off) container_options['name'] = self.get_container_name(number, one_off)
if add_config_hash: if add_config_hash:
config_hash = self.config_hash() config_hash = self.config_hash
if 'labels' not in container_options: if 'labels' not in container_options:
container_options['labels'] = {} container_options['labels'] = {}
container_options['labels'][LABEL_CONFIG_HASH] = config_hash container_options['labels'][LABEL_CONFIG_HASH] = config_hash