diff options
| author | Sam Yaple <sam@yaple.net> | 2016-12-18 19:11:47 +0000 |
|---|---|---|
| committer | Mauricio Lima <mauriciolimab@gmail.com> | 2017-01-17 09:02:21 -0300 |
| commit | 58eee09c15dea81ec51bb366af23681de70ceaa1 (patch) | |
| tree | e84ce37d18be555e80e9c895789615ec60a37b5b /kolla/image | |
| parent | 3671d860af55d88804740f0420d5bc7e5bb92bd9 (diff) | |
| download | kolla-58eee09c15dea81ec51bb366af23681de70ceaa1.tar.gz kolla-58eee09c15dea81ec51bb366af23681de70ceaa1.zip | |
use static uid/gid in images
This centralizes all user and group creation into a single source. This
will fix any current and furture uid/gid mismatches (such as with
nova-libvirt).
In the process, we also unify users between the distros in a standard
way. The users in the following containers change from thier defaults:
Ubuntu: _chrony user is now chrony
Ubuntu: memcache user is now memcached
All: qemu user is used for ownership and socket permissions
All uid and gid numbers are customizable via kolla-build.conf
Co-Authored-By: Kris Lindgren <klindgren@godaddy.com>
Change-Id: I120f26ab0683dc87d69727c3df8d4707e52a4543
Partially-Implements: blueprint static-uid-gid
Diffstat (limited to 'kolla/image')
| -rwxr-xr-x | kolla/image/build.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/kolla/image/build.py b/kolla/image/build.py index 35029f198..8760b46cb 100755 --- a/kolla/image/build.py +++ b/kolla/image/build.py @@ -631,6 +631,20 @@ class KollaWorker(object): 'debian_package_install': jinja_methods.debian_package_install, } + def get_users(self): + all_sections = (set(six.iterkeys(self.conf._groups)) | + set(self.conf.list_all_sections())) + ret = dict() + for section in all_sections: + match = re.search('^.*-user$', section) + if match: + user = self.conf[match.group(0)] + ret[match.group(0)[:-5]] = { + 'uid': user.uid, + 'gid': user.gid, + } + return ret + def create_dockerfiles(self): kolla_version = version.version_info.cached_version_string() supported_distro_release = common_config.DISTRO_RELEASE.get( @@ -650,6 +664,7 @@ class KollaWorker(object): 'maintainer': self.maintainer, 'kolla_version': kolla_version, 'image_name': image_name, + 'users': self.get_users(), 'rpm_setup': self.rpm_setup} env = jinja2.Environment( # nosec: not used to render HTML loader=jinja2.FileSystemLoader(self.working_dir)) |
