How to Enable UPM Safe Mode using UPM REST API

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

背景

Sometimes, it might be useful to set up the UPM to Safe Mode in your instance.

When troubleshooting your instance, some plugins can be the culprit of issues and you want to isolate that. 

While the link above explains it how to do so manually, you might want to programmatically perform this action using the UPM REST API.

Ok, but how can I write a script then?

有効化

You can run the following curl command to enable safe mode over the REST API, also expect the output following:

For Linux/Mac

$ curl -H "Content-Type:application/vnd.atl.plugins.safe.mode.flag+json" --user admin:admin -X PUT -d '{"enabled": true, "links": {}}' http://localhost:8090/rest/plugins/1.0/safe-mode

{"enabled":true,"links":{"exit-safe-mode-restore":"/rest/plugins/1.0/safe-mode?keepState=false","exit-safe-mode-keep":"/rest/plugins/1.0/safe-mode?keepState=true"}}

Windows の場合

curl -H "Content-Type:application/vnd.atl.plugins.safe.mode.flag+json" --user admin:confluence  -X PUT -d "{\"enabled\": true, \"links\": {}}" "http://localhost:8090/rest/plugins/latest/safe-mode"

 

Disable

You can run the following cURL call to disable the UPM Safe mode:

For Linux/Mac:

$ curl -H "Content-Type:application/vnd.atl.plugins.safe.mode.flag+json" --user admin:admin -X PUT -d '{"enabled": false, "links": {}}' http://localhost:8090/rest/plugins/1.0/safe-mode?keepState=true

{"enabled":false,"links":{"safe-mode":"/rest/plugins/1.0/safe-mode"}}

Windows の場合

$ curl -H "Content-Type:application/vnd.atl.plugins.safe.mode.flag+json" --user admin:admin -X PUT -d "{\"enabled\": false, \"links\": {}}" "http://localhost:8090/rest/plugins/1.0/safe-mode?keepState=true"

The value for keepState is asking if you want to keep the current state which, because you are now in Safe mode, the current state is disabled.  If you want to exit UPM Safe mode and have your plugins return to the state they were in when you entered Safe mode then you should set keepState=false

チェックマーク 

You can always check UPM status by using the call below:

$ curl -u admin:admin http://localhost:8090/rest/plugins/latest/safe-mode

{"enabled":false,"links":{"safe-mode":"/rest/plugins/1.0/safe-mode"}}

 

 

 

最終更新日 2018 年 11 月 15 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.