mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 18:35:13 +00:00
module: make Utils.create_uuid() working without pygobject
Utils.create_uuid() only needs the "uuid" module, which is commonly available. Don't load it together with the NM module, as that requires pygobject.
This commit is contained in:
parent
979145cbae
commit
8daa14eb36
1 changed files with 2 additions and 5 deletions
|
|
@ -5,6 +5,7 @@
|
|||
import os
|
||||
import socket
|
||||
import sys
|
||||
import uuid
|
||||
|
||||
# pylint: disable=import-error, no-name-in-module
|
||||
from ansible.module_utils.network_lsr import MyError
|
||||
|
|
@ -40,8 +41,7 @@ class Util:
|
|||
|
||||
@classmethod
|
||||
def create_uuid(cls):
|
||||
cls.NM()
|
||||
return str(cls._uuid.uuid4())
|
||||
return str(uuid.uuid4())
|
||||
|
||||
@classmethod
|
||||
def NM(cls):
|
||||
|
|
@ -60,9 +60,6 @@ class Util:
|
|||
cls._Gio = Gio
|
||||
cls._GObject = GObject
|
||||
n = NM
|
||||
import uuid
|
||||
|
||||
cls._uuid = uuid
|
||||
return n
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue