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

Handling error when reference not found using conan download #5399

Merged
merged 19 commits into from Jun 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
16d2c6d
Added required = True to subparsers in order to print error message i…
czoido Apr 4, 2019
ca0d13f
Merge remote-tracking branch 'upstream/develop' into develop
czoido Apr 10, 2019
6ab6126
Merge branch 'develop' of https://github.com/conan-io/conan into develop
czoido Apr 10, 2019
028e495
sync
czoido Apr 10, 2019
4b014e0
basic concurrent upload at reference level with futures
czoido Apr 10, 2019
de66b1d
Merge branch 'develop' of https://github.com/conan-io/conan into develop
czoido Apr 15, 2019
bfa9366
Merge branch 'develop' of https://github.com/conan-io/conan into develop
czoido Apr 21, 2019
f9e3ee0
revert changes
czoido Apr 21, 2019
4a8f6ce
Merge branch 'develop' of https://github.com/conan-io/conan into develop
czoido Apr 23, 2019
052b6ff
add line
czoido Apr 23, 2019
2f999d2
Merge branch 'develop' of https://github.com/conan-io/conan into develop
czoido Jun 4, 2019
618c4a5
Merge branch 'develop' of https://github.com/conan-io/conan into develop
czoido Jun 10, 2019
3cd895b
Merge branch 'develop' of https://github.com/conan-io/conan into develop
czoido Jun 24, 2019
2b2f7c2
Merge branch 'develop' of https://github.com/conan-io/conan into develop
czoido Jun 25, 2019
276fee3
output error message when conan download tries to download
czoido Jun 25, 2019
6925d64
catch NotFoundException in correct place
czoido Jun 25, 2019
d7a19c3
re-raise NotFoundException
czoido Jun 25, 2019
3b4e358
raise RecipeNotFound exception
czoido Jun 25, 2019
cc126cd
test error is raised when the reference is not found in server
czoido Jun 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions conans/client/cmd/download.py
@@ -1,7 +1,7 @@
from conans.client.output import ScopedOutput
from conans.client.source import complete_recipe_sources
from conans.model.ref import ConanFileReference, PackageReference

from conans.errors import NotFoundException, RecipeNotFoundException

def download(ref, package_ids, remote, recipe, remote_manager,
cache, out, recorder, loader, hook_manager, remotes):
Expand All @@ -11,7 +11,11 @@ def download(ref, package_ids, remote, recipe, remote_manager,

hook_manager.execute("pre_download", reference=ref, remote=remote)

ref = remote_manager.get_recipe(ref, remote)
try:
ref = remote_manager.get_recipe(ref, remote)
except NotFoundException:
raise RecipeNotFoundException(ref)

with cache.package_layout(ref).update_metadata() as metadata:
metadata.recipe.remote = remote.name

Expand Down
9 changes: 8 additions & 1 deletion conans/test/functional/command/download_test.py
Expand Up @@ -195,4 +195,11 @@ def download_package_argument_test(self):
# Check at conanfile.py is downloaded
self.assertTrue(os.path.exists(package_layout.conanfile()))
# Check package folder created
self.assertTrue(os.path.exists(package_folder))
self.assertTrue(os.path.exists(package_folder))

def download_not_found_reference_test(self):
server = TestServer()
servers = {"default": server}
client = TurboTestClient(servers=servers, users={"default": [("lasote", "mypass")]})
client.run("download pkg/0.1@lasote/stable", assert_error=True)
self.assertIn("ERROR: Recipe not found: 'pkg/0.1@lasote/stable'", client.out)