Revision 449c2d82 snf-cyclades-app/synnefo/api/management/commands/network-modify.py

b/snf-cyclades-app/synnefo/api/management/commands/network-modify.py
1
# Copyright 2012 GRNET S.A. All rights reserved.
1
# Copyright 2012-2013 GRNET S.A. All rights reserved.
2 2
#
3 3
# Redistribution and use in source and binary forms, with or
4 4
# without modification, are permitted provided that the following
......
159 159
            if value is not None:
160 160
                network.__setattr__(field, value)
161 161

  
162
        network.save()
163

  
162 164
        add_reserved_ips = options.get('add_reserved_ips')
163 165
        remove_reserved_ips = options.get('remove_reserved_ips')
164 166
        if add_reserved_ips or remove_reserved_ips:
......
167 169
            if remove_reserved_ips:
168 170
                remove_reserved_ips = remove_reserved_ips.split(",")
169 171

  
170
        for bnetwork in network.backend_networks.all():
171
            with pooled_rapi_client(bnetwork.backend) as c:
172
                c.ModifyNetwork(network=network.backend_id,
173
                                add_reserved_ips=add_reserved_ips,
174
                                remove_reserved_ips=remove_reserved_ips)
175

  
176
        network.save()
172
            for bnetwork in network.backend_networks.all():
173
                with pooled_rapi_client(bnetwork.backend) as c:
174
                    c.ModifyNetwork(network=network.backend_id,
175
                                    add_reserved_ips=add_reserved_ips,
176
                                    remove_reserved_ips=remove_reserved_ips)
177 177

  
178 178
        add_to_backend = options["add_to_backend"]
179 179
        if add_to_backend is not None:

Also available in: Unified diff