Bug 1229337

Summary: [Python libnm-glib] NMClient.Client().get_manager_running() returns False if not run as root
Product: [Fedora] Fedora Reporter: Tomáš Hozza <thozza>
Component: NetworkManagerAssignee: Lubomir Rintel <lkundrak>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 22CC: dcbw, psimerda, rkhan
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-19 19:49:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomáš Hozza 2015-06-08 13:39:55 UTC
Description of problem:
If NMClient.Client().get_manager_running() from libnm-glib is run as unprivileged user, it returns False even though NM is running.

Version-Release number of selected component (if applicable):
NetworkManager-glib-1.0.2-1.fc22.x86_64

How reproducible:
always

Steps to Reproduce:
1. run the following code as root and unprivileged user

from gi.repository import NMClient
print(NMClient.Client().get_manager_running())

Actual results:
NMClient.Client().get_manager_running() returns False if called as unprivileged user.

Expected results:
NMClient.Client().get_manager_running() to return True if called as unprivileged user

Additional info:

Comment 1 Jirka Klimes 2015-06-08 14:33:26 UTC
The problem is that use should call new() function so that the client object is created as intended. Calling Client() only calls constructor but the object may not be properly initialized.

See also related comment in NMClient constructor:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/libnm-glib/nm-client.c#n1721

So, the code should be
--- 8< -------------
#!/usr/bin/env python

# using legacy libnm-glib
from gi.repository import NMClient
print (NMClient.Client().new().get_manager_running())

# using new libnm
#from gi.repository import NM
#print (NM.Client().new().get_nm_running())
---8< -------------

Comment 2 Tomáš Hozza 2015-06-09 07:28:43 UTC
Thanks for the info.

However I still think that this is a bug. If calling NMClient.Client() will not create the NMClient object properly, it should not be allowed at all. The need to call NMClient.Client().new() is IMO too unintuitive.

Comment 3 Fedora Admin XMLRPC Client 2015-08-18 15:00:10 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 4 Fedora End Of Life 2016-07-19 19:49:49 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.