Exemple #1
0
    def clean_orphans(self):

        """ Find and removes orphan snapshots """

        cleaner = OrphanSnapshotCleaner()
        snaps = cleaner.fetch()

        if not snaps:
            return

        Printer.print_orphan_snapshots(snaps)

        answer = input(
            "Do you want to continue and remove {} orphan snapshots "
            "[y/N] ? : ".format(len(snaps)))
        confirm = (answer.lower() == "y")

        if confirm:
            print("Removing orphan snapshots... ")
            count = cleaner.clean(snaps)
            print("\n{0} orphan snapshots successfully removed !".format(count))
Exemple #2
0
def test_print_orphan_snapshots():
    assert Printer.print_orphan_snapshots({}) is None
    assert Printer.print_orphan_snapshots(["ami-one", "ami-two"]) is None
Exemple #3
0
def test_print_orphan_snapshots():
    assert Printer.print_orphan_snapshots({}) is None
    assert Printer.print_orphan_snapshots(["ami-one", "ami-two"]) is None