'Process object-based commands such as "distro add" or "profile rename"'

def object_command(self, object_type, object_action):

    task_id = (-1)
    settings = self.remote.get_settings()
    fields = self.get_fields(object_type)
    network_interface_fields = None
    if (object_type == 'system'):
        network_interface_fields = item_system.NETWORK_INTERFACE_FIELDS
    if (object_action in ['add', 'edit', 'copy', 'rename', 'find', 'remove']):
        add_options_from_fields(object_type, self.parser, fields, network_interface_fields, settings, object_action)
    elif (object_action in ['list']):
        pass
    elif (object_action not in ('reload', 'update')):
        self.parser.add_option('--name', dest='name', help='name    of    object')
    elif (object_action == 'reload'):
        self.parser.add_option('--filename', dest='filename', help='filename    to    load    data    from')
    (options, args) = self.parser.parse_args()
    if (object_action == 'report'):
        if (options.name is not None):
            report_item(self.remote, object_type, None, options.name)
        else:
            report_items(self.remote, object_type)
    elif (object_action == 'list'):
        list_items(self.remote, object_type)
    elif (object_action == 'find'):
        items = self.remote.find_items(object_type, utils.strip_none(vars(options), omit_none=True), 'name', False)
        for item in items:
            print item
    elif (object_action in OBJECT_ACTIONS):
        if ((opt(options, 'name') == '') and (object_action not in ('reload', 'update'))):
            print '--name    is    required'
            sys.exit(1)
        if (object_action in ['add', 'edit', 'copy', 'rename', 'remove']):
            try:
                if (object_type == 'setting'):
                    settings = self.remote.get_settings()
                    if (options.value is None):
                        raise RuntimeError('You    must    specify    a    --value    when    editing    a    setting')
                    elif (not settings.get('allow_dynamic_settings', False)):
                        raise RuntimeError('Dynamic    settings    changes    are    not    enabled.    Change    the    allow_dynamic_settings    to    1    and    restart    cobblerd    to    enable    dynamic    settings    changes')
                    elif (options.name == 'allow_dynamic_settings'):
                        raise RuntimeError('Cannot    modify    that    setting    live')
                    elif self.remote.modify_setting(options.name, options.value, self.token):
                        raise RuntimeError('Changing    the    setting    failed')
                else:
                    self.remote.xapi_object_edit(object_type, options.name, object_action, utils.strip_none(vars(options), omit_none=True), self.token)
            except xmlrpclib.Fault as err:
                (etype, emsg) = err.faultString.split(':', 1)
                print ('exception    on    server:    %s' % emsg)
                sys.exit(1)
            except RuntimeError as err:
                print err.args[0]
                sys.exit(1)
        elif (object_action == 'get-autoinstall'):
            if (object_type == 'profile'):
                data = self.remote.generate_profile_autoinstall(options.name)
            elif (object_type == 'system'):
                data = self.remote.generate_system_autoinstall(options.name)
            print data
        elif (object_action == 'dumpvars'):
            if (object_type == 'profile'):
                data = self.remote.get_blended_data(options.name, '')
            elif (object_type == 'system'):
                data = self.remote.get_blended_data('', options.name)
            keys = data.keys()
            keys.sort()
            for x in keys:
                print ('%s:    %s' % (x, data[x]))
        elif (object_action in ['poweron', 'poweroff', 'powerstatus', 'reboot']):
            power = {}
            power['power'] = object_action.replace('power', '')
            power['systems'] = [options.name]
            task_id = self.remote.background_power_system(power, self.token)
        elif (object_action == 'update'):
            task_id = self.remote.background_signature_update(utils.strip_none(vars(options), omit_none=True), self.token)
        elif (object_action == 'reload'):
            filename = opt(options, 'filename', '/var/lib/cobbler/distro_signatures.json')
            try:
                utils.load_signatures(filename, cache=True)
            except:
                print ('There    was    an    error    loading    the    signature    data    in    %s.' % filename)
                print "Please    check    the    JSON    file    or    run    'cobbler    signature    update'."
                return
            else:
                print 'Signatures    were    successfully    loaded'
        else:
            raise exceptions.NotImplementedError()
    else:
        raise exceptions.NotImplementedError()
    if (task_id != (-1)):
        self.print_task(task_id)
        self.follow_task(task_id)
