Merge branch 'master' into archiving
This commit is contained in:
commit
8bb70055f4
3 changed files with 16 additions and 7 deletions
|
@ -59,8 +59,8 @@ for group in $changed_groups; do
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present) echo "gpasswd -a \"$group\" \"$user\"" ;;
|
present) echo "gpasswd -a \"$user\" \"$group\"" ;;
|
||||||
absent) echo "gpasswd -d \"$group\" \"$user\"" ;;
|
absent) echo "gpasswd -d \"$user\" \"$group\"" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -21,9 +21,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
import fnmatch
|
|
||||||
import os
|
import os
|
||||||
import collections
|
|
||||||
|
|
||||||
import cdist
|
import cdist
|
||||||
import cdist.core
|
import cdist.core
|
||||||
|
@ -142,9 +140,13 @@ class CdistObject(object):
|
||||||
if '//' in self.object_id:
|
if '//' in self.object_id:
|
||||||
raise IllegalObjectIdError(
|
raise IllegalObjectIdError(
|
||||||
self.object_id, 'object_id may not contain //')
|
self.object_id, 'object_id may not contain //')
|
||||||
if self.object_id == '.':
|
|
||||||
|
_invalid_object_ids = ('.', '/', )
|
||||||
|
for ioid in _invalid_object_ids:
|
||||||
|
if self.object_id == ioid:
|
||||||
raise IllegalObjectIdError(
|
raise IllegalObjectIdError(
|
||||||
self.object_id, 'object_id may not be a .')
|
self.object_id,
|
||||||
|
'object_id may not be a {}'.format(ioid))
|
||||||
|
|
||||||
# If no object_id and type is not singleton => error out
|
# If no object_id and type is not singleton => error out
|
||||||
if not self.object_id and not self.cdist_type.is_singleton:
|
if not self.object_id and not self.cdist_type.is_singleton:
|
||||||
|
|
|
@ -147,6 +147,13 @@ class ObjectIdTestCase(test.CdistTestCase):
|
||||||
core.CdistObject(cdist_type, self.object_base_path,
|
core.CdistObject(cdist_type, self.object_base_path,
|
||||||
OBJECT_MARKER_NAME, illegal_object_id)
|
OBJECT_MARKER_NAME, illegal_object_id)
|
||||||
|
|
||||||
|
def test_object_id_equals_slash(self):
|
||||||
|
cdist_type = core.CdistType(type_base_path, '__third')
|
||||||
|
illegal_object_id = '/'
|
||||||
|
with self.assertRaises(core.IllegalObjectIdError):
|
||||||
|
core.CdistObject(cdist_type, self.object_base_path,
|
||||||
|
OBJECT_MARKER_NAME, illegal_object_id)
|
||||||
|
|
||||||
def test_object_id_on_singleton_type(self):
|
def test_object_id_on_singleton_type(self):
|
||||||
cdist_type = core.CdistType(type_base_path, '__test_singleton')
|
cdist_type = core.CdistType(type_base_path, '__test_singleton')
|
||||||
illegal_object_id = 'object_id'
|
illegal_object_id = 'object_id'
|
||||||
|
|
Loading…
Reference in a new issue