shill: Manager: Return the service path in ConfigureService
When a service is created in ConfigureService, return the
DBus object path to the caller.
BUG=chromium-os:31523
TEST=Unit tests
Change-Id: I161ccba3ef14b140b398574a9f17678d7e79c8a4
Reviewed-on: https://gerrit.chromium.org/gerrit/40083
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
diff --git a/dbus_bindings/org.chromium.flimflam.Manager.xml b/dbus_bindings/org.chromium.flimflam.Manager.xml
index 61861d4..d66ab78 100644
--- a/dbus_bindings/org.chromium.flimflam.Manager.xml
+++ b/dbus_bindings/org.chromium.flimflam.Manager.xml
@@ -54,6 +54,7 @@
</method>
<method name="ConfigureService">
<arg type="a{sv}" direction="in"/>
+ <arg type="o" direction="out"/>
</method>
<method name="FindMatchingService">
<arg type="a{sv}" direction="in"/>
diff --git a/doc/manager-api.txt b/doc/manager-api.txt
index 880d44e..b8afd48 100644
--- a/doc/manager-api.txt
+++ b/doc/manager-api.txt
@@ -124,13 +124,13 @@
[service].Error.InProgress
[service].Error.AlreadyDisabled
- void ConfigureService(dict properties)
+ object ConfigureService(dict properties)
Update the configuration of a service in memory
and in the profile. If no service exists in
memory it is temporarily created to carry out
- this work and then removed after saving its
- configuration to the profle.
+ this work and may be removed later. The object
+ path of the created service is returned.
If a GUID property is specified in properties
it is used to find the service; otherwise Type,
diff --git a/manager_dbus_adaptor.cc b/manager_dbus_adaptor.cc
index 983d79a..ee865fc 100644
--- a/manager_dbus_adaptor.cc
+++ b/manager_dbus_adaptor.cc
@@ -233,17 +233,23 @@
}
-void ManagerDBusAdaptor::ConfigureService(
+::DBus::Path ManagerDBusAdaptor::ConfigureService(
const map<string, ::DBus::Variant> &args,
::DBus::Error &error) {
SLOG(DBus, 2) << __func__;
+ ServiceRefPtr service;
KeyValueStore args_store;
- Error e;
- DBusAdaptor::ArgsToKeyValueStore(args, &args_store, &e);
- if (e.IsSuccess()) {
- manager_->ConfigureService(args_store, &e);
+ Error key_value_store_error;
+ DBusAdaptor::ArgsToKeyValueStore(args, &args_store, &key_value_store_error);
+ if (key_value_store_error.ToDBusError(&error)) {
+ return "/"; // ensure return is syntactically valid.
}
- e.ToDBusError(&error);
+ Error configure_error;
+ service = manager_->ConfigureService(args_store, &configure_error);
+ if (configure_error.ToDBusError(&error)) {
+ return "/"; // ensure return is syntactically valid.
+ }
+ return service->GetRpcIdentifier();
}
::DBus::Path ManagerDBusAdaptor::FindMatchingService(
diff --git a/manager_dbus_adaptor.h b/manager_dbus_adaptor.h
index bfacfa0..08325a0 100644
--- a/manager_dbus_adaptor.h
+++ b/manager_dbus_adaptor.h
@@ -72,8 +72,9 @@
::DBus::Path GetWifiService(
const std::map<std::string, ::DBus::Variant> &args,
::DBus::Error &error);
- void ConfigureService(const std::map<std::string, ::DBus::Variant> &args,
- ::DBus::Error &error);
+ ::DBus::Path ConfigureService(
+ const std::map<std::string, ::DBus::Variant> &args,
+ ::DBus::Error &error);
::DBus::Path FindMatchingService(
const std::map<std::string, ::DBus::Variant> &args,
::DBus::Error &error);