Skip to content

Commit

Permalink
Remove unused prompt attribute
Browse files Browse the repository at this point in the history
The prompt attribute is like MoreInfo Mac-specific and not used by
Flatcar (see
https://github.com/google/omaha/blob/main/doc/ServerProtocolV2.md).
Remove the unused prompt attribute (on Mac it was there to display a
prompt UI before installing an update).
  • Loading branch information
pothos committed Jul 5, 2023
1 parent a4ea93f commit 4c11728
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 18 deletions.
3 changes: 1 addition & 2 deletions src/update_engine/omaha_request_action.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ static const char* kTagMaxFailureCountPerUrl = "MaxFailureCountPerUrl";
// Deprecated: "MetadataSize"
// Deprecated: "MoreInfo"; See https://github.com/google/omaha/blob/main/doc/ServerProtocolV2.md
// "And on the Mac, the Google Software Update Agent supports the following optional attributes": Prompt, MoreInfo
// Deprecated: "Prompt"
static const char* kTagNeedsAdmin = "needsadmin";
static const char* kTagPrompt = "Prompt";
static const char* kTagSha256 = "sha256";

namespace {
Expand Down Expand Up @@ -593,7 +593,6 @@ bool OmahaRequestAction::ParseParams(xmlDoc* doc,
// Get the optional properties one by one.
output_object->needs_admin =
XmlGetProperty(pie_action_node, kTagNeedsAdmin) == "true";
output_object->prompt = XmlGetProperty(pie_action_node, kTagPrompt) == "true";

string max = XmlGetProperty(pie_action_node, kTagMaxFailureCountPerUrl);
if (!strings::StringToUint(max, &output_object->max_failure_count_per_url))
Expand Down
11 changes: 0 additions & 11 deletions src/update_engine/omaha_request_action_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ string GetNoUpdateResponse(const string& app_id) {

string GetUpdateResponse2(const string& app_id,
const string& display_version,
const string& prompt,
const string& codebase,
const string& filename,
const string& hash,
Expand All @@ -86,7 +85,6 @@ string GetUpdateResponse2(const string& app_id,
"<packages><package hash=\"not-used\" name=\"" + filename + "\" "
"size=\"" + size + "\"/></packages>"
"<actions><action event=\"postinstall\" "
"Prompt=\"" + prompt + "\" "
"IsDelta=\"true\" "
"IsDeltaPayload=\"true\" "
"sha256=\"" + hash + "\" "
Expand All @@ -98,15 +96,13 @@ string GetUpdateResponse2(const string& app_id,

string GetUpdateResponse(const string& app_id,
const string& display_version,
const string& prompt,
const string& codebase,
const string& filename,
const string& hash,
const string& needsadmin,
const string& size) {
return GetUpdateResponse2(app_id,
display_version,
prompt,
codebase,
filename,
hash,
Expand Down Expand Up @@ -208,7 +204,6 @@ TEST(OmahaRequestActionTest, ValidUpdateTest) {
GetDefaultTestParams(),
GetUpdateResponse(OmahaRequestParams::kAppId,
"1.2.3.4", // version
"true", // prompt
"http://code/base/", // dl url
"file.signed", // file name
"HASH1234=", // checksum
Expand All @@ -226,7 +221,6 @@ TEST(OmahaRequestActionTest, ValidUpdateTest) {
EXPECT_EQ("HASH1234=", response.hash);
EXPECT_EQ(123, response.size);
EXPECT_FALSE(response.needs_admin);
EXPECT_TRUE(response.prompt);
}

TEST(OmahaRequestActionTest, NoOutputPipeTest) {
Expand Down Expand Up @@ -343,7 +337,6 @@ TEST(OmahaRequestActionTest, MissingFieldTest) {
"<packages><package hash=\"not-used\" name=\"f\" "
"size=\"587\"/></packages>"
"<actions><action event=\"postinstall\" "
"Prompt=\"false\" "
"IsDelta=\"true\" "
"IsDeltaPayload=\"false\" "
"sha256=\"lkq34j5345\" "
Expand All @@ -366,7 +359,6 @@ TEST(OmahaRequestActionTest, MissingFieldTest) {
EXPECT_EQ("lkq34j5345", response.hash);
EXPECT_EQ(587, response.size);
EXPECT_TRUE(response.needs_admin);
EXPECT_FALSE(response.prompt);
}

TEST(OmahaRequestActionTest, ConcatUrlSlashTest) {
Expand All @@ -381,7 +373,6 @@ TEST(OmahaRequestActionTest, ConcatUrlSlashTest) {
"<packages><package hash=\"not-used\" name=\"f\" "
"size=\"587\"/></packages>"
"<actions><action event=\"postinstall\" "
"Prompt=\"false\" "
"IsDelta=\"true\" "
"IsDeltaPayload=\"false\" "
"sha256=\"lkq34j5345\" "
Expand Down Expand Up @@ -496,7 +487,6 @@ TEST(OmahaRequestActionTest, XmlDecodeTest) {
GetDefaultTestParams(),
GetUpdateResponse(OmahaRequestParams::kAppId,
"1.2.3.4", // version
"true", // prompt
"testthe&amp;codebase/", // dl url
"file.signed", // file name
"HASH1234=", // checksum
Expand All @@ -518,7 +508,6 @@ TEST(OmahaRequestActionTest, ParseIntTest) {
GetDefaultTestParams(),
GetUpdateResponse(OmahaRequestParams::kAppId,
"1.2.3.4", // version
"true", // prompt
"thecodebase/", // dl url
"file.signed", // file name
"HASH1234=", // checksum
Expand Down
2 changes: 0 additions & 2 deletions src/update_engine/omaha_response.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ struct OmahaResponse {
size(0),
max_failure_count_per_url(0),
needs_admin(false),
prompt(false),
is_delta_payload(false),
disable_payload_backoff(false) {}

Expand All @@ -47,7 +46,6 @@ struct OmahaResponse {
// Omaha Response attribute, if ever we need to fine tune the behavior.
uint32_t max_failure_count_per_url;
bool needs_admin;
bool prompt;

// True if the payload described in this response is a delta payload.
// False if it's a full payload.
Expand Down
3 changes: 0 additions & 3 deletions src/update_engine/omaha_response_handler_action_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ TEST_F(OmahaResponseHandlerActionTest, SimpleTest) {
in.hash = "HASH+";
in.size = 12;
in.needs_admin = true;
in.prompt = false;
InstallPlan install_plan;
EXPECT_TRUE(DoTest(in, "/dev/sda3", &install_plan));
EXPECT_EQ(in.payload_urls[0], install_plan.download_url);
Expand All @@ -104,7 +103,6 @@ TEST_F(OmahaResponseHandlerActionTest, SimpleTest) {
in.hash = "HASHj+";
in.size = 12;
in.needs_admin = true;
in.prompt = true;
InstallPlan install_plan;
EXPECT_TRUE(DoTest(in, "/dev/sda4", &install_plan));
EXPECT_EQ(in.payload_urls[0], install_plan.download_url);
Expand All @@ -120,7 +118,6 @@ TEST_F(OmahaResponseHandlerActionTest, SimpleTest) {
in.hash = "HASHj+";
in.size = 12;
in.needs_admin = true;
in.prompt = true;
InstallPlan install_plan;
EXPECT_TRUE(DoTest(in, "/dev/sda3", &install_plan));
EXPECT_EQ(in.payload_urls[0], install_plan.download_url);
Expand Down

0 comments on commit 4c11728

Please sign in to comment.