platform9 / cctl

Apache License 2.0
47 stars 8 forks source link

Add state file upgrade/migration #121

Closed vannrt closed 6 years ago

vannrt commented 6 years ago

This changeset introduces the migrate command and the first migration module to bootstrap the migration workflow. The first migration module adds the field SchemaVersion to the state file. This new field is used to check whether or not the state file is at the expected SchemaVersion in addition to keeping track of the state file's schema version.

When a user invokes the cctl binary pointing to a state file with an older or newer SchemaVersion than the binary's SchemaVersion, any operation requiring InitState will fail and will print a message telling the user to migrate the state file.

This changeset also fixes #96 by adding the InitState procedure to selected commands.

Fixes #120