Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions maintenance_windows_bulk_operations/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pdpyras >= 2.1.0
python-dateutil