2017-01-30 49 views
2

我試圖通過使用curl在Web API上全新安裝SonarQube v.5.6.4來恢復質量配置文件。SonarQube 5.6還原質量配置文件

在c:\ temp我有一個導出的「聲納方式」配置文件從運行聲納,我已經改名爲test.xml(裏面,名稱也改變了測試,使兩個配置文件「不同」)。

從C:\臨時位置,我用下面的捲曲命令:

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.

不管怎麼改變了捲曲命令(具有不同的內容-types,-F參數,@之前的文件名),我無法解決這個問題。

此外,我檢查了這看起來像這樣聲納日誌:

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版本?

在此先感謝您的任何反饋意見。

回答

2

回答我的問題是這樣的命令:

curl -v POST -u admin:admin "http://localhost:9000/api/qualityprofiles/restore" 
--form [email protected]

它看起來像我以前沒有嘗試這個組合。

的反應是200 OK:
C:

 
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
1

如果在一個目錄所有的XML備份文件,你可以用這種方法只使用一個命令來恢復所有的人>的/ R。 %1 IN(* .XML)DO curl.exe -v -X POST -u管理員:ADMIN_PASSWORD 「http://your_server:9000/sonar/api/qualityprofiles/restore」 --form備份= @%1

乾杯

馬西莫

相關問題