diff options
Diffstat (limited to 'cobbler')
-rw-r--r-- | cobbler/collection.py | 7 | ||||
-rw-r--r-- | cobbler/commands.py | 14 |
2 files changed, 19 insertions, 2 deletions
diff --git a/cobbler/collection.py b/cobbler/collection.py index 564a9dec..ebe51842 100644 --- a/cobbler/collection.py +++ b/cobbler/collection.py @@ -148,6 +148,13 @@ class Collection(serializable.Serializable): def copy(self,ref,newname): ref.name = newname ref.uid = self.config.generate_uid() + if ref.COLLECTION_TYPE == "system": + # this should only happen for systems + for iname in ref.interfaces.keys(): + # clear all these out to avoid DHCP/DNS conflicts + ref.set_dns_name("",iname) + ref.set_mac_address("",iname) + ref.set_ip_address("",iname) return self.add(ref,save=True,with_copy=True,with_triggers=True,with_sync=True,check_for_duplicate_names=True,check_for_duplicate_netinfo=False) def rename(self,ref,newname,with_sync=True,with_triggers=True): diff --git a/cobbler/commands.py b/cobbler/commands.py index 98a3a3a7..b20909c5 100644 --- a/cobbler/commands.py +++ b/cobbler/commands.py @@ -377,8 +377,18 @@ class CobblerFunction: if "copy" in self.args: if self.options.newname: - obj = obj.make_clone() - obj.set_name(self.options.newname) + # FIXME: this should just use the copy function! + if obj.COLLECTION_TYPE == "distro": + return self.api.copy_distro(obj, self.options.newname) + if obj.COLLECTION_TYPE == "profile": + return self.api.copy_profile(obj, self.options.newname) + if obj.COLLECTION_TYPE == "system": + return self.api.copy_system(obj, self.options.newname) + if obj.COLLECTION_TYPE == "repo": + return self.api.copy_repo(obj, self.options.newname) + if obj.COLLECTION_TYPE == "image": + return self.api.copy_image(obj, self.options.newname) + raise CX(_("internal error, don't know how to copy")) else: raise CX(_("--newname is required")) |