Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-27111

Creating Cargo Remote Repository using REST-API with a blank gitRegistryUrl will prevent Artifactory from starting up

    XMLWordPrintable

    Details

      Description

      Description: Creating Cargo Remote Repository using REST-API, by providing the follow parameter:
      "gitRegistryUrl": ""
      will create a wrong parameter at the Config Descriptor file (<git/>):

      <remoteRepository>
       <key>repo-key</key>
       <type>cargo</type>
      ...
       <git/>
      ...
       </remoteRepository>
      

       

       
      As mentioned above the 'git' parameter is empty instead of:

      <git>
      <registryUrl>https://github.com/rust-lang/crates.io-index</registryUrl> 
      </git>

      The following will prevent Artifactory from starting up, and the following errors will be shown:

      Could not load configuration due to: Failed to read object from streamjava.lang.RuntimeException: Failed to read object from stream...Caused by: javax.xml.bind.UnmarshalException: nullat javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:310)at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:578)at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:264)at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:229)at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:140)at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:108)at org.artifactory.jaxb.JaxbHelper.read(JaxbHelper.java:177)... 42 common frames omittedCaused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.b: The content of element 'git' is not complete. One of '{"REGISTRY_URL":registryUrl}' is expected.

      Steps to reproduce:
      Create Cargo Remote Repository using REST-API

      curl -XPUT -uadmin http://ARTIFACTORY_SERVER:PORT/artifactory/api/repositories/cargo-remote -H 'content-type:application/json' -d
      '{
      "rclass" : "remote",
      "packageType": "cargo",
      "description": "The remote repository public description",
      "gitRegistryUrl": "",
      "url" : "SOME_URL",
      "externalDependenciesEnabled": false
      }'

      Restart Artifactory

      Expected Behavior:
      gitRegistryUrl should be added by default or should add defensive mechanism for the property not being blank.

       Fix Of The Issue:

      Stop Artifactory
      Copy artifactory.config.latest.xml file to artifactory.config.import.xml 
      edit artifactory.config.import.xml file
      change the <git/> parameter in the file:

       

      <remoteRepository>
       <key>repo-key</key>
       <type>cargo</type>
      ...
      <git>
      <registryUrl>https://github.com/rust-lang/crates.io-index</registryUrl> 
      </git>
      ...
       </remoteRepository>
      

      Save and start Artifactory

       

        Attachments

          Activity

              People

              Assignee:
              Unassigned
              Reporter:
              stanislavk Stanislav Krot
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: