Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not fail with 'conan remove -r remote -p' if there are no packages in the remote #7338

Merged
merged 10 commits into from Jul 15, 2020

Conversation

jgsogo
Copy link
Member

@jgsogo jgsogo commented Jul 10, 2020

Changelog: Bugfix: Do not fail for conan remove -r remote -p when there are no packages in the remote.
Docs: omit

Check there are no packages before trying to remove the package folder in the server. It prevents a 404 error.

close #7332

#REVISIONS: 1

@jgsogo jgsogo self-assigned this Jul 10, 2020
@jgsogo jgsogo marked this pull request as ready for review Jul 10, 2020
@jgsogo jgsogo requested a review from czoido Jul 10, 2020
@jgsogo jgsogo removed their assignment Jul 10, 2020
@jgsogo jgsogo added this to the 1.28 milestone Jul 10, 2020
czoido
czoido approved these changes Jul 13, 2020
conans/client/rest/rest_client_v1.py Outdated Show resolved Hide resolved
conans/client/rest/rest_client_v2.py Outdated Show resolved Hide resolved
@jgsogo
Copy link
Member Author

@jgsogo jgsogo commented Jul 13, 2020

Ok, I'll use this other approach, but I don't think it is something to fix in the server: the API is REST-based and we request a DELETE on a resource that doesn't exist, 404 is expected.

@memsharded
Copy link
Member

@memsharded memsharded commented Jul 13, 2020

Ok, I'll use this other approach, but I don't think it is something to fix in the server: the API is REST-based and we request a DELETE on a resource that doesn't exist, 404 is expected.

Yes you are right, it is true that in Api V2 it is a DELETE over ref/revision/packages path. It was not this way in Api V1.
So I agree. For me, the correct scenario would be that the 404 error is able to return the difference: it errors because the packages folder is not there, or it is failing because the package recipe is not there at all. There it would be possible for the client to act accordingly, raise RecipeNotFound or pass without raising. As this change requires too much work for little value, yes, please at least change the implementation to do the search() only for the failing 404 case.

Copy link
Member

@memsharded memsharded left a comment

Please change the impl so it only does search_packages for 404 responses, after the error, not before.

Copy link
Member

@memsharded memsharded left a comment

Check the suggestion first, then merge, looking good.

conans/client/rest/rest_client_v1.py Outdated Show resolved Hide resolved
jgsogo and others added 2 commits Jul 14, 2020
@jgsogo
Copy link
Member Author

@jgsogo jgsogo commented Jul 15, 2020

  • package_ids is always a list (I'm removing the default value)
  • I'm capturing any exception from the double-check operation, it would be misleading if it propagates and it would hide the original one.

@jgsogo jgsogo requested a review from memsharded Jul 15, 2020
@memsharded memsharded merged commit deb604a into conan-io:develop Jul 15, 2020
2 checks passed
@jgsogo jgsogo deleted the fix/remove-no-packages branch Jul 15, 2020
memsharded added a commit to noizex/conan that referenced this issue Jul 21, 2020
… in the remote (conan-io#7338)

* remove only if there are packages to remove

* working on v1 too

* no need to scape an r-string

* v1 -> no revs

* if not conaninfo, search doesn't work

* propagate 404 only if there are packages for the reference

* Update conans/client/rest/rest_client_v1.py

Co-authored-by: James <james@conan.io>

* when it is not none

* package_ids is always a list. Capture unrelated errors

Co-authored-by: James <james@conan.io>
memsharded added a commit that referenced this issue Jul 21, 2020
… user (#7390)

* Only add User-Agent to headers dict if there was none provided by the user

* [cpp_info] [refact] Do not assign to 'xxxx_paths' fields (#7276)

* use get_configs instead of config

* fixing tests

* fix tests

* fix tests

* move pkg_config logic to cpp_info so everyone uses the same

* 'name' from cpp_info needs the generator it is requested for

* configs is a private dict now

* revert change in init

* add test for Conan v2 behavior

* deps_cpp_info['deps'].name warns to use get_name instead

* use cpp_info properly

* compare as lists (convert possible iterables to lists)

* set legit values in cpp_info

* readonly fields expected to be iterable (not nessessaryly lists)

* remove print statement from test

* let any iterable type in

* revert test changes

* use property 'configs' to retrieve the different configs

* check type for cpp_info/deps_cpp_info objects

* just a list

* Do not fail with 'conan remove -r remote -p' if there are no packages in the remote (#7338)

* remove only if there are packages to remove

* working on v1 too

* no need to scape an r-string

* v1 -> no revs

* if not conaninfo, search doesn't work

* propagate 404 only if there are packages for the reference

* Update conans/client/rest/rest_client_v1.py

Co-authored-by: James <james@conan.io>

* when it is not none

* package_ids is always a list. Capture unrelated errors

Co-authored-by: James <james@conan.io>

* [cpp_info] [refact] Rewrite text generator parser (#7277)

* use get_configs instead of config

* fixing tests

* fix tests

* fix tests

* move pkg_config logic to cpp_info so everyone uses the same

* 'name' from cpp_info needs the generator it is requested for

* configs is a private dict now

* revert change in init

* add test for Conan v2 behavior

* deps_cpp_info['deps'].name warns to use get_name instead

* some attributes doesn't make sense at the base level

* rewrite txt parser

* revert test changes

* use property 'configs' to retrieve the different configs

* Avoid usage of '__len__' hook

* fixing test: never root

* read names from txt serialization

* the only information that is serialized in the 'txt' generated file is the name for the txt generator

* use ordereddict to retrieve deps in order

* add test for next Conan v2

* remove commented lines

* remove unused method

* wrong behavior in py2 for it scope

* fix tests in windows

* revert single change

* relax msbuild generator to not fail in Linux (#7361)

* relax msbuild generator to not fail in Linux

* fix test

* cli 2.0: Add commands management (#7278)

* add management for commands 2.0

* refactor cli

* fail on empty docs

* rename _conan to _conan_api

* minimum required version

* add fixme for conan factory

* add discuss

* raise on not allowed formatter

* refactor weird try, except, finally pattern

* change output handling

* remove weird pattern

* minor changes

* move exception handling

* use formatters as dictonary

* minor changes

* do not allow empty remotee

* add output argument only if there are formatters

* move exit codes

* change default formatter

* add init

* conditional generators test with configure() (#7359)

* conditional generators test with configure()

* fixing test

* fixing test

* adding generators in the command line

* #7328 Add 'outdated' column in search table (#7364)

* #7328 Add 'outdated' column in search table

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* #7328 do not remove more than requested

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* #7328 Separate functional test

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* #7328 Update other test to support outdated column

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* #7364 No need for an additional test (#7373)

* implementing __contains__ for option in self.info.options (#7303)

* implementing __contains__ for option in self.info.options

* add test

* more tests

* clarified test

* changed self.info.options.whatever to raise

* improve tests

* fix tests

* Update conans/test/functional/package_id/package_id_test.py

Co-authored-by: Javier G. Sogo <jgsogo@gmail.com>

* Update conans/test/functional/package_id/package_id_test.py

Co-authored-by: Javier G. Sogo <jgsogo@gmail.com>

* fixed test

Co-authored-by: Javier G. Sogo <jgsogo@gmail.com>

* minor pep8 in conan_api.py

* contribute test

Co-authored-by: Javier G. Sogo <jgsogo@gmail.com>
Co-authored-by: James <james@conan.io>
Co-authored-by: Carlos Zoido <mrgalleta@gmail.com>
Co-authored-by: Uilian Ries <uilianries@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants