コード例 #1
0
ファイル: updateresconfig.py プロジェクト: heromod/migrid
    # write new proposed config file to disk
    try:
        logger.info('write to file: %s' % pending_file)
        if not write_file(resconfig, pending_file, logger):
                output_objects.append({'object_type': 'error_text',
                        'text': 'Could not write: %s' % pending_file})
                return (output_objects, returnvalues.SYSTEM_ERROR)
    except Exception, err:
        logger.error('Resource conf %s could not be written: %s' % \
                     (pending_file, err))
        output_objects.append({'object_type': 'error_text', 'text':
                               'Could not write configuration!'})
        return (output_objects, returnvalues.SYSTEM_ERROR)

    (update_status, msg) = update_resource(configuration, client_id,
                                           host_url, host_identifier,
                                           pending_file)
    if not update_status:
        output_objects.append({'object_type': 'error_text', 'text':
                               'Resource update failed: %s' % msg})
        return (output_objects, returnvalues.CLIENT_ERROR)

    output_objects.append({'object_type': 'text', 'text':
                           'Updated %s resource configuration!' % \
                           unique_resource_name})
    output_objects.append({'object_type': 'link', 'text':
                           'Manage resource', 'destination':
                           'resadmin.py?unique_resource_name=%s' % \
                           unique_resource_name
                           })
    return (output_objects, returnvalues.OK)
コード例 #2
0
ファイル: updateresconfig.py プロジェクト: ucphhpc/migrid
        if not write_file(resconfig, pending_file, logger):
            output_objects.append({
                'object_type': 'error_text',
                'text': 'Could not write: %s' % pending_file
            })
            return (output_objects, returnvalues.SYSTEM_ERROR)
    except Exception, err:
        logger.error('Resource conf %s could not be written: %s' % \
                     (pending_file, err))
        output_objects.append({
            'object_type': 'error_text',
            'text': 'Could not write configuration!'
        })
        return (output_objects, returnvalues.SYSTEM_ERROR)

    (update_status, msg) = update_resource(configuration, client_id, host_url,
                                           host_identifier, pending_file)
    if not update_status:
        output_objects.append({
            'object_type': 'error_text',
            'text': 'Resource update failed:'
        })
        output_objects.append({'object_type': 'html_form', 'text': msg})
        return (output_objects, returnvalues.CLIENT_ERROR)

    output_objects.append({'object_type': 'text', 'text':
                           'Updated %s resource configuration!' % \
                           unique_resource_name})
    output_objects.append({'object_type': 'link', 'text':
                           'Manage resource', 'destination':
                           'resadmin.py?unique_resource_name=%s' % \
                           unique_resource_name
コード例 #3
0
ファイル: reseditaction.py プロジェクト: ucphhpc/migrid
    output = ''
    try:
        logger.info('write to file: %s' % pending_file)
        write_resource_config(configuration, user_vars, pending_file)
    except Exception, err:
        logger.error('Resource conf %s could not be written: %s' %
                     (pending_file, err))
        output_objects.append({
            'object_type': 'error_text',
            'text': 'Could not write configuration!'
        })
        return False

    if not new_resource:
        (update_status,
         msg) = update_resource(configuration, client_id, user_vars["HOSTURL"],
                                user_vars["HOSTIDENTIFIER"], pending_file)
        if not update_status:
            output_objects.append({
                'object_type': 'error_text',
                'text': 'Resource update failed:'
            })
            output_objects.append({'object_type': 'html_form', 'text': msg})
            return False
        unique_resource_name = '%(HOSTURL)s.%(HOSTIDENTIFIER)s' % user_vars
        output_objects.append({
            'object_type':
            'text',
            'text':
            'Updated %s resource configuration!' % unique_resource_name
        })
        output_objects.append({
コード例 #4
0
ファイル: reseditaction.py プロジェクト: heromod/migrid
    conf_file = os.path.join(configuration.resource_home, resource_id,
                             'config.MiG')
    output = ''
    try:
        logger.info('write to file: %s' % pending_file)
        write_resource_config(configuration, user_vars, pending_file)
    except Exception, err:
        logger.error('Resource conf %s could not be written: %s' % \
                     (pending_file, err))
        output_objects.append({'object_type': 'error_text', 'text':
                               'Could not write configuration!'})
        return False

    if not new_resource:
        (update_status, msg) = update_resource(configuration, client_id,
                                               user_vars["HOSTURL"],
                                               user_vars["HOSTIDENTIFIER"],
                                               pending_file)
        if not update_status:
            output_objects.append({'object_type': 'text', 'error_text':
                               'Resource update failed: %s' % msg})
            return False
        unique_resource_name = '%(HOSTURL)s.%(HOSTIDENTIFIER)s' % user_vars
        output_objects.append({'object_type': 'text', 'text':
                               'Updated %s resource configuration!' % \
                               unique_resource_name})
        output_objects.append({'object_type': 'link',
                               'destination':
                               'resadmin.py?unique_resource_name=%s' % \
                               unique_resource_name,
                               'class': 'adminlink',
                               'title': 'Administrate resource',