now able to deprovision IPv6
This commit is contained in:
		
							
								
								
									
										28
									
								
								automonty
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								automonty
									
									
									
									
									
								
							@ -262,8 +262,6 @@ def monty_teardown( config, args, routers ):
 | 
			
		||||
 | 
			
		||||
        for addr in ip_address:
 | 
			
		||||
            ( sel, rval, hst ) = parse_comment( addr.get( 'comment', '' ) )
 | 
			
		||||
            rval[ 'teardown' ] = True
 | 
			
		||||
            comment = make_comment( sel, rval, hst )
 | 
			
		||||
            if sel == args.hostname or hst == args.hostname:
 | 
			
		||||
                if args.delete:
 | 
			
		||||
                    if rval.get( 'teardown', False ):
 | 
			
		||||
@ -278,12 +276,38 @@ def monty_teardown( config, args, routers ):
 | 
			
		||||
                        else:
 | 
			
		||||
                            print( "ignoring %s %s on %s on %s" % ( addr[ 'address' ], addr[ 'network' ], addr[ 'interface' ], name ) )
 | 
			
		||||
                else:
 | 
			
		||||
                    rval[ 'teardown' ] = True
 | 
			
		||||
                    comment = make_comment( sel, rval, hst )
 | 
			
		||||
                    if args.dry_run:
 | 
			
		||||
                        print( '/ip address set [find where interface="%s" and network="%s" and comment~"%s" ] disabled=yes comment="%s"' % ( addr[ 'interface' ], addr[ 'network' ], hst, comment ) )
 | 
			
		||||
                    else:
 | 
			
		||||
                        print( "disabling %s %s on %s on %s" % ( addr[ 'address' ], addr[ 'network' ], addr[ 'interface' ], name ) )
 | 
			
		||||
                        ip_address.update( **{ '.id': addr[ '.id' ], 'disabled': 'yes', 'comment': comment } )
 | 
			
		||||
 | 
			
		||||
        for addr in ipv6_address:
 | 
			
		||||
            ( sel, rval, hst ) = parse_comment( addr.get( 'comment', '' ) )
 | 
			
		||||
            if sel == args.hostname or hst == args.hostname:
 | 
			
		||||
                if args.delete:
 | 
			
		||||
                    if rval.get( 'teardown', False ):
 | 
			
		||||
                        if args.dry_run:
 | 
			
		||||
                            print( '/ipv6 address remove [find where interface="%s" and address="%s" and comment="%s" ]' % ( addr[ 'interface' ], addr[ 'address' ], addr.get( 'comment', '' ) ) )
 | 
			
		||||
                        else:
 | 
			
		||||
                            print( "deleting %s from %s on %s" % ( addr[ 'address' ], addr[ 'interface' ], name ) )
 | 
			
		||||
                            ipv6_address.remove( addr[ '.id' ] )
 | 
			
		||||
                    else:
 | 
			
		||||
                        if args.dry_run:
 | 
			
		||||
                            print( "# ignoring %s on %s on %s" % ( addr[ 'address' ], addr[ 'interface' ], name ) )
 | 
			
		||||
                        else:
 | 
			
		||||
                            print( "ignoring %s on %s on %s" % ( addr[ 'address' ], addr[ 'interface' ], name ) )
 | 
			
		||||
                else:
 | 
			
		||||
                    rval[ 'teardown' ] = True
 | 
			
		||||
                    comment = make_comment( sel, rval, hst )
 | 
			
		||||
                    if args.dry_run:
 | 
			
		||||
                        print( '/ipv6 address set [find where interface="%s" and address="%s" and comment="%s" ] disabled=yes comment="%s"' % ( addr[ 'interface' ], addr[ 'address' ], addr.get( 'comment', '' ), comment ) )
 | 
			
		||||
                    else:
 | 
			
		||||
                        print( "disabling %s on %s on %s" % ( addr[ 'address' ], addr[ 'interface' ], name ) )
 | 
			
		||||
                        ipv6_address.update( **{ '.id': addr[ '.id' ], 'disabled': 'yes', 'comment': comment } )
 | 
			
		||||
 | 
			
		||||
        if args.dry_run:
 | 
			
		||||
            print()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user