buffet: Persist needed registration data
Previously we weren't persisting the device_kind, name, display_name,
description, and location of the device. This meant that after stopping
and starting buffet it could no longer save device state to GCD.
TEST=FEATURES=test emerge buffet
BUG=brillo:153
Change-Id: Ica5233ef6e3d50d3456ecd6b18ba750e1bada3cf
Reviewed-on: https://chromium-review.googlesource.com/248740
Tested-by: Nathan Bullock <nathanbullock@google.com>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Nathan Bullock <nathanbullock@google.com>
diff --git a/buffet/device_registration_info.cc b/buffet/device_registration_info.cc
index abe130b..a0b684e 100644
--- a/buffet/device_registration_info.cc
+++ b/buffet/device_registration_info.cc
@@ -214,6 +214,21 @@
std::string device_robot_account;
if (!dict->GetString(storage_keys::kRobotAccount, &device_robot_account))
return false;
+ std::string device_kind;
+ if (!dict->GetString(storage_keys::kDeviceKind, &device_kind))
+ return false;
+ std::string name;
+ if (!dict->GetString(storage_keys::kName, &name))
+ return false;
+ std::string display_name;
+ if (!dict->GetString(storage_keys::kDisplayName, &display_name))
+ return false;
+ std::string description;
+ if (!dict->GetString(storage_keys::kDescription, &description))
+ return false;
+ std::string location;
+ if (!dict->GetString(storage_keys::kLocation, &location))
+ return false;
client_id_ = client_id;
client_secret_ = client_secret;
@@ -223,6 +238,11 @@
oauth_url_ = oauth_url;
service_url_ = service_url;
device_robot_account_ = device_robot_account;
+ device_kind_ = device_kind;
+ name_ = name;
+ display_name_ = display_name;
+ description_ = description;
+ location_ = location;
return true;
}
@@ -236,6 +256,12 @@
dict.SetString(storage_keys::kOAuthURL, oauth_url_);
dict.SetString(storage_keys::kServiceURL, service_url_);
dict.SetString(storage_keys::kRobotAccount, device_robot_account_);
+ dict.SetString(storage_keys::kDeviceKind, device_kind_);
+ dict.SetString(storage_keys::kName, name_);
+ dict.SetString(storage_keys::kDisplayName, display_name_);
+ dict.SetString(storage_keys::kDescription, description_);
+ dict.SetString(storage_keys::kLocation, location_);
+
return storage_->Save(&dict);
}