1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

Documentation cleanup

Ticket:
Reviewed By:
Testing Done:

- these changes are mainly related to api doc generation using sphinx
This commit is contained in:
Roopa Prabhu
2014-07-22 11:15:56 -07:00
parent 2c0ad8b338
commit 904908bc5f
22 changed files with 472 additions and 114 deletions

32
ifupdown/utils.py Normal file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/python
#
# Copyright 2014 Cumulus Networks, Inc. All rights reserved.
# Author: Roopa Prabhu, roopa@cumulusnetworks.com
#
# utils --
# helper class
#
import os
import fcntl
class utils():
@classmethod
def importName(cls, modulename, name):
""" Import a named object """
try:
module = __import__(modulename, globals(), locals(), [name])
except ImportError:
return None
return getattr(module, name)
@classmethod
def lockFile(cls, lockfile):
try:
fp = os.open(lockfile, os.O_CREAT | os.O_TRUNC | os.O_WRONLY)
fcntl.flock(fp, fcntl.LOCK_EX | fcntl.LOCK_NB)
except IOError:
return False
return True