diff options
Diffstat (limited to 'cobbler')
-rw-r--r-- | cobbler/collection.py | 2 | ||||
-rw-r--r-- | cobbler/item_network.py | 2 | ||||
-rw-r--r-- | cobbler/item_system.py | 2 | ||||
-rw-r--r-- | cobbler/modules/cli_network.py | 20 |
4 files changed, 16 insertions, 10 deletions
diff --git a/cobbler/collection.py b/cobbler/collection.py index dead9fff..407513ef 100644 --- a/cobbler/collection.py +++ b/cobbler/collection.py @@ -326,6 +326,8 @@ class Collection(serializable.Serializable): match = self.api.find_repo(ref.name) elif isinstance(ref, item_image.Image): match = self.api.find_image(ref.name) + elif isinstance(ref, item_network.Network): + match = self.api.find_network(ref.name) else: raise CX("internal error, unknown object type") diff --git a/cobbler/item_network.py b/cobbler/item_network.py index 8acfa6d6..302be3a2 100644 --- a/cobbler/item_network.py +++ b/cobbler/item_network.py @@ -125,7 +125,7 @@ class Network(item.Item): if not available: raise CX(_("Address %s is not free in network %s" % (ip, self.name))) - self.used_addresses.append(ip) + self.used_addresses.append({'ip': ip, 'uid': system.uid}) print self.used_addresses self.update_free() print self.used_addresses diff --git a/cobbler/item_system.py b/cobbler/item_system.py index 8eafa2e3..dd10fc2d 100644 --- a/cobbler/item_system.py +++ b/cobbler/item_system.py @@ -436,6 +436,7 @@ class System(item.Item): if net == None: raise CX(_("Network %s does not exist" % network)) net.add_interface(self, intf) + self.config.serialize() # explicitly save the modified net def set_ip_address(self,address,interface): """ @@ -731,6 +732,7 @@ class System(item.Item): for name in ikeys: x = self.__get_interface(name) buf = buf + _("interface : %s\n") % (name) + buf = buf + _(" parent network : %s\n") % x.get("parent","") buf = buf + _(" mac address : %s\n") % x.get("mac_address","") buf = buf + _(" bonding : %s\n") % x.get("bonding","") buf = buf + _(" bonding_master : %s\n") % x.get("bonding_master","") diff --git a/cobbler/modules/cli_network.py b/cobbler/modules/cli_network.py index eb842d8c..31ab07e8 100644 --- a/cobbler/modules/cli_network.py +++ b/cobbler/modules/cli_network.py @@ -29,7 +29,7 @@ sys.path.insert(0, mod_path) from utils import _, _IP, _CIDR import cobbler.commands as commands -import cexceptions +from cexceptions import * class NetworkFunction(commands.CobblerFunction): @@ -82,6 +82,8 @@ class NetworkFunction(commands.CobblerFunction): if self.options.cidr is not None: obj.set_cidr(self.options.cidr) + else: + raise CX(_("cidr is required")) if self.options.address is not None: obj.set_address(self.options.address) @@ -107,12 +109,14 @@ class NetworkFunction(commands.CobblerFunction): if self.options.comment is not None: obj.set_comment(self.options.comment) - if 'add' in self.args: - obj.sync('add') - elif 'edit' in self.args: - obj.sync('edit') - elif 'remove' in self.args: - obj.sync('remove') + obj.update_free() + +# if 'add' in self.args: +# obj.sync('add') +# elif 'edit' in self.args: +# obj.sync('edit') +# elif 'remove' in self.args: +# obj.sync('remove') return self.object_manipulator_finish(obj, self.api.networks, self.options) @@ -132,5 +136,3 @@ def cli_functions(api): NetworkFunction(api) ] return [] - - |