def run(self): if self.args and "find" in self.args: items = self.api.find_distro(return_list=True, no_errors=True, **self.options.__dict__) for x in items: print x.name return True obj = self.object_manipulator_start(self.api.new_distro,self.api.distros) if obj is None: return True # FIXME: inplace is not handled. Do we need to retain this? if not "dumpvars" in self.args: utils.apply_options_from_fields(obj, item_distro.FIELDS, self.options) #if self.options.comment is not None: # obj.set_comment(self.options.comment) #if self.options.arch is not None: # obj.set_arch(self.options.arch) #if self.options.kernel is not None: # obj.set_kernel(self.options.kernel) #if self.options.initrd is not None: # obj.set_initrd(self.options.initrd) #if self.options.kopts is not None: # obj.set_kernel_options(self.options.kopts,self.options.inplace) #if self.options.kopts_post is not None: # obj.set_kernel_options_post(self.options.kopts_post,self.options.inplace) #if self.options.ksmeta is not None: # obj.set_ks_meta(self.options.ksmeta,self.options.inplace) #if self.options.breed is not None: # obj.set_breed(self.options.breed) #if self.options.os_version is not None: # obj.set_os_version(self.options.os_version) #if self.options.owners is not None: # obj.set_owners(self.options.owners) #if self.options.mgmt_classes is not None: # obj.set_mgmt_classes(self.options.mgmt_classes) #if self.options.template_files is not None: # obj.set_template_files(self.options.template_files,self.options.inplace) #if self.options.redhat_management_key is not None: # obj.set_redhat_management_key(self.options.redhat_management_key) #if self.options.redhat_management_server is not None: # obj.set_redhat_management_server(self.options.redhat_management_server) return self.object_manipulator_finish(obj, self.api.distros, self.options)
def run(self): if self.args and "find" in self.args: items = self.api.find_image(return_list=True, no_errors=True, **self.options.__dict__) for x in items: print x.name return True obj = self.object_manipulator_start(self.api.new_image,self.api.images) if obj is None: return True if utils.matches_args(self.args,["dumpvars"]): return self.object_manipulator_finish(obj, self.api.images, self.options) utils.apply_options_from_fields(obj, item_image.FIELDS, self.options) return self.object_manipulator_finish(obj, self.api.images, self.options)
def run(self): if self.args and "find" in self.args: items = self.api.find_network(return_list=True, no_errors=True, **self.options.__dict__) for x in items: print x.name return True obj = self.object_manipulator_start(self.api.new_network,self.api.networks) if obj is None: return True if utils.matches_args(self.args,["dumpvars"]): return self.object_manipulator_finish(obj, self.api.profiles, self.options) # FIXME: for all objects, ensure that the objects we save are completed # given that we no longer use is_valid utils.apply_options_from_fields(obj, item_network.FIELDS, self.options) return self.object_manipulator_finish(obj, self.api.networks, self.options)
def run(self): if self.args and "find" in self.args: items = self.api.find_profile(return_list=True, no_errors=True, **self.options.__dict__) for x in items: print x.name return True if utils.matches_args(self.args,["report","getks","list","remove","dumpvars"]) or not self.options.inherit: obj = self.object_manipulator_start(self.api.new_profile,self.api.profiles,subobject=False) else: obj = self.object_manipulator_start(self.api.new_profile,self.api.profiles,subobject=True) if obj is None: return True if not utils.matches_args(self.args,["dumpvars","getks"]): utils.apply_options_from_fields(obj, item_profile.FIELDS, self.options) return self.object_manipulator_finish(obj, self.api.profiles, self.options)
def run(self): if self.args and "find" in self.args: items = self.api.find_system(return_list=True, no_errors=True, **self.options.__dict__) for x in items: print x.name return True obj = self.object_manipulator_start(self.api.new_system, self.api.systems) if obj is None: return True if utils.matches_args(self.args, ["dumpvars"]): return self.object_manipulator_finish(obj, self.api.profiles, self.options) if utils.matches_args(self.args, ["getks"]): return self.object_manipulator_finish(obj, self.api.profiles, self.options) # if we haven't said what interface we are editing, it's eth0. if self.options.interface: my_interface = self.options.interface else: my_interface = "eth0" utils.apply_options_from_fields(obj, item_system.FIELDS, self.options) # FIXME: have to handle interfaces too # if self.options.dns_name is not None: # obj.set_dns_name(self.options.dns_name, my_interface) # if self.options.mac is not None: # if self.options.mac.lower() == 'random': # obj.set_mac_address(get_random_mac(self.api), my_interface) # else: # obj.set_mac_address(self.options.mac, my_interface) # if self.options.ip is not None: # obj.set_ip_address(self.options.ip, my_interface) # if self.options.subnet is not None: # obj.set_subnet(self.options.subnet, my_interface) # if self.options.dhcp_tag is not None: # obj.set_dhcp_tag(self.options.dhcp_tag, my_interface) # if self.options.virt_bridge is not None: # obj.set_virt_bridge(self.options.virt_bridge, my_interface) # if self.options.static is not None: # obj.set_static(self.options.static, my_interface) # if self.options.bonding is not None: # obj.set_bonding(self.options.bonding, my_interface) # if self.options.bonding_master is not None: # obj.set_bonding_master(self.options.bonding_master, my_interface) # if self.options.bonding_opts is not None: # obj.set_bonding_opts(self.options.bonding_opts, my_interface) # if self.options.static_routes is not None: # obj.set_static_routes(self.options.static_routes, my_interface) # if self.options.network is not None: # obj.set_network(self.options.network, my_interface) # FIXME: delete is also special # if self.options.delete_interface is not None: # success = obj.delete_interface(self.options.delete_interface) # if not success: # raise CX(_('interface does not exist or is the default interface (%s)') % self.options.delete_interface) # if self.options.hostname is not None: # obj.set_hostname(self.options.hostname) # if self.options.gateway is not None: # obj.set_gateway(self.options.gateway) # if self.options.owners is not None: # obj.set_owners(self.options.owners) # if self.options.mgmt_classes is not None: # obj.set_mgmt_classes(self.options.mgmt_classes) # if self.options.template_files is not None: # obj.set_template_files(self.options.template_files,self.options.inplace) # if self.options.name_servers is not None: # obj.set_name_servers(self.options.name_servers) # if self.options.name_servers_search is not None: # obj.set_name_servers_search(self.options.name_servers_search) # if self.options.redhat_management_key is not None: # obj.set_redhat_management_key(self.options.redhat_management_key) # if self.options.redhat_management_server is not None: # obj.set_redhat_management_server(self.options.redhat_management_server) rc = self.object_manipulator_finish(obj, self.api.systems, self.options) return rc