root / tools / post-upgrade @ a317d77a
History | View | Annotate | Download (1.5 kB)
1 | fba59beb | Klaus Aehlig | #!/usr/bin/python |
---|---|---|---|
2 | fba59beb | Klaus Aehlig | # |
3 | fba59beb | Klaus Aehlig | |
4 | fba59beb | Klaus Aehlig | # Copyright (C) 2014 Google Inc. |
5 | fba59beb | Klaus Aehlig | # |
6 | fba59beb | Klaus Aehlig | # This program is free software; you can redistribute it and/or modify |
7 | fba59beb | Klaus Aehlig | # it under the terms of the GNU General Public License as published by |
8 | fba59beb | Klaus Aehlig | # the Free Software Foundation; either version 2 of the License, or |
9 | fba59beb | Klaus Aehlig | # (at your option) any later version. |
10 | fba59beb | Klaus Aehlig | # |
11 | fba59beb | Klaus Aehlig | # This program is distributed in the hope that it will be useful, but |
12 | fba59beb | Klaus Aehlig | # WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | fba59beb | Klaus Aehlig | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | fba59beb | Klaus Aehlig | # General Public License for more details. |
15 | fba59beb | Klaus Aehlig | # |
16 | fba59beb | Klaus Aehlig | # You should have received a copy of the GNU General Public License |
17 | fba59beb | Klaus Aehlig | # along with this program; if not, write to the Free Software |
18 | fba59beb | Klaus Aehlig | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
19 | fba59beb | Klaus Aehlig | # 02110-1301, USA. |
20 | fba59beb | Klaus Aehlig | |
21 | fba59beb | Klaus Aehlig | |
22 | fba59beb | Klaus Aehlig | # pylint: disable=C0103 |
23 | fba59beb | Klaus Aehlig | |
24 | fba59beb | Klaus Aehlig | """Hook to be run after upgrading to this version. |
25 | fba59beb | Klaus Aehlig | |
26 | fba59beb | Klaus Aehlig | """ |
27 | fba59beb | Klaus Aehlig | |
28 | b121199d | Klaus Aehlig | import sys |
29 | b121199d | Klaus Aehlig | |
30 | b121199d | Klaus Aehlig | from ganeti import utils |
31 | b121199d | Klaus Aehlig | from ganeti import cli |
32 | b121199d | Klaus Aehlig | |
33 | fba59beb | Klaus Aehlig | |
34 | fba59beb | Klaus Aehlig | def main(): |
35 | fba59beb | Klaus Aehlig | """Main program. |
36 | fba59beb | Klaus Aehlig | |
37 | fba59beb | Klaus Aehlig | """ |
38 | b121199d | Klaus Aehlig | if len(sys.argv) != 2: |
39 | b121199d | Klaus Aehlig | cli.ToStderr("Expecting precisely one argument, the version upgrading from") |
40 | b121199d | Klaus Aehlig | return 1 |
41 | b121199d | Klaus Aehlig | versionstring = sys.argv[1] |
42 | b121199d | Klaus Aehlig | |
43 | b121199d | Klaus Aehlig | version = utils.version.ParseVersion(versionstring) |
44 | b121199d | Klaus Aehlig | |
45 | b121199d | Klaus Aehlig | if utils.version.IsBefore(version, 2, 11, 0): |
46 | d5104ca4 | Helga Velroyen | result = utils.RunCmd(["gnt-cluster", "renew-crypto", |
47 | d5104ca4 | Helga Velroyen | "--new-node-certificates", "-f"]) |
48 | d5104ca4 | Helga Velroyen | if result.failed: |
49 | d5104ca4 | Helga Velroyen | cli.ToStderr("Failed to create node certificates: %s; Output %s" % |
50 | d5104ca4 | Helga Velroyen | (result.fail_reason, result.output)) |
51 | fba59beb | Klaus Aehlig | return 0 |
52 | fba59beb | Klaus Aehlig | |
53 | fba59beb | Klaus Aehlig | if __name__ == "__main__": |
54 | fba59beb | Klaus Aehlig | exit(main()) |