From 8daa14eb365cd737eddac8e8974cb53940fa0e37 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 27 Sep 2018 11:12:22 +0200 Subject: [PATCH] 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. --- module_utils/network_lsr/utils.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/module_utils/network_lsr/utils.py b/module_utils/network_lsr/utils.py index ff16bfd..8f84c31 100644 --- a/module_utils/network_lsr/utils.py +++ b/module_utils/network_lsr/utils.py @@ -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