blob: 2bff51f4cf5a520170cc0d51c9fef1e5e2b6e7d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/usr/bin/env python
# Copyright (C) 2015 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
'''Migration to Baserock Definitions format version 0.
The format of version 0 is not formally specified, except by the Morph
codebase. It marks the starting point of the work to formalise the Baserock
Definitions format.
'''
import os
import sys
import migrations
TO_VERSION = 0
try:
if os.path.exists('./VERSION'):
# This will raise an exception if the VERSION file is invalid, which
# might be useful.
migrations.check_definitions_version(TO_VERSION)
sys.stdout.write("Nothing to do.\n")
sys.exit(0)
else:
sys.stdout.write("No VERSION file found, creating one.\n")
migrations.set_definitions_version(TO_VERSION)
sys.exit(0)
except RuntimeError as e:
sys.stderr.write("Error: %s\n" % e.message)
sys.exit(1)
|