使用ansible url模块设置bitbucket分支权限

时间:2019-01-22 13:24:50

标签: ansible

我正尝试将以下卷曲转换为可玩的游戏:

curl -u user:password -v -X POST -d @restrictions.json -H 
     "Content-Type: application/vnd.atl.bitbucket.bulk+json"  
     http://BitBucketServer/rest/branch-permissions/2.0/projects/project/repos/my-repo/restrictions
Ansible play:
  - name: Branch permission
    uri:
      url: http://172.28.200.66:7990/rest/branch-permissions/2.0/projects/V10/repos/my-repo/restrictions
      method: POST
      user: "{{username}}"
      password: "{{password}}"
      src: restrictions.json
      force_basic_auth: yes
      status_code: 400
      body_format: json

失败,并显示以下错误:

  "errors": [{
    "context": null,
    "exceptionName": "org.codehaus.jackson.map.JsonMappingException",
    "message": "Can not deserialize instance of com.atlassian.stash.internal.repository.ref.restriction.rest.RestRestrictionRequest out of START_ARRAY token\n at [Source: com.atlassian.stash.internal.web.util.web.CountingServletInputStream@3ab1a43; line: 1, column: 1]"
  }]
}, "msg": "HTTP Error 400: Bad Request",

1 个答案:

答案 0 :(得分:0)

我通过添加以下内容解决了该问题:       标头:         内容类型:“ application / vnd.atl.bitbucket.bulk + json”