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:
Thomas Haller 2018-09-27 11:12:22 +02:00
parent 979145cbae
commit 8daa14eb36

View file

@ -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