@@ -86,9 +86,32 @@ def deploy(self):
86
86
self ._deploy (service_name_prefix )
87
87
88
88
89
+ def _get_service_prefix (name , version , service_type ):
90
+ """
91
+ Gets the service prefix
92
+
93
+ :param name: Name of the application
94
+ :type name: str
95
+ :param version: Version of the application. If none, all versions are
96
+ undeployed.
97
+ :type version: str
98
+ :param service_type: Service type (e.g. 'app', 'logger' etc)
99
+ :type service_type: str
100
+ :return: Service Prefix
101
+ :rtype: str
102
+ """
103
+ if not version and not service_type :
104
+ return '%s-' % name
105
+ elif not service_type :
106
+ return '%s-%s-' % (name , version )
107
+ else :
108
+ return '%s-%s-%s@' % (name , version , service_type )
109
+
110
+
89
111
def undeploy (fleet_provider , name , version = None , service_type = None ):
90
112
"""
91
113
Un-deploys the application from the fleet cluster.
114
+
92
115
:param fleet_provider: Fleet provider for connecting to fleet cluster.
93
116
:type fleet_provider: fleet.client.fleet_base.Provider
94
117
:param name: Name of the application
@@ -98,23 +121,23 @@ def undeploy(fleet_provider, name, version=None, service_type=None):
98
121
:type version: str
99
122
:param service_type: Service type (e.g. 'app', 'logger' etc)
100
123
:type service_type: str
101
- :return: None
124
+ :return: List of fleet units (dict)
125
+ :rtype: list
102
126
"""
103
- def get_service_prefix ():
104
- if not version and not service_type :
105
- return '%s-' % name
106
- elif not service_type :
107
- return '%s-%s-' % (name , version )
108
- else :
109
- return '%s-%s-%s@' % (name , version , service_type )
110
127
111
- service_prefix = get_service_prefix ( )
128
+ service_prefix = _get_service_prefix ( name , version , service_type )
112
129
fleet_provider .destroy_units_matching (service_prefix )
113
130
114
131
132
+ def filter_units (fleet_provider , name , version = None , service_type = None ):
133
+ service_prefix = _get_service_prefix (name , version , service_type )
134
+ return fleet_provider .fetch_units_matching (service_prefix )
135
+
136
+
115
137
def status (fleet_provider , name , version , node_num , service_type = 'app' ):
116
138
"""
117
139
Gets the status for a node in cluster.
140
+
118
141
:param fleet_provider:
119
142
:param name:
120
143
:param version:
0 commit comments