Browse Source

Remove the unused tripleo.plan.update_from_dir Mistral action

This action was unused and untested.

Change-Id: Id26f594a16745993c83b493994b340ac861805f3
tags/11.2.0
Dougal Matthews 1 month ago
parent
commit
f22413ebab
2 changed files with 0 additions and 75 deletions
  1. 0
    1
      setup.cfg
  2. 0
    74
      tripleo_common/actions/plan.py

+ 0
- 1
setup.cfg View File

@@ -124,7 +124,6 @@ mistral.actions =
124 124
     tripleo.plan.delete = tripleo_common.actions.plan:DeletePlanAction
125 125
     tripleo.plan.list = tripleo_common.actions.plan:ListPlansAction
126 126
     tripleo.plan.export = tripleo_common.actions.plan:ExportPlanAction
127
-    tripleo.plan.update_from_dir = tripleo_common.actions.plan:UpdatePlanFromDirAction
128 127
     tripleo.plan.update_networks = tripleo_common.actions.plan:UpdateNetworksAction
129 128
     tripleo.plan.update_roles = tripleo_common.actions.plan:UpdateRolesAction
130 129
     tripleo.plan.validate_roles = tripleo_common.actions.plan:ValidateRolesDataAction

+ 0
- 74
tripleo_common/actions/plan.py View File

@@ -30,7 +30,6 @@ from tripleo_common import exception
30 30
 from tripleo_common.utils import plan as plan_utils
31 31
 from tripleo_common.utils import roles as roles_utils
32 32
 from tripleo_common.utils import swift as swiftutils
33
-from tripleo_common.utils import tarball
34 33
 from tripleo_common.utils.validations import pattern_validator
35 34
 
36 35
 
@@ -215,79 +214,6 @@ class ExportPlanAction(base.TripleOAction):
215 214
             shutil.rmtree(tmp_dir)
216 215
 
217 216
 
218
-class UpdatePlanFromDirAction(base.TripleOAction):
219
-    """Updates a plan and associated files
220
-
221
-    Updates a plan by comparing the current files with the new ones
222
-    provided:
223
-        Updates only new files from the plan
224
-        Add new files from the plan
225
-
226
-    :param container: name of the Swift container / plan name
227
-    """
228
-
229
-    def __init__(self, container=constants.DEFAULT_CONTAINER_NAME,
230
-                 templates_dir=constants.DEFAULT_TEMPLATES_PATH):
231
-        super(UpdatePlanFromDirAction, self).__init__()
232
-        self.container = container
233
-        self.templates_dir = templates_dir
234
-
235
-    def run(self, context):
236
-        try:
237
-            swift = self.get_object_client(context)
238
-            # Upload template dir to tmp container
239
-            container_tmp = '%s-tmp' % self.container
240
-            with tempfile.NamedTemporaryFile() as tmp_tarball:
241
-                tarball.create_tarball(self.templates_dir, tmp_tarball.name)
242
-                tarball.tarball_extract_to_swift_container(
243
-                    swift,
244
-                    tmp_tarball.name,
245
-                    container_tmp)
246
-            # Get all new templates:
247
-            new_templates = swiftutils.get_object_string(swift, container_tmp,
248
-                                                         '').splitlines()
249
-            old_templates = swiftutils.get_object_string(swift, self.container,
250
-                                                         '').splitlines()
251
-            exclude_user_data = [constants.PLAN_ENVIRONMENT,
252
-                                 constants.OVERCLOUD_J2_ROLES_NAME,
253
-                                 constants.OVERCLOUD_J2_NETWORKS_NAME,
254
-                                 constants.OVERCLOUD_J2_EXCLUDES]
255
-            # Update the old container
256
-            for new in new_templates:
257
-                # if doesn't exist, push it:
258
-                if new not in old_templates:
259
-                    swiftutils.put_object_string(
260
-                        swift,
261
-                        self.container,
262
-                        new,
263
-                        swiftutils.get_object_string(swift, container_tmp, new)
264
-                    )
265
-                else:
266
-                    content_new = swiftutils.get_object_string(swift,
267
-                                                               container_tmp,
268
-                                                               new)
269
-                    content_old = swiftutils.get_object_string(swift,
270
-                                                               self.container,
271
-                                                               new)
272
-                    if (not content_new == content_old and
273
-                       new not in exclude_user_data):
274
-                        swiftutils.put_object_string(
275
-                            swift,
276
-                            self.container,
277
-                            new,
278
-                            swiftutils.get_object_string(swift, container_tmp,
279
-                                                         new)
280
-                        )
281
-        except swiftexceptions.ClientException as err:
282
-            msg = "Error attempting an operation on container: %s" % err
283
-            LOG.exception(msg)
284
-            return actions.Result(error=msg)
285
-        except Exception as err:
286
-            msg = "Error while updating plan: %s" % err
287
-            LOG.exception(msg)
288
-            return actions.Result(error=msg)
289
-
290
-
291 217
 class UpdateNetworksAction(base.TripleOAction):
292 218
     def __init__(self, networks, current_networks, replace_all=False):
293 219
         super(UpdateNetworksAction, self).__init__()

Loading…
Cancel
Save