Merge pull request #461 from bradbishop/two-busses

Remove extra busses from python and sdbus examples
diff --git a/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/obmc-phosphor-example-pydbus.py b/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/obmc-phosphor-example-pydbus.py
index 2b59b58..1f4ce90 100644
--- a/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/obmc-phosphor-example-pydbus.py
+++ b/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/obmc-phosphor-example-pydbus.py
@@ -86,8 +86,7 @@
 	bus = dbus.SystemBus()
 
 	services = []
-	services.append(dbus.service.BusName(SERVICE_PREFIX + '.PythonService0', bus))
-	services.append(dbus.service.BusName(SERVICE_PREFIX + '.PythonService1', bus))
+	services.append(dbus.service.BusName(SERVICE_PREFIX + '.PythonService', bus))
 
 	objs = []
 	objs.append(SampleObjectOne(bus, BASE_OBJ_PATH + 'path0/PythonObj'))
diff --git a/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService0.conf b/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/org.openbmc.examples.PythonService.conf
similarity index 63%
rename from common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService0.conf
rename to common/recipes-phosphor/obmc-phosphor-example-pydbus/files/org.openbmc.examples.PythonService.conf
index 45af4f4..6c4a713 100644
--- a/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService0.conf
+++ b/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/org.openbmc.examples.PythonService.conf
@@ -2,7 +2,7 @@
  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
 <busconfig>
   <policy user="root">
-    <allow own="org.openbmc.examples.SDBusService0"/>
-    <allow send_destination="org.openbmc.examples.SDBusService0"/>
+    <allow own="org.openbmc.examples.PythonService"/>
+    <allow send_destination="org.openbmc.examples.PythonService"/>
   </policy>
 </busconfig>
diff --git a/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/org.openbmc.examples.PythonService0.conf b/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/org.openbmc.examples.PythonService0.conf
deleted file mode 100644
index fad0b81..0000000
--- a/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/org.openbmc.examples.PythonService0.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
-  <policy user="root">
-    <allow own="org.openbmc.examples.PythonService0"/>
-    <allow send_destination="org.openbmc.examples.PythonService0"/>
-  </policy>
-</busconfig>
diff --git a/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/org.openbmc.examples.PythonService1.conf b/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/org.openbmc.examples.PythonService1.conf
deleted file mode 100644
index 0f7114e..0000000
--- a/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/org.openbmc.examples.PythonService1.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
-  <policy user="root">
-    <allow own="org.openbmc.examples.PythonService1"/>
-    <allow send_destination="org.openbmc.examples.PythonService1"/>
-  </policy>
-</busconfig>
diff --git a/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/pyclient-sample.py b/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/pyclient-sample.py
index e1010a5..138865d 100644
--- a/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/pyclient-sample.py
+++ b/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/pyclient-sample.py
@@ -36,9 +36,9 @@
 
 	bus = dbus.SystemBus()
 
-	obj0 = bus.get_object(SERVICE_PREFIX + '.PythonService0',
+	obj0 = bus.get_object(SERVICE_PREFIX + '.PythonService',
 		                      BASE_OBJ_PATH + 'path0/PythonObj')
-	obj1 = bus.get_object(SERVICE_PREFIX + '.PythonService1',
+	obj1 = bus.get_object(SERVICE_PREFIX + '.PythonService',
 		                      BASE_OBJ_PATH + 'path1/PythonObj')
 	echo0= dbus.Interface(obj0,
 		    dbus_interface=IFACE_PREFIX + '.Echo')
diff --git a/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb b/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb
index 1446a73..57e27cf 100644
--- a/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb
+++ b/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb
@@ -3,8 +3,7 @@
 PR = "r1"
 
 DBUS_SERVICES = " \
-        org.openbmc.examples.PythonService0 \
-        org.openbmc.examples.PythonService1 \
+        org.openbmc.examples.PythonService \
         "
 
 inherit obmc-phosphor-pydbus-service
diff --git a/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/obmc-phosphor-example-sdbus.c b/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/obmc-phosphor-example-sdbus.c
index a66bb55..769a208 100644
--- a/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/obmc-phosphor-example-sdbus.c
+++ b/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/obmc-phosphor-example-sdbus.c
@@ -79,13 +79,7 @@
 	}
 
 	/* Take a well-known service name so that clients can find us */
-	r = sd_bus_request_name(bus, "org.openbmc.examples.SDBusService0", 0);
-	if (r < 0) {
-		fprintf(stderr, "Failed to acquire service name: %s\n", strerror(-r));
-		goto finish;
-	}
-
-	r = sd_bus_request_name(bus, "org.openbmc.examples.SDBusService1", 0);
+	r = sd_bus_request_name(bus, "org.openbmc.examples.SDBusService", 0);
 	if (r < 0) {
 		fprintf(stderr, "Failed to acquire service name: %s\n", strerror(-r));
 		goto finish;
diff --git a/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService0.conf b/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService.conf
similarity index 62%
copy from common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService0.conf
copy to common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService.conf
index 45af4f4..86e2a53 100644
--- a/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService0.conf
+++ b/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService.conf
@@ -2,7 +2,7 @@
  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
 <busconfig>
   <policy user="root">
-    <allow own="org.openbmc.examples.SDBusService0"/>
-    <allow send_destination="org.openbmc.examples.SDBusService0"/>
+    <allow own="org.openbmc.examples.SDBusService"/>
+    <allow send_destination="org.openbmc.examples.SDBusService"/>
   </policy>
 </busconfig>
diff --git a/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService1.conf b/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService1.conf
deleted file mode 100644
index 5a7bfb8..0000000
--- a/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService1.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
-  <policy user="root">
-    <allow own="org.openbmc.examples.SDBusService1"/>
-    <allow send_destination="org.openbmc.examples.SDBusService1"/>
-  </policy>
-</busconfig>
diff --git a/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb b/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb
index f1a9eb9..9a3018d 100644
--- a/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb
+++ b/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb
@@ -3,8 +3,7 @@
 PR = "r1"
 
 DBUS_SERVICES = " \
-        org.openbmc.examples.SDBusService0 \
-        org.openbmc.examples.SDBusService1 \
+        org.openbmc.examples.SDBusService \
         "
 
 S = "${WORKDIR}"