Browse Source

Remove old repos from compute on preupgrade stage

Change-Id: I93dcf51e1592cde0e72936c4bb7cf16314a7ad5d
changes/16/383016/3
Pavel Chechetin 2 years ago
parent
commit
2cb8072ad8

+ 18
- 0
deployment/puppet/octane_tasks/files/delete_section.py View File

@@ -0,0 +1,18 @@
1
+#!/usr/bin/python
2
+
3
+import yaml
4
+import sys
5
+
6
+target_file = sys.argv[1]
7
+section = sys.argv[2]
8
+subsection = sys.argv[3]
9
+
10
+try:
11
+    with open(target_file,'r+') as f:
12
+        data = yaml.load(f)
13
+        del data[section][subsection]
14
+
15
+    with open(target_file,'w+') as f:
16
+        yaml.dump(data,f,default_flow_style=False)
17
+except KeyError as e:
18
+    print "Failed to find key: {0}".format(e)

+ 11
- 1
deployment/puppet/octane_tasks/graphs/orig/preupgrade-compute.yaml View File

@@ -56,7 +56,7 @@
56 56
   type: puppet
57 57
   version: 2.1.0
58 58
   groups: [compute]
59
-  requires: [cleanup_existing_repos, rsync_latest_puppet, override_repos_in_hiera]
59
+  requires: [cleanup_existing_repos, rsync_latest_puppet, override_repos_in_hiera, remove_hiera_section_repo_setup]
60 60
   required_for: []
61 61
   parameters:
62 62
     puppet_manifest: /etc/fuel/octane/latest_modules/osnailyfacter/modular/fuel_pkgs/setup_repositories.pp
@@ -85,6 +85,16 @@
85 85
     puppet_modules:  /etc/fuel/octane/puppet:/etc/puppet/modules
86 86
     timeout: 360
87 87
 
88
+- id: remove_hiera_section_repo_setup
89
+  type: shell
90
+  version: 2.1.0
91
+  groups: [compute]
92
+  requires: [rsync_octane]
93
+  required_for: []
94
+  parameters:
95
+    cmd: python /etc/fuel/octane/puppet/octane_tasks/files/delete_section.py /etc/astute.yaml repo_setup repos
96
+    timeout: 60
97
+
88 98
 - id: remove_hiera_override
89 99
   type: shell
90 100
   version: 2.1.0

Loading…
Cancel
Save