Unify constants usage in taskflow flows

a number of the flows use static strings for names in task flow
storage instead of using constants. This patch unified constants usage.

Closes-Bug: #1461679
Change-Id: I37edac69be64be39b4560b3b26460415144ac3bb
This commit is contained in:
Bertrand Lallau 2015-09-10 22:17:23 +02:00
parent b821819cbb
commit b3776a4110
7 changed files with 50 additions and 40 deletions

View File

@ -80,10 +80,13 @@ AMPHORA_ID = 'amphora_id'
FAILOVER_AMPHORA_ID = 'failover_amphora_id'
DELTA = 'delta'
DELTAS = 'deltas'
HEALTH_MON = 'health_mon'
LISTENER = 'listener'
LISTENERS = 'listeners'
LOADBALANCER = 'loadbalancer'
LOADBALANCER_ID = 'loadbalancer_id'
MEMBER = 'member'
MEMBER_ID = 'member_id'
COMPUTE_ID = 'compute_id'
COMPUTE_OBJ = 'compute_obj'
AMPS_DATA = 'amps_data'
@ -93,6 +96,7 @@ POOL = 'pool'
POOL_ID = 'pool_id'
OBJECT = 'object'
SERVER_PEM = 'server_pem'
UPDATE_DICT = 'update_dict'
VIP_NETWORK = 'vip_network'
AMPHORAE_NETWORK_CONFIG = 'amphorae_network_config'
ADDED_PORTS = 'added_ports'

View File

@ -147,12 +147,12 @@ class AmphoraFlows(object):
delete_amphora_flow = linear_flow.Flow(constants.DELETE_AMPHORA_FLOW)
delete_amphora_flow.add(database_tasks.
MarkAmphoraPendingDeleteInDB(
requires='amphora'))
requires=constants.AMPHORA))
delete_amphora_flow.add(compute_tasks.ComputeDelete(
requires='amphora'))
requires=constants.AMPHORA))
delete_amphora_flow.add(database_tasks.
MarkAmphoraDeletedInDB(
requires='amphora'))
requires=constants.AMPHORA))
return delete_amphora_flow
def get_failover_flow(self):

View File

@ -30,9 +30,9 @@ class HealthMonitorFlows(object):
"""
create_hm_flow = linear_flow.Flow(constants.CREATE_HEALTH_MONITOR_FLOW)
create_hm_flow.add(amphora_driver_tasks.ListenerUpdate(
requires=['listener', 'vip']))
requires=[constants.LISTENER, constants.VIP]))
create_hm_flow.add(database_tasks.MarkLBAndListenerActiveInDB(
requires=['loadbalancer', 'listener']))
requires=[constants.LOADBALANCER, constants.LISTENER]))
return create_hm_flow
@ -43,13 +43,14 @@ class HealthMonitorFlows(object):
"""
delete_hm_flow = linear_flow.Flow(constants.DELETE_HEALTH_MONITOR_FLOW)
delete_hm_flow.add(model_tasks.
DeleteModelObject(rebind={'object': 'health_mon'}))
DeleteModelObject(rebind={'object':
constants.HEALTH_MON}))
delete_hm_flow.add(amphora_driver_tasks.ListenerUpdate(
requires=['listener', 'vip']))
requires=[constants.LISTENER, constants.VIP]))
delete_hm_flow.add(database_tasks.DeleteHealthMonitorInDB(
requires='pool_id'))
requires=constants.POOL_ID))
delete_hm_flow.add(database_tasks.MarkLBAndListenerActiveInDB(
requires=['loadbalancer', 'listener']))
requires=[constants.LOADBALANCER, constants.LISTENER]))
return delete_hm_flow
@ -61,13 +62,13 @@ class HealthMonitorFlows(object):
update_hm_flow = linear_flow.Flow(constants.UPDATE_HEALTH_MONITOR_FLOW)
update_hm_flow.add(model_tasks.
UpdateAttributes(
rebind={'object': 'health_mon'},
requires=['update_dict']))
rebind={'object': constants.HEALTH_MON},
requires=[constants.UPDATE_DICT]))
update_hm_flow.add(amphora_driver_tasks.ListenerUpdate(
requires=['listener', 'vip']))
requires=[constants.LISTENER, constants.VIP]))
update_hm_flow.add(database_tasks.UpdateHealthMonInDB(
requires=['health_mon', 'update_dict']))
requires=[constants.HEALTH_MON, constants.UPDATE_DICT]))
update_hm_flow.add(database_tasks.MarkLBAndListenerActiveInDB(
requires=['loadbalancer', 'listener']))
requires=[constants.LOADBALANCER, constants.LISTENER]))
return update_hm_flow

View File

@ -31,12 +31,13 @@ class ListenerFlows(object):
"""
create_listener_flow = linear_flow.Flow(constants.CREATE_LISTENER_FLOW)
create_listener_flow.add(amphora_driver_tasks.ListenerUpdate(
requires=['listener', 'vip']))
requires=[constants.LISTENER, constants.VIP]))
create_listener_flow.add(network_tasks.UpdateVIP(
requires=constants.LOADBALANCER))
create_listener_flow.add(database_tasks.
MarkLBAndListenerActiveInDB(
requires=['loadbalancer', 'listener']))
requires=[constants.LOADBALANCER,
constants.LISTENER]))
return create_listener_flow
@ -65,14 +66,15 @@ class ListenerFlows(object):
update_listener_flow = linear_flow.Flow(constants.UPDATE_LISTENER_FLOW)
update_listener_flow.add(model_tasks.
UpdateAttributes(
rebind={'object': 'listener'},
requires=['update_dict']))
rebind={'object': constants.LISTENER},
requires=[constants.UPDATE_DICT]))
update_listener_flow.add(amphora_driver_tasks.ListenerUpdate(
requires=['listener', 'vip']))
requires=[constants.LISTENER, constants.VIP]))
update_listener_flow.add(database_tasks.UpdateListenerInDB(
requires=['listener', 'update_dict']))
requires=[constants.LISTENER, constants.UPDATE_DICT]))
update_listener_flow.add(database_tasks.
MarkLBAndListenerActiveInDB(
requires=['loadbalancer', 'listener']))
requires=[constants.LOADBALANCER,
constants.LISTENER]))
return update_listener_flow

View File

@ -119,10 +119,10 @@ class LoadBalancerFlows(object):
"""
update_LB_flow = linear_flow.Flow(constants.UPDATE_LOADBALANCER_FLOW)
update_LB_flow.add(controller_tasks.DisableEnableLB(
requires='loadbalancer'))
requires=constants.LOADBALANCER))
update_LB_flow.add(database_tasks.UpdateLoadbalancerInDB(
requires=['loadbalancer', 'update_dict']))
requires=[constants.LOADBALANCER, constants.UPDATE_DICT]))
update_LB_flow.add(database_tasks.MarkLBActiveInDB(
requires='loadbalancer'))
requires=constants.LOADBALANCER))
return update_LB_flow

View File

@ -54,14 +54,16 @@ class MemberFlows(object):
"""
delete_member_flow = linear_flow.Flow(constants.DELETE_MEMBER_FLOW)
delete_member_flow.add(model_tasks.
DeleteModelObject(rebind={'object': 'member'}))
DeleteModelObject(rebind={'object':
constants.MEMBER}))
delete_member_flow.add(amphora_driver_tasks.ListenerUpdate(
requires=['listener', 'vip']))
requires=[constants.LISTENER, constants.VIP]))
delete_member_flow.add(database_tasks.DeleteMemberInDB(
requires='member_id'))
requires=constants.MEMBER_ID))
delete_member_flow.add(database_tasks.
MarkLBAndListenerActiveInDB(
requires=['loadbalancer', 'listener']))
requires=[constants.LOADBALANCER,
constants.LISTENER]))
return delete_member_flow
@ -73,14 +75,15 @@ class MemberFlows(object):
update_member_flow = linear_flow.Flow(constants.UPDATE_MEMBER_FLOW)
update_member_flow.add(model_tasks.
UpdateAttributes(
rebind={'object': 'member'},
requires=['update_dict']))
rebind={'object': constants.MEMBER},
requires=[constants.UPDATE_DICT]))
update_member_flow.add(amphora_driver_tasks.ListenerUpdate(
requires=['listener', 'vip']))
requires=[constants.LISTENER, constants.VIP]))
update_member_flow.add(database_tasks.UpdateMemberInDB(
requires=['member', 'update_dict']))
requires=[constants.MEMBER, constants.UPDATE_DICT]))
update_member_flow.add(database_tasks.
MarkLBAndListenerActiveInDB(
requires=['loadbalancer', 'listener']))
requires=[constants.LOADBALANCER,
constants.LISTENER]))
return update_member_flow

View File

@ -30,9 +30,9 @@ class PoolFlows(object):
"""
create_pool_flow = linear_flow.Flow(constants.CREATE_POOL_FLOW)
create_pool_flow.add(amphora_driver_tasks.ListenerUpdate(
requires=['listener', 'vip']))
requires=[constants.LISTENER, constants.VIP]))
create_pool_flow.add(database_tasks.MarkLBAndListenerActiveInDB(
requires=['loadbalancer', 'listener']))
requires=[constants.LOADBALANCER, constants.LISTENER]))
return create_pool_flow
@ -61,13 +61,13 @@ class PoolFlows(object):
update_pool_flow = linear_flow.Flow(constants.UPDATE_POOL_FLOW)
update_pool_flow.add(model_tasks.
UpdateAttributes(
rebind={'object': 'pool'},
requires=['update_dict']))
rebind={'object': constants.POOL},
requires=[constants.UPDATE_DICT]))
update_pool_flow.add(amphora_driver_tasks.ListenerUpdate(
requires=['listener', 'vip']))
requires=[constants.LISTENER, constants.VIP]))
update_pool_flow.add(database_tasks.UpdatePoolInDB(
requires=['pool', 'update_dict']))
requires=[constants.POOL, constants.UPDATE_DICT]))
update_pool_flow.add(database_tasks.MarkLBAndListenerActiveInDB(
requires=['loadbalancer', 'listener']))
requires=[constants.LOADBALANCER, constants.LISTENER]))
return update_pool_flow