foreman_maintain 0.8.24 → 0.8.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 164031605ab91a858e8051175df3cfa485cb8d7641495649b56fc369c8f86901
4
- data.tar.gz: 34bff6ed46469b2de1f936c4b9fb9a292e56f3fbef6084c0f2d9f84d7d5a8389
3
+ metadata.gz: 5fd64b664ab2e4651af4f4c42f19e4418a7e2890537fceac8dd5cd15acdef8fe
4
+ data.tar.gz: 906efdc85144a0cc9a62ff45351e8be0f24268337fe42ec4251796ce19031268
5
5
  SHA512:
6
- metadata.gz: bcce432d5b166c898ecfa33e2a215c8dde59011c72a9f356a877c16caad70da945e06742b4bf867f70963d095ca5520f0fd7aea38893c8ea28a183f08f45ba3f
7
- data.tar.gz: b88af64fe1462a21f0f53c42ae8d67fd940208ccb2234af5ad043fd0ac0121726aec6b215d6b5fbe7dd3c747f1b8aa5f797953cab1b757dd69c7c2c51656a084
6
+ metadata.gz: dbe5d5ac12761231471d1779aa5f6e0cfc28b204340775b54c7843b888d2f1eb7b2fd10d1eacbc5c31c50aaa320e2e707759601166c9611659f4db7b1d3b52a0
7
+ data.tar.gz: 622b67bfef11facd70f05ddb620183c94dc3edd840863a22220956982da2efe33d9982a40ee159809a49a54d0cfcd2371d74b7cb31b56b4350c7a51888f3f4ab
@@ -82,18 +82,22 @@ class Features::ForemanTasks < ForemanMaintain::Feature
82
82
  def delete(state)
83
83
  tasks_condition = condition(state)
84
84
 
85
- feature(:foreman_database).psql(<<-SQL)
86
- BEGIN;
87
- DELETE FROM dynflow_steps USING foreman_tasks_tasks WHERE (foreman_tasks_tasks.external_id = dynflow_steps.execution_plan_uuid::varchar) AND #{tasks_condition};
88
- DELETE FROM dynflow_actions USING foreman_tasks_tasks WHERE (foreman_tasks_tasks.external_id = dynflow_actions.execution_plan_uuid::varchar) AND #{tasks_condition};
89
- DELETE FROM dynflow_execution_plans USING foreman_tasks_tasks WHERE (foreman_tasks_tasks.external_id = dynflow_execution_plans.uuid::varchar) AND #{tasks_condition};
90
- DELETE FROM foreman_tasks_tasks WHERE #{tasks_condition};
91
- -- Delete locks and links which may now be orphaned
92
- DELETE FROM foreman_tasks_locks as ftl where ftl.id NOT IN (SELECT id FROM foreman_tasks_tasks);
93
- DELETE FROM foreman_tasks_links as ftl where ftl.id NOT IN (SELECT id FROM foreman_tasks_tasks);
94
- COMMIT;
85
+ sql = <<-SQL
86
+ DELETE FROM dynflow_steps USING foreman_tasks_tasks WHERE (foreman_tasks_tasks.external_id = dynflow_steps.execution_plan_uuid::varchar) AND #{tasks_condition};
87
+ DELETE FROM dynflow_actions USING foreman_tasks_tasks WHERE (foreman_tasks_tasks.external_id = dynflow_actions.execution_plan_uuid::varchar) AND #{tasks_condition};
88
+ DELETE FROM dynflow_execution_plans USING foreman_tasks_tasks WHERE (foreman_tasks_tasks.external_id = dynflow_execution_plans.uuid::varchar) AND #{tasks_condition};
89
+ DELETE FROM foreman_tasks_tasks WHERE #{tasks_condition};
90
+ -- Delete locks and links which may now be orphaned
91
+ DELETE FROM foreman_tasks_locks as ftl where ftl.task_id NOT IN (SELECT id FROM foreman_tasks_tasks);
95
92
  SQL
96
93
 
94
+ if check_min_version(foreman_plugin_name('foreman-tasks'), '4.0.0')
95
+ sql += 'DELETE FROM foreman_tasks_links as ftl ' \
96
+ 'where ftl.task_id NOT IN (SELECT id FROM foreman_tasks_tasks);'
97
+ end
98
+
99
+ feature(:foreman_database).psql("BEGIN; #{sql}; COMMIT;")
100
+
97
101
  count(state)
98
102
  end
99
103
 
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '0.8.24'.freeze
2
+ VERSION = '0.8.25'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_maintain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.24
4
+ version: 0.8.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-09 00:00:00.000000000 Z
11
+ date: 2022-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp