diff --git a/lib/ssconf.py b/lib/ssconf.py index e561549ad8717eb2d9767a0cc2677de53eec5785..966f670a2f8193ede234d4fdf53a5c43413f4723 100644 --- a/lib/ssconf.py +++ b/lib/ssconf.py @@ -447,9 +447,10 @@ class SimpleStore(object): The separator character is a newline. - The return value can be parsed using uidpool.ParseUidPool(): + The return value can be parsed using uidpool.ParseUidPool():: + ss = ssconf.SimpleStore() - uid_pool = uidpool.ParseUidPool(ss.GetUidPool(), separator="\n") + uid_pool = uidpool.ParseUidPool(ss.GetUidPool(), separator="\\n") """ data = self._ReadFile(constants.SS_UID_POOL) diff --git a/lib/uidpool.py b/lib/uidpool.py index 21c9113699f8f04be08bd43a1d3db15a7493f9f0..9e3c8e5b0bbf1ac20a23f83ba1f829ba79e61622 100644 --- a/lib/uidpool.py +++ b/lib/uidpool.py @@ -222,16 +222,17 @@ class LockedUid(object): def RequestUnusedUid(all_uids): """Tries to find an unused uid from the uid-pool, locks it and returns it. - Usage pattern: + Usage pattern + ============= - 1) When starting a process + 1. When starting a process:: from ganeti import ssconf from ganeti import uidpool # Get list of all user-ids in the uid-pool from ssconf ss = ssconf.SimpleStore() - uid_pool = uidpool.ParseUidPool(ss.GetUidPool(), separator="\n") + uid_pool = uidpool.ParseUidPool(ss.GetUidPool(), separator="\\n") all_uids = set(uidpool.ExpandUidPool(uid_pool)) uid = uidpool.RequestUnusedUid(all_uids) @@ -243,7 +244,7 @@ def RequestUnusedUid(all_uids): # Return the UID to the pool uidpool.ReleaseUid(uid) - 2) Stopping a process + 2. Stopping a process:: from ganeti import uidpool