SonarQube 5.6恢复质量配置文件 [英] SonarQube 5.6 restore quality profile

查看:191
本文介绍了SonarQube 5.6恢复质量配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用curl使用Web API在全新安装的SonarQube v.5.6.4上恢复质量配置文件。

I am trying to restore a quality profile on a fresh installation of SonarQube v.5.6.4 over Web API using curl.

在c:\temp I从运行Sonar导出的声纳方式配置文件中,我将其重命名为test.xml(在内部,名称也更改为test,以便两个配置文件都不同)。

In c:\temp I have an exported "Sonar way" profile from running Sonar and I have renamed it to test.xml (inside, the name was also changed to test so that both profiles are "different").

在c:\temp位置,我使用了以下curl命令:

From the c:\temp location, I used the following curl command:

curl -v -X POST -u admin:admin --header "Content-Type: application/xml"
     "http://localhost:9000/api/qualityprofiles/restore" -d backup=test.xml

响应为:

500 Internal Server Error If you are the administrator of this website, 
then please read this web application's log file to find out what went wrong.

无论我如何更改curl命令(具有不同的内容类型,带有-F参数,带有@),我无法解决此问题。

No matter how I changed the curl-command (with different content-types, with -F paramter, with @ before file name), I could not manage to fix this problem.

此外,我cked Sonar日志如下所示:

Moreover, I checked Sonar logs which look like this:

2017.01.30 14:13:14 ERROR web[rails] /!\ FAILSAFE /!\  Mon Jan 30 14:13:14 +0100 2017
  Status: 500 Internal Server Error
  undefined method `name' for nil:NilClass
    C:/bin/sonarqube-5.6.4/web/WEB-INF/gems/gems/activesupport-2.3.15/lib/active_support/xml_mini/rexml.rb:29:in `merge_element!'
    C:/bin/sonarqube-5.6.4/web/WEB-INF/gems/gems/activesupport-2.3.15/lib/active_support/xml_mini/rexml.rb:18:in `parse'
    org/jruby/RubyKernel.java:2227:in `send'
    C:1:in `parse'
    C:/bin/sonarqube-5.6.4/web/WEB-INF/gems/gems/activesupport-2.3.15/lib/active_support/core_ext/hash/conversions.rb:171:in `from_xml'
    C:/bin/sonarqube-5.6.4/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/params_parser.rb:34:in `parse_formatted_parameters'
    C:/bin/sonarqube-5.6.4/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/params_parser.rb:11:in `call'
    file:/C:/bin/sonarqube-5.6.4/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/session_store.rb:70:in `context'
    C:/bin/sonarqube-5.6.4/web/WEB-INF/gems/gems/rack-1.1.6/lib/rack/session/abstract/id.rb:58:in `call'
    C:/bin/sonarqube-5.6.4/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/failsafe.rb:26:in `call'
    C:/bin/sonarqube-5.6.4/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:106:in `call'
    file:/C:/bin/sonarqube-5.6.4/lib/server/jruby-rack-1.1.13.2.jar!/rack/adapter/rails.rb:34:in `serve_rails'
    file:/C:/bin/sonarqube-5.6.4/lib/server/jruby-rack-1.1.13.2.jar!/rack/adapter/rails.rb:39:in `call'
    file:/C:/bin/sonarqube-5.6.4/lib/server/jruby-rack-1.1.13.2.jar!/rack/handler/servlet.rb:22:in `call'

5.6.4版本有问题吗?

Is there something wrong with version 5.6.4?

谢谢您的任何反馈。

推荐答案

答案我的问题是这个命令:

The answer to my problem was this command:

curl -v POST -u admin:admin "http://localhost:9000/api/qualityprofiles/restore"  
--form backup=@test.xml

似乎我以前没有尝试过这种组合。

It looks like I didn't try this combination before.

响应为200 OK:


 HTTP/1.1 100 Continue
 HTTP/1.1 200 OK
 Server: Apache-Coyote/1.1
 Set-Cookie: JSESSIONID=A20898D27A0D843EEC6ED9791CABEB49; Path=/; HttpOnly
 X-Runtime: 265
 ETag: "7cce49c3a8a16a16c8c48cc4942df042"
 Cache-Control: no-cache, no-store, must-revalidate
 X-Frame-Options: SAMEORIGIN
 X-XSS-Protection: 1; mode=block
 X-Content-Type-Options: nosniff
 Content-Type: application/json;charset=utf-8
 Content-Length: 166
 Date: Mon, 30 Jan 2017 14:19:51 GMT

这篇关于SonarQube 5.6恢复质量配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆