~veebers/juju-ci-tools/perf-initial-heatmap-details

« back to all changes in this revision

Viewing changes to winazurearm.py

  • Committer: Curtis Hovey
  • Date: 2016-05-19 16:01:41 UTC
  • mto: This revision was merged to the branch mainline in revision 1415.
  • Revision ID: curtis@canonical.com-20160519160141-cr05vv7muuv3mnm5
Updated docstring.

Show diffs side-by-side

added added

removed removed

Lines of Context:
157
157
        deleted. We know from logs that networks are are often that last
158
158
        resource to be deleted and may be delete quick enough for the test.
159
159
        A resource group with just a network is considered to be old.
 
160
 
 
161
        :param now: The datetime object that is the basis for old age.
 
162
        :param old_age: The age of the resource group to must be.
160
163
        """
161
164
        if old_age == 0:
162
165
            # In the case of O hours old, the caller is stating any resource
204
207
    """Return a list of ResourceGroupDetails.
205
208
 
206
209
    Use print_out=True to print a listing of resources.
 
210
 
 
211
    :param client: The ARMClient.
 
212
    :param glob: The glob to find matching resource groups to delete.
 
213
    :param recursive: Get the resources in the resource group?
 
214
    :param print_out: Print the found resources to STDOUT?
 
215
    :return: A list of ResourceGroupDetails
207
216
    """
208
217
    groups = []
209
218
    resource_groups = client.resource.resource_groups.list()
226
235
 
227
236
 
228
237
def delete_resources(client, glob='*', old_age=OLD_MACHINE_AGE, now=None):
229
 
    """Delete old resource groups and return the number deleted."""
 
238
    """Delete old resource groups and return the number deleted.
 
239
 
 
240
    :param client: The ARMClient.
 
241
    :param glob: The glob to find matching resource groups to delete.
 
242
    :param old_age: The age of the resource group to delete.
 
243
    :param now: The datetime object that is the basis for old age.
 
244
    """
230
245
    if not now:
231
246
        now = datetime.now(pytz.utc)
232
247
    resources = list_resources(client, glob=glob, recursive=True)
263
278
 
264
279
    Juju 1.x shows the machine's id as the instance_id.
265
280
    Juju 2.x shows the machine's name in the resource group as the instance_id.
 
281
 
 
282
    :param resources: A iterator of ResourceGroupDetails.
 
283
    :param name_id: The name or id of a VM instance to find.
 
284
    :param resource_group: The optional name of the resource group the
 
285
        VM belongs to.
 
286
    :return: A tuple of matching ResourceGroupDetails and VirtualMachine
266
287
    """
267
288
    for rgd in resources:
268
289
        for vm in rgd.vms: