Skip to content

Commit 38c2ebe

Browse files
committed
Remove unused needsadmin attribute
The needsadmin attribute is not used by Flatcar and it also wouldn't have a use case in the future. Remove it from the code base to focus on what makes sense.
1 parent 96bcb45 commit 38c2ebe

File tree

4 files changed

+1
-19
lines changed

4 files changed

+1
-19
lines changed

src/update_engine/omaha_request_action.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static const char* kTagMaxFailureCountPerUrl = "MaxFailureCountPerUrl";
4242
// Deprecated: "MoreInfo"; See https://github.com/google/omaha/blob/main/doc/ServerProtocolV2.md
4343
// "And on the Mac, the Google Software Update Agent supports the following optional attributes": Prompt, MoreInfo
4444
// Deprecated: "Prompt"
45-
static const char* kTagNeedsAdmin = "needsadmin";
45+
// Deprecated: "needsadmin"; Not used by Flatcar
4646
static const char* kTagSha256 = "sha256";
4747

4848
namespace {
@@ -591,8 +591,6 @@ bool OmahaRequestAction::ParseParams(xmlDoc* doc,
591591
}
592592

593593
// Get the optional properties one by one.
594-
output_object->needs_admin =
595-
XmlGetProperty(pie_action_node, kTagNeedsAdmin) == "true";
596594

597595
string max = XmlGetProperty(pie_action_node, kTagMaxFailureCountPerUrl);
598596
if (!strings::StringToUint(max, &output_object->max_failure_count_per_url))

src/update_engine/omaha_request_action_unittest.cc

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ string GetUpdateResponse2(const string& app_id,
7272
const string& codebase,
7373
const string& filename,
7474
const string& hash,
75-
const string& needsadmin,
7675
const string& size) {
7776
string response =
7877
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><response "
@@ -88,7 +87,6 @@ string GetUpdateResponse2(const string& app_id,
8887
"IsDelta=\"true\" "
8988
"IsDeltaPayload=\"true\" "
9089
"sha256=\"" + hash + "\" "
91-
"needsadmin=\"" + needsadmin + "\" " +
9290
"/></actions></manifest></updatecheck></app></response>";
9391
LOG(INFO) << "Response = " << response;
9492
return response;
@@ -99,14 +97,12 @@ string GetUpdateResponse(const string& app_id,
9997
const string& codebase,
10098
const string& filename,
10199
const string& hash,
102-
const string& needsadmin,
103100
const string& size) {
104101
return GetUpdateResponse2(app_id,
105102
display_version,
106103
codebase,
107104
filename,
108105
hash,
109-
needsadmin,
110106
size);
111107
}
112108
} // namespace {}
@@ -207,7 +203,6 @@ TEST(OmahaRequestActionTest, ValidUpdateTest) {
207203
"http://code/base/", // dl url
208204
"file.signed", // file name
209205
"HASH1234=", // checksum
210-
"false", // needs admin
211206
"123"), // size
212207
-1,
213208
false, // ping_only
@@ -220,7 +215,6 @@ TEST(OmahaRequestActionTest, ValidUpdateTest) {
220215
EXPECT_EQ("http://code/base/file.signed", response.payload_urls[0]);
221216
EXPECT_EQ("HASH1234=", response.hash);
222217
EXPECT_EQ(123, response.size);
223-
EXPECT_FALSE(response.needs_admin);
224218
}
225219

226220
TEST(OmahaRequestActionTest, NoOutputPipeTest) {
@@ -340,7 +334,6 @@ TEST(OmahaRequestActionTest, MissingFieldTest) {
340334
"IsDelta=\"true\" "
341335
"IsDeltaPayload=\"false\" "
342336
"sha256=\"lkq34j5345\" "
343-
"needsadmin=\"true\" "
344337
"/></actions></manifest></updatecheck></app></response>";
345338
LOG(INFO) << "Input Response = " << input_response;
346339

@@ -358,7 +351,6 @@ TEST(OmahaRequestActionTest, MissingFieldTest) {
358351
EXPECT_EQ("http://missing/field/test/f", response.payload_urls[0]);
359352
EXPECT_EQ("lkq34j5345", response.hash);
360353
EXPECT_EQ(587, response.size);
361-
EXPECT_TRUE(response.needs_admin);
362354
}
363355

364356
TEST(OmahaRequestActionTest, ConcatUrlSlashTest) {
@@ -376,7 +368,6 @@ TEST(OmahaRequestActionTest, ConcatUrlSlashTest) {
376368
"IsDelta=\"true\" "
377369
"IsDeltaPayload=\"false\" "
378370
"sha256=\"lkq34j5345\" "
379-
"needsadmin=\"true\" "
380371
"/></actions></manifest></updatecheck></app></response>";
381372
LOG(INFO) << "Input Response = " << input_response;
382373

@@ -490,7 +481,6 @@ TEST(OmahaRequestActionTest, XmlDecodeTest) {
490481
"testthe&amp;codebase/", // dl url
491482
"file.signed", // file name
492483
"HASH1234=", // checksum
493-
"false", // needs admin
494484
"123"), // size
495485
-1,
496486
false, // ping_only
@@ -511,7 +501,6 @@ TEST(OmahaRequestActionTest, ParseIntTest) {
511501
"thecodebase/", // dl url
512502
"file.signed", // file name
513503
"HASH1234=", // checksum
514-
"false", // needs admin
515504
// overflows int32:
516505
"123123123123123"), // size
517506
-1,

src/update_engine/omaha_response.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ struct OmahaResponse {
2222
poll_interval(0),
2323
size(0),
2424
max_failure_count_per_url(0),
25-
needs_admin(false),
2625
is_delta_payload(false),
2726
disable_payload_backoff(false) {}
2827

@@ -45,7 +44,6 @@ struct OmahaResponse {
4544
// next URL in the current pass. This is a configurable value from the
4645
// Omaha Response attribute, if ever we need to fine tune the behavior.
4746
uint32_t max_failure_count_per_url;
48-
bool needs_admin;
4947

5048
// True if the payload described in this response is a delta payload.
5149
// False if it's a full payload.

src/update_engine/omaha_response_handler_action_unittest.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ TEST_F(OmahaResponseHandlerActionTest, SimpleTest) {
8787
in.payload_urls.push_back("http://foo/the_update_a.b.c.d.tgz");
8888
in.hash = "HASH+";
8989
in.size = 12;
90-
in.needs_admin = true;
9190
InstallPlan install_plan;
9291
EXPECT_TRUE(DoTest(in, "/dev/sda3", &install_plan));
9392
EXPECT_EQ(in.payload_urls[0], install_plan.download_url);
@@ -102,7 +101,6 @@ TEST_F(OmahaResponseHandlerActionTest, SimpleTest) {
102101
in.payload_urls.push_back("http://foo/the_update_a.b.c.d.tgz");
103102
in.hash = "HASHj+";
104103
in.size = 12;
105-
in.needs_admin = true;
106104
InstallPlan install_plan;
107105
EXPECT_TRUE(DoTest(in, "/dev/sda4", &install_plan));
108106
EXPECT_EQ(in.payload_urls[0], install_plan.download_url);
@@ -117,7 +115,6 @@ TEST_F(OmahaResponseHandlerActionTest, SimpleTest) {
117115
in.payload_urls.push_back(kLongName);
118116
in.hash = "HASHj+";
119117
in.size = 12;
120-
in.needs_admin = true;
121118
InstallPlan install_plan;
122119
EXPECT_TRUE(DoTest(in, "/dev/sda3", &install_plan));
123120
EXPECT_EQ(in.payload_urls[0], install_plan.download_url);

0 commit comments

Comments
 (0)