-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
742: launch/find: Allow using and searching for unsupported cloud images r=Saviq a=townsend2010 This uses an `--allow-unsupported` option for `launch` and `find`. Fixes #736 Co-authored-by: Chris Townsend <[email protected]>
- Loading branch information
Showing
16 changed files
with
99 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2017 Canonical, Ltd. | ||
* Copyright (C) 2017-2019 Canonical, Ltd. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -13,8 +13,6 @@ | |
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Authored by: Alberto Aguirre <[email protected]> | ||
* | ||
*/ | ||
|
||
#ifndef MULTIPASS_QUERY_H | ||
|
@@ -39,6 +37,7 @@ class Query | |
bool persistent; | ||
std::string remote_name; | ||
Type query_type; | ||
bool allow_unsupported{false}; | ||
}; | ||
} | ||
#endif // MULTIPASS_QUERY_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2017-2018 Canonical, Ltd. | ||
* Copyright (C) 2017-2019 Canonical, Ltd. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -13,8 +13,6 @@ | |
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Authored by: Alberto Aguirre <[email protected]> | ||
* | ||
*/ | ||
|
||
#include "ubuntu_image_host.h" | ||
|
@@ -108,7 +106,7 @@ mp::optional<mp::VMImageInfo> mp::UbuntuVMImageHost::info_for(const Query& query | |
|
||
if (info) | ||
{ | ||
if (!info->supported) | ||
if (!info->supported && !query.allow_unsupported) | ||
throw std::runtime_error(fmt::format("The {} release is no longer supported.", query.release)); | ||
|
||
return with_location_fully_resolved(QString::fromStdString(remote_url_from(remote_name)), *info); | ||
|
@@ -132,7 +130,7 @@ std::vector<mp::VMImageInfo> mp::UbuntuVMImageHost::all_info_for(const Query& qu | |
|
||
if (info) | ||
{ | ||
if (!info->supported) | ||
if (!info->supported && !query.allow_unsupported) | ||
throw std::runtime_error(fmt::format("The {} release is no longer supported.", query.release)); | ||
|
||
images.push_back(*info); | ||
|
@@ -143,7 +141,7 @@ std::vector<mp::VMImageInfo> mp::UbuntuVMImageHost::all_info_for(const Query& qu | |
|
||
for (const auto& entry : manifest->products) | ||
{ | ||
if (entry.id.startsWith(key) && entry.supported && | ||
if (entry.id.startsWith(key) && (entry.supported || query.allow_unsupported) && | ||
found_hashes.find(entry.id.toStdString()) == found_hashes.end()) | ||
{ | ||
images.push_back( | ||
|
@@ -177,14 +175,15 @@ mp::VMImageInfo mp::UbuntuVMImageHost::info_for_full_hash_impl(const std::string | |
return mp::VMImageInfo{{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, -1}; | ||
} | ||
|
||
std::vector<mp::VMImageInfo> mp::UbuntuVMImageHost::all_images_for(const std::string& remote_name) | ||
std::vector<mp::VMImageInfo> mp::UbuntuVMImageHost::all_images_for(const std::string& remote_name, | ||
const bool allow_unsupported) | ||
{ | ||
std::vector<mp::VMImageInfo> images; | ||
auto manifest = manifest_from(remote_name); | ||
|
||
for (const auto& entry : manifest->products) | ||
{ | ||
if (entry.supported) | ||
if (entry.supported || allow_unsupported) | ||
{ | ||
images.push_back(with_location_fully_resolved(QString::fromStdString(remote_url_from(remote_name)), entry)); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters