5. How to upgrade cdist — cdist 6.1.1 documentation

# 5. How to upgrade cdist

## 5.1. Update the git installation

To upgrade cdist in the current branch use

    git pull

    # Also update the manpages
    make man
    export MANPATH=$MANPATH:$(pwd -P)/doc/man

If you stay on a version branche (i.e. 1.0, 1.1., ...), nothing should break. The master branch on the other hand is the development branch and may not be working, break your setup or eat the tree in your garden.

### 5.1.1. Safely upgrading to new versions

To upgrade to any further cdist version, you can take the following procedure to do a safe upgrade:

    # Create new branch to try out the update
    git checkout -b upgrade_cdist

    # Get latest cdist version in git database
    git fetch -v

    # see what will happen on merge - replace
    # master with the branch you plan to merge
    git diff upgrade_cdist..origin/master

    # Merge the new version
    git merge origin/master

Now you can ensure all custom types work with the new version. Assume that you need to go back to an older version during the migration/update, you can do so as follows:

    # commit changes
    git commit -m ...

    # go back to original branch
    git checkout master

After that, you can go back and continue the upgrade:

    # git checkout upgrade_cdist

## 5.2. Update the python package

To upgrade to the lastet version do

    pip install --upgrade cdist

## 5.3. General update instructions

### 5.3.1. Updating from 3.0 to 3.1

The type __ssh_authorized_keys now also manages existing keys, not only the ones added by cdist.

### 5.3.2. Updating from 2.3 to 3.0

The changed attribute of objects has been removed. Use messaging instead.

### 5.3.3. Updating from 2.2 to 2.3

No incompatibilities.

### 5.3.4. Updating from 2.1 to 2.2

Starting with 2.2, the syntax for requiring a singleton type changed: Old format:

    require="__singleton_type/singleton" ...

New format:

    require="__singleton_type" ...

Internally the "singleton" object id was dropped to make life more easy. You can probably fix your configuration by running the following code snippet (currently untested, please report back if it works for you):

    find ~/.cdist/* -type f -exec sed -i 's,/singleton,,' {} \;

### 5.3.5. Updating from 2.0 to 2.1

Have a look at the update guide for [[2.0 to 2.1|2.0-to-2.1]].

> - Type __package* and __process use --state present or absent. The states removed/installed and stopped/running have been removed. Support for the new states is already present in 2.0.
> - Type __directory: Parameter --parents and --recursive are now boolean The old "yes/no" values need to be removed.
> - Type __rvm_ruby: Parameter --default is now boolean The old "yes/no" values need to be removed.
> - Type __rvm_gemset: Parameter --default is now boolean The old "yes/no" values need to be removed.
> - Type __addifnosuchline and __removeline have been replaced by __line
> - The conf directory is now located at cdist/conf. You need to migrate your types, explorers and manifests manually to the new location.
> - Replace the variable __self by __object_name Support for the variable __object_name is already present in 2.0.
> - The types __autofs, __autofs_map and __autofs_reload have been removed (no maintainer, no users)
> - Type __user: Parameter --groups removed (use the new __user_groups type)
> - Type __ssh_authorized_key has been replaced by more flexible type
>     __ssh_authorized_keys

### 5.3.6. Updating from 1.7 to 2.0

- Ensure python (>= 3.2) is installed on the source host
- Use "cdist config host" instead of "cdist-deploy-to host"
- Use "cdist config -p host1 host2" instead of "cdist-mass-deploy"
- Use "cdist banner" for fun
- Use __object_name instead of __self in manifests

### 5.3.7. Updating from 1.6 to 1.7

- If you used the global explorer hardware_type, you need to change your code to use machine instead.

### 5.3.8. Updating from 1.5 to 1.6

- If you used __package_apt --preseed, you need to use the new type __debconf_set_selections instead.
- The __package types accepted either --state deinstalled or --state uninstaaled. Starting with 1.6, it was made consistently to --state removed.

### 5.3.9. Updating from 1.3 to 1.5

No incompatibilities.

### 5.3.10. Updating from 1.2 to 1.3

Rename gencode of every type to gencode-remote.

### 5.3.11. Updating from 1.1 to 1.2

No incompatibilities.

### 5.3.12. Updating from 1.0 to 1.1

In 1.1 the type __file was split into __directory, __file and __link. The parameter --type was removed from __file. Thus you need to replace __file calls in your manifests:

> - Remove --type from all __file calls
> - If type was symlink, use __link and --type symbolic
> - If type was directory, use __directory