>From 215043dc1b121131f321cd12d329ad148b78b256 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miroslav=20Such=C3=BD?= <msuchy@redhat.com>
Date: Wed, 29 Jun 2011 14:00:51 +0200
Subject: [PATCH 02/34] move get_dbus_iface() from
 subscription_manager.gui.utils to
 subscription_manager.utils

this way this function can be used by CLI version of subscription_manager
---
 src/subscription_manager/gui/mysubstab.py |    3 ++-
 src/subscription_manager/gui/utils.py     |   13 -------------
 src/subscription_manager/utils.py         |   27 +++++++++++++++++++++++++++
 subscription-manager.spec                 |    1 +
 4 files changed, 30 insertions(+), 14 deletions(-)
 create mode 100644 src/subscription_manager/utils.py

diff --git a/src/subscription_manager/gui/mysubstab.py b/src/subscription_manager/gui/mysubstab.py
index 44c4bdc..9ca5f59 100644
--- a/src/subscription_manager/gui/mysubstab.py
+++ b/src/subscription_manager/gui/mysubstab.py
@@ -22,7 +22,8 @@ from rhsm.certificate import GMT
 from subscription_manager.certlib import EntitlementDirectory, ProductDirectory, Disconnected
 from subscription_manager.gui import messageWindow
 from subscription_manager.gui import widgets
-from subscription_manager.gui.utils import handle_gui_exception, get_dbus_iface
+from subscription_manager.gui.utils import handle_gui_exception
+from subscription_manager import get_dbus_iface
 
 import gettext
 _ = gettext.gettext
diff --git a/src/subscription_manager/gui/utils.py b/src/subscription_manager/gui/utils.py
index c16705e..cd59e79 100644
--- a/src/subscription_manager/gui/utils.py
+++ b/src/subscription_manager/gui/utils.py
@@ -19,7 +19,6 @@ from socket import error as socket_error
 from M2Crypto import SSL
 import gobject
 import datetime
-import dbus
 import gtk
 
 import gettext
@@ -177,15 +176,3 @@ def make_today_now(today):
         today = today.replace(hour=now.hour, minute=now.minute,
                 second=now.second, tzinfo=managerlib.LocalTz())
     return today
-
-
-def get_dbus_iface():
-    """
-    Set up the dbus proxy for calling remote methods
-    """
-    bus = dbus.SystemBus()
-    validity_obj = bus.get_object('com.redhat.SubscriptionManager',
-                      '/EntitlementStatus')
-    validity_iface = dbus.Interface(validity_obj,
-                        dbus_interface='com.redhat.SubscriptionManager.EntitlementStatus')
-    return validity_iface
diff --git a/src/subscription_manager/utils.py b/src/subscription_manager/utils.py
new file mode 100644
index 0000000..8cfa3e7
--- /dev/null
+++ b/src/subscription_manager/utils.py
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2011 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+
+import dbus
+
+def get_dbus_iface():
+    """
+    Set up the dbus proxy for calling remote methods
+    """
+    bus = dbus.SystemBus()
+    validity_obj = bus.get_object('com.redhat.SubscriptionManager',
+                      '/EntitlementStatus')
+    validity_iface = dbus.Interface(validity_obj,
+                        dbus_interface='com.redhat.SubscriptionManager.EntitlementStatus')
+    return validity_iface
diff --git a/subscription-manager.spec b/subscription-manager.spec
index 4219257..bb31fde 100644
--- a/subscription-manager.spec
+++ b/subscription-manager.spec
@@ -140,6 +140,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/rhsm/subscription_manager/facts.py*
 %{_datadir}/rhsm/subscription_manager/factlib.py*
 %{_datadir}/rhsm/subscription_manager/productid.py*
+%{_datadir}/rhsm/subscription_manager/utils.py*
 %{_datadir}/rhsm/subscription_manager/branding
 %attr(755,root,root) %{_datadir}/rhsm/subscription_manager/certmgr.py*
 %attr(755,root,root) %{_sbindir}/subscription-manager
-- 
1.7.5.4

