diff --git a/maintenance_windows_bulk_operations/create_recurring_maintenance_windows.py b/maintenance_windows_bulk_operations/create_recurring_maintenance_windows.py index a3e2fb8..ddb17fe 100755 --- a/maintenance_windows_bulk_operations/create_recurring_maintenance_windows.py +++ b/maintenance_windows_bulk_operations/create_recurring_maintenance_windows.py @@ -36,8 +36,9 @@ def create_recurring_maintenance_windows(args): if e.response is not None: msg += "HTTP %d: %s"%(e.response.status_code, e.response.text) print(msg) - print("(Note: no maintenance windows actually created because -n/--dry-run " - "was given)") + if args.dry_run: + print("(Note: no maintenance windows actually created because -n/--dry-run " + "was given)") def main(): desc = "Create a series of recurring maintenance windows." ap = argparse.ArgumentParser(description=desc) diff --git a/maintenance_windows_bulk_operations/remove_all_future_maintenance_windows.py b/maintenance_windows_bulk_operations/remove_all_future_maintenance_windows.py index 9919f2a..5d1b944 100755 --- a/maintenance_windows_bulk_operations/remove_all_future_maintenance_windows.py +++ b/maintenance_windows_bulk_operations/remove_all_future_maintenance_windows.py @@ -6,15 +6,15 @@ def remove_all_future_maintenance_windows(args): session = pdpyras.APISession(args.api_key) - progress_printer = lambda o, i, n: (print("Deleting %d/%d: %s"%( - i, n, o['summary'] + progress_printer = lambda o, i, n: (print("Deleting %d: %s starting %s"%( + i, o['summary'], o['start_time'] ))) mw_params = {"filter":"future"} if len(args.service_ids): mw_params['service_ids[]'] = args.service_ids for mw in session.iter_all("maintenance_windows", - item_hook=progress_printer, params=mw_params, total=True): + item_hook=progress_printer, params=mw_params, total=False): if args.dry_run: continue try: diff --git a/maintenance_windows_bulk_operations/requirements.txt b/maintenance_windows_bulk_operations/requirements.txt index 5b1e11c..50983a8 100644 --- a/maintenance_windows_bulk_operations/requirements.txt +++ b/maintenance_windows_bulk_operations/requirements.txt @@ -1 +1,2 @@ pdpyras >= 2.1.0 +python-dateutil