Esempio n. 1
0
    def handle(self, *args, **options):
        if len(args) != 1:
            raise CommandError("Please provide a port ID")

        port = common.get_port(args[0])

        pprint.pprint_port(port, stdout=self.stdout)
        self.stdout.write('\n\n')

        pprint.pprint_port_ips(port, stdout=self.stdout)
        self.stdout.write('\n\n')

        pprint.pprint_port_in_ganeti(port, stdout=self.stdout)
Esempio n. 2
0
    def handle(self, *args, **options):
        if not args:
            raise CommandError("Please provide a port ID")

        force = options['force']
        message = "ports" if len(args) > 1 else "port"
        self.confirm_deletion(force, message, args)

        for port_id in args:
            self.stdout.write("\n")
            try:
                port = common.get_port(port_id, for_update=True)

                servers.delete_port(port)

                wait = parse_bool(options["wait"])
                if port.machine is not None:
                    common.wait_server_task(port.machine, wait,
                                            stdout=self.stdout)
                else:
                    self.stdout.write("Successfully removed port %s\n" % port)
            except CommandError as e:
                self.stdout.write("Error -- %s\n" % e.message)
Esempio n. 3
0
    def handle(self, *args, **options):
        if not args:
            raise CommandError("Please provide a port ID")

        force = options['force']
        message = "ports" if len(args) > 1 else "port"
        self.confirm_deletion(force, message, args)

        for port_id in args:
            self.stdout.write("\n")
            try:
                port = common.get_port(port_id, for_update=True)

                servers.delete_port(port)

                wait = parse_bool(options["wait"])
                if port.machine is not None:
                    common.wait_server_task(port.machine,
                                            wait,
                                            stdout=self.stdout)
                else:
                    self.stdout.write("Successfully removed port %s\n" % port)
            except CommandError as e:
                self.stdout.write("Error -- %s\n" % e.message)