anancarv / python-artifactory

Typed interactions with the Jfrog Artifactory REST API
MIT License
55 stars 50 forks source link

Unable to "enable xrayIndex" when creating JFrog Remote Repository #96

Closed YanboLiao closed 2 years ago

YanboLiao commented 2 years ago

Describe the bug When creating a remote repository, setting xrayIndex=True as the parameter does not take into effect.

To Reproduce I used flowing code to create a remote repo in jfrog, have set xrayIndex=True, but checked in the jfrog ui and found that "Enable Indexing In Xray" was not enabled.

remote_repo = RemoteRepository(key="test-1", url="https://registry.npmjs.org", packageType="npm", xrayIndex=True)
new_remote_repo = art.repositories.create_repo(remote_repo)

Expected behavior This parameter setting of xrayIndex should be working on the remote repos. Creating a local repository does not have this issue.

Possible Fix I have added the last line to https://github.com/anancarv/python-artifactory/blob/master/pyartifactory/models/repository.py in the Class RemoteRepository(BaseRepositoryModel):

class RemoteRepository(BaseRepositoryModel):
    """Models a remote Repository."""

    rclass: Literal[RClassEnum.remote] = RClassEnum.remote
    url: str
    username: Optional[str] = None
    ...
    nuget: Nuget = Nuget()
    xrayIndex: bool = False # line added

After added the last line, it worked.

Environment: