#67 copr edit-package-tito nulls out fields not edited
Closed 4 years ago Opened 4 years ago by brianjmurrell.

If I have a project defined as:

{
        "copr_id": 14105,
        "enable_net": false,
        "id": 218288,
        "name": "django-picklefield",
        "old_status": null,
        "source_json": "{\"tito_test\": false, \"git_dir\": \"django-picklefield\", \"git_url\": \"https://github.com/intel-hpdd/manager-for-lustre-dependencies.git\", \"git_branch\": \"\"}",
        "source_type": "git_and_tito",
        "webhook_rebuild": true
}

and I run copr edit-package-tito --name django-picklefield --git-url https://github.com/intel-hpdd/manager-for-lustre-dependencies.git --git-branch master manager-for-lustre on it, it (a) requires the --git-url (which is should not as that property already exists) and (b) touches more than just the git branch property (see the webhook_rebuild property). Here is the resulting package configuration:

{
        "copr_id": 14105,
        "enable_net": false,
        "id": 218288,
        "name": "django-picklefield",
        "old_status": null,
        "source_json": "{\"tito_test\": false, \"git_dir\": \"\", \"git_url\": \"https://github.com/intel-hpdd/manager-for-lustre-dependencies.git\", \"git_branch\": \"master\"}",
        "source_type": "git_and_tito",
        "webhook_rebuild": false
}

Notice how much of that package's properties were changed by an edit of just one field!


Metadata Update from @clime:
- Issue assigned to clime

4 years ago

The title of this issue says: "copr edit-package-tito nulls out fields not edited" but I cannot see anything like that in the provided example.

What I can see though is that the webhook_rebuild property was changed (from True to False) when it should not have been. I'll look into it. Thank you!

As for required/non-required property, well, it's comes from how code works. It does not actually consider what has already been set and what has not. I mean, it would probably be possible but maybe a little bit complicated.

The webhook_rebuild reset is now fixed in https://pagure.io/copr/copr/c/a547d69e514249d7b17a4f5e192042613235e556?branch=master.

However, this problem remains e.g. for git-dir switch and in general for all switches that specify source_json field of a package (you will see it if you do copr-cli get-package somecopr --name somepackage). You need to specify them all when editing a package, their current values are not taken into account when you edit a package. I am not sure if these properties are also subject of this issue as the example shows change only on webhook_rebuild property.

Feel free to reopen or file a new issue against the interface regarding the 'source_json' attributes.

Metadata Update from @clime:
- Issue status updated to: Closed (was: Open)

4 years ago

Login to comment on this ticket.

Metadata