Browse Source

Fixed missing hiera item for upgrade-control

Change-Id: I8718b6620c16ed2bfa30eedfabeecc4259701f07
changes/70/390570/2
Dmitry Nikishov 2 years ago
parent
commit
a921ad0021

+ 13
- 1
deployment/puppet/octane_tasks/graphs/orig/switch-control-1.yaml View File

@@ -10,6 +10,18 @@
10 10
   fault_tolerance: 0
11 11
 
12 12
 # TASKS
13
+- id: add_hiera_override
14
+  type: upload_file
15
+  version: 2.1.0
16
+  groups: [primary-controller, controller]
17
+  requires: []
18
+  required_for: []
19
+  parameters:
20
+    path: /etc/hiera/override/common.yaml
21
+    data:
22
+      yaql_exp: >
23
+        ({"upgrade" => $.upgrade}.toYaml())
24
+
13 25
 - id: rsync_octane
14 26
   type: sync
15 27
   version: 2.1.0
@@ -25,7 +37,7 @@
25 37
   type: puppet
26 38
   version: 2.1.0
27 39
   groups: [primary-controller, controller]
28
-  requires: [rsync_octane]
40
+  requires: [add_hiera_override, rsync_octane]
29 41
   required_for: []
30 42
   parameters:
31 43
     puppet_manifest: /etc/fuel/octane/puppet/octane_tasks/modular/kill_cluster.pp

+ 10
- 0
deployment/puppet/octane_tasks/graphs/orig/switch-control-2.yaml View File

@@ -32,3 +32,13 @@
32 32
     puppet_modules:  /etc/fuel/octane/puppet:/etc/puppet/modules
33 33
     timeout: 360
34 34
 
35
+
36
+- id: remove_hiera_override
37
+  type: shell
38
+  version: 2.1.0
39
+  groups: [primary-controller, controller]
40
+  requires: [stop_init_services]
41
+  required_for: []
42
+  parameters:
43
+    cmd: rm /etc/hiera/override/common.yaml || true
44
+    timeout: 60

+ 13
- 1
deployment/puppet/octane_tasks/graphs/seed/switch-control-1.yaml View File

@@ -5,6 +5,18 @@
5 5
   fault_tolerance: 0
6 6
 
7 7
 # TASKS
8
+- id: add_hiera_override
9
+  type: upload_file
10
+  version: 2.1.0
11
+  groups: [primary-controller]
12
+  requires: []
13
+  required_for: []
14
+  parameters:
15
+    path: /etc/hiera/override/common.yaml
16
+    data:
17
+      yaql_exp: >
18
+        ({"upgrade" => $.upgrade}.toYaml())
19
+
8 20
 - id: rsync_octane
9 21
   type: sync
10 22
   version: 2.1.0
@@ -20,7 +32,7 @@
20 32
   type: puppet
21 33
   version: 2.1.0
22 34
   groups: [primary-controller]
23
-  requires: [rsync_octane]
35
+  requires: [add_hiera_override, rsync_octane]
24 36
   required_for: []
25 37
   parameters:
26 38
     puppet_manifest: /etc/fuel/octane/puppet/octane_tasks/modular/start_controller_services.pp

+ 10
- 0
deployment/puppet/octane_tasks/graphs/seed/switch-control-2.yaml View File

@@ -28,3 +28,13 @@
28 28
     timeout: 180
29 29
     data:
30 30
       yaql_exp: '$.toYaml()'
31
+
32
+- id: remove_hiera_override
33
+  type: shell
34
+  version: 2.1.0
35
+  groups: [primary-controller]
36
+  requires: [upload_configuration]
37
+  required_for: []
38
+  parameters:
39
+    cmd: rm /etc/hiera/override/common.yaml || true
40
+    timeout: 60

+ 22
- 0
octane/commands/upgrade_controlplane.py View File

@@ -57,11 +57,33 @@ def upgrade_control_plane(orig_id, seed_id):
57 57
     seed_env.delete_facts("deployment")
58 58
 
59 59
 
60
+def add_upgrade_attrs_to_settings(orig_env, seed_env):
61
+    upgrade_hash = {
62
+        'relation_info': {
63
+            'orig_cluster_version': orig_env.data['fuel_version'],
64
+            'seed_cluster_version': seed_env.data['fuel_version']
65
+        }
66
+    }
67
+
68
+    orig_attrs = orig_env.get_settings_data()
69
+    orig_upgrade = orig_attrs['editable']['common'].get('upgrade', {})
70
+    orig_upgrade.update(upgrade_hash)
71
+    orig_attrs['editable']['common']['upgrade'] = orig_upgrade
72
+    orig_env.set_settings_data(orig_attrs)
73
+
74
+    seed_attrs = seed_env.get_settings_data()
75
+    seed_upgrade = seed_attrs['editable']['common'].get('upgrade', {})
76
+    seed_upgrade.update(upgrade_hash)
77
+    seed_attrs['editable']['common']['upgrade'] = seed_upgrade
78
+    seed_env.set_settings_data(seed_attrs)
79
+
80
+
60 81
 def upgrade_control_plane_with_graph(orig_id, seed_id):
61 82
     """Switch controlplane using deployment graphs"""
62 83
 
63 84
     orig_env = environment_obj.Environment(orig_id)
64 85
     seed_env = environment_obj.Environment(seed_id)
86
+    add_upgrade_attrs_to_settings(orig_env, seed_env)
65 87
 
66 88
     deploy.upload_graphs(orig_id, seed_id)
67 89
 

Loading…
Cancel
Save