Univention Bugzilla – Attachment 9073 Details for
Bug 42128
univention-network-manager should use the official UMC API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
42128.patch (text/plain), 1.90 KB, created by
Florian Best
on 2017-07-28 13:35:10 CEST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2017-07-28 13:35:10 CEST
Size:
1.90 KB
patch
obsolete
>diff --git a/base/univention-network-manager/univention-register-network-address b/base/univention-network-manager/univention-register-network-address >index b5bf5e1..90bb8bc 100755 >--- a/base/univention-network-manager/univention-register-network-address >+++ b/base/univention-network-manager/univention-register-network-address >@@ -33,21 +33,26 @@ > import sys > import optparse > import netifaces >-import subprocess > import univention.config_registry > import univention.uldap > >+from univention.lib.umc import Client, HTTPError, ConnectionError >+ > > def register_iface(configRegistry, iface, verbose): >- # is fallback different from current address? >- p1 = subprocess.Popen(['/usr/sbin/umc-command', '-U', '%s$' % configRegistry.get('hostname'), '-y', '/etc/machine.secret', '-s', configRegistry.get('ldap/master'), 'ip/change', '-o', 'ip=%s' % configRegistry.get('interfaces/%s/address' % iface), '-o', 'oldip=%s' % configRegistry.get('interfaces/%s/fallback/address' % iface), '-o', 'netmask=%s' % configRegistry.get('interfaces/%s/netmask' % iface), '-o', 'role=%s' % configRegistry.get('server/role')], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) >- res = p1.communicate() >- if p1.returncode != 0: >- print 'ERROR: IP registration for %s failed with code %s' % (iface, p1.returncode) >+ try: >+ client = Client() >+ client.authenticate_with_machine_account() >+ return client.umc_command('ip/change', { >+ 'ip': configRegistry.get('interfaces/%s/address' % iface), >+ 'oldip': configRegistry.get('interfaces/%s/fallback/address' % iface), >+ 'netmask': configRegistry.get('interfaces/%s/netmask' % iface), >+ 'role': configRegistry.get('server/role') >+ }).result.get('success', True) >+ except (HTTPError, ConnectionError) as exc: > if verbose: >- print 'More information: %s\n%s' % (res[1], res[0]) >- return False >- return True >+ print '%s: %s' % (type(exc).__name__, exc) >+ return False > > > if __name__ == '__main__':
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 42128
:
7922
| 9073