Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Migrating to v2.0

Stefan Majewsky edited this page May 9, 2016 · 5 revisions

When upgrading to v2.0, manual intervention is required in some cases. This page outlines what you need to do.

The old state format

Versions 1.2 and 1.3 tracked which users and groups have been provisioned by holo-users-groups, by writing a single file like this:

$ cat /var/lib/holo/users-groups/state.toml
ProvisionedGroups = ["mygroup"]
ProvisionedUsers = ["myuser", "myotheruser"]

The new format

Version 2.0 abandons this format and uses base images and provisioned images instead. Provisioned images are created automatically and The main difference is the base image, which records the state of the user or group just before the first provisioning. This change allows holo-users-groups to make more competent decisions when cleaning up an entity that is not needed anymore.

After migrating to version 2.0, the first invocation of holo-users-groups will remove the state.toml and create empty base images for all the mentioned entities:

$ cat /var/lib/holo/users-groups/base/group:mygroup.toml
[[group]]
name = "mygroup"
$ cat /var/lib/holo/users-groups/base/user:myuser.toml
[[user]]
name = "myuser"
$ cat /var/lib/holo/users-groups/base/user:myotheruser.toml
[[user]]
name = "myotheruser"

These base images are empty because they only contain the name attribute.

What you need to do

The empty base image is appropriate when the entity (the user or group) was created by holo-users-groups. If the entity did exist, and holo-users-groups just modified some of its attributes, you need to amend the base image to describe the state of the entity before the first provisioning.

As an example, Arch Linux's default /etc/passwd contains the following http user:

$ getent passwd http
http:x:33:33:http:/srv/http:/bin/false

Now consider that we use an entity definition that sets a different home directory:

$ cat /usr/share/holo/users-groups/http-home.toml
[[user]]
name = "http"
home = "/srv/webspace"

In version 1.2/1.3 of holo-users-groups, this would change the home directory and record ProvisionedUsers = ["http"] in the state.toml. Upon migration to version 2.0, this would be converted to an empty base image:

$ cat /var/lib/holo/users-groups/base/user:http.toml
[[user]]
name = "http"

This implies that the http user was created by holo-users-groups, which is wrong! To fix this, you need to add all the entity's attributes to the base image as they were before the first provisioning (especially including the old home directory value!). The syntax is identical to entity definitions:

$ cat /var/lib/holo/users-groups/base/user:http.toml
[[user]]
name = "http"
uid = 33
group = "http"
home = "/srv/http"
shell = "/bin/false"
Clone this wiki locally