Skip to content

Commit 756a149

Browse files
committed
Remove deadline attribute and file creation
The deadline attribute was used for the Chrome/Chromium browser and is not used in Flatcar (directly or through the deadline file), nor is this properly documented in Omaha. Remove the parsing of the attribute and the creation of the deadline flag file in /tmp.
1 parent ae83322 commit 756a149

6 files changed

+7
-59
lines changed

src/update_engine/omaha_request_action.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ using strings::StringPrintf;
2828
namespace chromeos_update_engine {
2929

3030
// List of custom pair tags that we interpret in the Omaha Response:
31-
static const char* kTagDeadline = "deadline";
31+
// Deprecated: "deadline"; was used for Chrome/Chromium browser
3232
static const char* kTagDisablePayloadBackoff = "DisablePayloadBackoff";
3333
// Deprecated: "DisplayVersion"
3434
// Deprecated: "IsDelta"
@@ -594,7 +594,6 @@ bool OmahaRequestAction::ParseParams(xmlDoc* doc,
594594
output_object->needs_admin =
595595
XmlGetProperty(pie_action_node, kTagNeedsAdmin) == "true";
596596
output_object->prompt = XmlGetProperty(pie_action_node, kTagPrompt) == "true";
597-
output_object->deadline = XmlGetProperty(pie_action_node, kTagDeadline);
598597

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

src/update_engine/omaha_request_action_unittest.cc

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ string GetUpdateResponse2(const string& app_id,
7575
const string& filename,
7676
const string& hash,
7777
const string& needsadmin,
78-
const string& size,
79-
const string& deadline) {
78+
const string& size) {
8079
string response =
8180
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><response "
8281
"protocol=\"3.0\">"
@@ -93,7 +92,6 @@ string GetUpdateResponse2(const string& app_id,
9392
"IsDeltaPayload=\"true\" "
9493
"sha256=\"" + hash + "\" "
9594
"needsadmin=\"" + needsadmin + "\" " +
96-
(deadline.empty() ? "" : ("deadline=\"" + deadline + "\" ")) +
9795
"/></actions></manifest></updatecheck></app></response>";
9896
LOG(INFO) << "Response = " << response;
9997
return response;
@@ -107,8 +105,7 @@ string GetUpdateResponse(const string& app_id,
107105
const string& filename,
108106
const string& hash,
109107
const string& needsadmin,
110-
const string& size,
111-
const string& deadline) {
108+
const string& size) {
112109
return GetUpdateResponse2(app_id,
113110
display_version,
114111
more_info_url,
@@ -117,8 +114,7 @@ string GetUpdateResponse(const string& app_id,
117114
filename,
118115
hash,
119116
needsadmin,
120-
size,
121-
deadline);
117+
size);
122118
}
123119
} // namespace {}
124120

@@ -221,8 +217,7 @@ TEST(OmahaRequestActionTest, ValidUpdateTest) {
221217
"file.signed", // file name
222218
"HASH1234=", // checksum
223219
"false", // needs admin
224-
"123", // size
225-
"20101020"), // deadline
220+
"123"), // size
226221
-1,
227222
false, // ping_only
228223
kActionCodeSuccess,
@@ -237,7 +232,6 @@ TEST(OmahaRequestActionTest, ValidUpdateTest) {
237232
EXPECT_EQ(123, response.size);
238233
EXPECT_FALSE(response.needs_admin);
239234
EXPECT_TRUE(response.prompt);
240-
EXPECT_EQ("20101020", response.deadline);
241235
}
242236

243237
TEST(OmahaRequestActionTest, NoOutputPipeTest) {
@@ -379,7 +373,6 @@ TEST(OmahaRequestActionTest, MissingFieldTest) {
379373
EXPECT_EQ(587, response.size);
380374
EXPECT_TRUE(response.needs_admin);
381375
EXPECT_FALSE(response.prompt);
382-
EXPECT_TRUE(response.deadline.empty());
383376
}
384377

385378
TEST(OmahaRequestActionTest, ConcatUrlSlashTest) {
@@ -515,8 +508,7 @@ TEST(OmahaRequestActionTest, XmlDecodeTest) {
515508
"file.signed", // file name
516509
"HASH1234=", // checksum
517510
"false", // needs admin
518-
"123", // size
519-
"&lt;20110101"), // deadline
511+
"123"), // size
520512
-1,
521513
false, // ping_only
522514
kActionCodeSuccess,
@@ -525,7 +517,6 @@ TEST(OmahaRequestActionTest, XmlDecodeTest) {
525517

526518
EXPECT_EQ(response.more_info_url, "testthe<url");
527519
EXPECT_EQ(response.payload_urls[0], "testthe&codebase/file.signed");
528-
EXPECT_EQ(response.deadline, "<20110101");
529520
}
530521

531522
TEST(OmahaRequestActionTest, ParseIntTest) {
@@ -542,8 +533,7 @@ TEST(OmahaRequestActionTest, ParseIntTest) {
542533
"HASH1234=", // checksum
543534
"false", // needs admin
544535
// overflows int32:
545-
"123123123123123", // size
546-
"deadline"),
536+
"123123123123123"), // size
547537
-1,
548538
false, // ping_only
549539
kActionCodeSuccess,

src/update_engine/omaha_response.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ struct OmahaResponse {
4242

4343
std::string more_info_url;
4444
std::string hash;
45-
std::string deadline;
4645
off_t size;
4746
// The number of URL-related failures to tolerate before moving on to the
4847
// next URL in the current pass. This is a configurable value from the

src/update_engine/omaha_response_handler_action.cc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ using std::string;
1818

1919
namespace chromeos_update_engine {
2020

21-
const char OmahaResponseHandlerAction::kDeadlineFile[] =
22-
"/tmp/update-check-response-deadline";
23-
2421
OmahaResponseHandlerAction::OmahaResponseHandlerAction(
2522
SystemState* system_state)
2623
: system_state_(system_state),
@@ -85,18 +82,6 @@ void OmahaResponseHandlerAction::PerformAction() {
8582
LOG(INFO) << "Using this install plan:";
8683
install_plan_.Dump();
8784

88-
// Send the deadline data (if any) to Chrome through a file. This is a pretty
89-
// hacky solution but should be OK for now.
90-
//
91-
// TODO(petkov): Rearchitect this to avoid communication through a
92-
// file. Ideallly, we would include this information in D-Bus's GetStatus
93-
// method and UpdateStatus signal. A potential issue is that update_engine may
94-
// be unresponsive during an update download.
95-
utils::WriteFile(kDeadlineFile,
96-
response.deadline.data(),
97-
response.deadline.size());
98-
chmod(kDeadlineFile, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
99-
10085
completer.set_code(kActionCodeSuccess);
10186
}
10287

src/update_engine/omaha_response_handler_action.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ class ActionTraits<OmahaResponseHandlerAction> {
3030

3131
class OmahaResponseHandlerAction : public Action<OmahaResponseHandlerAction> {
3232
public:
33-
static const char kDeadlineFile[];
34-
3533
OmahaResponseHandlerAction(SystemState* system_state);
3634
typedef ActionTraits<OmahaResponseHandlerAction>::InputObjectType
3735
InputObjectType;

src/update_engine/omaha_response_handler_action_unittest.cc

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ bool OmahaResponseHandlerActionTest::DoTest(const OmahaResponse& in,
8080
}
8181

8282
TEST_F(OmahaResponseHandlerActionTest, SimpleTest) {
83-
ScopedPathUnlinker deadline_unlinker(
84-
OmahaResponseHandlerAction::kDeadlineFile);
8583
{
8684
OmahaResponse in;
8785
in.update_exists = true;
@@ -92,23 +90,12 @@ TEST_F(OmahaResponseHandlerActionTest, SimpleTest) {
9290
in.size = 12;
9391
in.needs_admin = true;
9492
in.prompt = false;
95-
in.deadline = "20101020";
9693
InstallPlan install_plan;
9794
EXPECT_TRUE(DoTest(in, "/dev/sda3", &install_plan));
9895
EXPECT_EQ(in.payload_urls[0], install_plan.download_url);
9996
EXPECT_EQ(in.hash, install_plan.payload_hash);
10097
EXPECT_EQ(in.display_version, install_plan.display_version);
10198
EXPECT_EQ("/dev/sda4", install_plan.partition_path);
102-
string deadline;
103-
EXPECT_TRUE(utils::ReadFile(
104-
OmahaResponseHandlerAction::kDeadlineFile,
105-
&deadline));
106-
EXPECT_EQ("20101020", deadline);
107-
struct stat deadline_stat;
108-
EXPECT_EQ(0, stat(OmahaResponseHandlerAction::kDeadlineFile,
109-
&deadline_stat));
110-
EXPECT_EQ(S_IFREG | S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH,
111-
deadline_stat.st_mode);
11299
}
113100
{
114101
OmahaResponse in;
@@ -126,10 +113,6 @@ TEST_F(OmahaResponseHandlerActionTest, SimpleTest) {
126113
EXPECT_EQ(in.hash, install_plan.payload_hash);
127114
EXPECT_EQ(in.display_version, install_plan.display_version);
128115
EXPECT_EQ("/dev/sda3", install_plan.partition_path);
129-
string deadline;
130-
EXPECT_TRUE(utils::ReadFile(
131-
OmahaResponseHandlerAction::kDeadlineFile,
132-
&deadline) && deadline.empty());
133116
}
134117
{
135118
OmahaResponse in;
@@ -141,18 +124,12 @@ TEST_F(OmahaResponseHandlerActionTest, SimpleTest) {
141124
in.size = 12;
142125
in.needs_admin = true;
143126
in.prompt = true;
144-
in.deadline = "some-deadline";
145127
InstallPlan install_plan;
146128
EXPECT_TRUE(DoTest(in, "/dev/sda3", &install_plan));
147129
EXPECT_EQ(in.payload_urls[0], install_plan.download_url);
148130
EXPECT_EQ(in.hash, install_plan.payload_hash);
149131
EXPECT_EQ(in.display_version, install_plan.display_version);
150132
EXPECT_EQ("/dev/sda4", install_plan.partition_path);
151-
string deadline;
152-
EXPECT_TRUE(utils::ReadFile(
153-
OmahaResponseHandlerAction::kDeadlineFile,
154-
&deadline));
155-
EXPECT_EQ("some-deadline", deadline);
156133
}
157134
}
158135

0 commit comments

Comments
 (0)