foreman-tasks 5.2.0 → 5.2.1

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: fa2189368cc093a6ca613ca1b91add99bc3689b2cb22cd0c04a3718821b5f27f
4
- data.tar.gz: f7e82294bbbb76fe6576b6c2de9e55c16342962f711a8e5c9070787be304a87c
3
+ metadata.gz: affb6b8dabd35bf7600c2c76aa6f129dab3d43cbddc24120d89bbe898355adf2
4
+ data.tar.gz: 57e68fca3c4e837f5ccb5073c8c8459dbda2e98975c2211d4f583daa478ebbf0
5
5
  SHA512:
6
- metadata.gz: f20e5fba4dbc2401a4fed1f5eb68961ccc7095071fc309316ad14392b9209141e96aa2372eb7bb5db0e7f829ef08727ff2e232e53de86baa8385183ddb722252
7
- data.tar.gz: 534ac74d1c8010ac25330562a6bdb713beacc413d2c681ee72f865727741cfb17e04d9dda2c0ea8ab7bde2f7f2e08f54fa4266e25686ca9d1f38c5309b24b94c
6
+ metadata.gz: 117021731b7da694348b5b29564a3662b35a6de175b056db4ede99707ccace227f5815ace3adb9caee3e094aeba2fd9a0b722ad71c67c9405b8d2a97f33c16d1
7
+ data.tar.gz: 95a05ed5983f03aa8db0233d5f8c2dce7031eeae15f79ecb1fa936212920017da59d629a28908fde3469c3b7652c8ee4ae68f89b0aef4229152fad4f509283fc
@@ -21,6 +21,21 @@ function build_rake() {
21
21
  echo
22
22
  }
23
23
 
24
+ function incorrect_usage() {
25
+ echo "$1" >&2
26
+ echo
27
+ usage
28
+
29
+ exit 1
30
+ }
31
+
32
+ function validate_options!() {
33
+ if [ -z "$TASK_SEARCH" ]; then
34
+ [ -n "$AFTER" ] && incorrect_usage "Error: -a|--after cannot be used without -s|--search"
35
+ [ -n "$STATES" ] && incorrect_usage "Error: -S|--states cannot be used without -s|--search"
36
+ fi
37
+ }
38
+
24
39
  function usage() {
25
40
  cat << EOF
26
41
  Usage: $PROGNAME [script_options...] [options...]
@@ -43,8 +58,8 @@ EOF
43
58
  echo Cleanup options:
44
59
  cat <<EOF | column -s\& -t
45
60
  -B|--batch-size BATCH_SIZE & process tasks in batches of BATCH_SIZE, 1000 by default
46
- -S|--states STATES & operate on tasks in STATES, comma separated list of states, set to all to operate on tasks in any state
47
- -a|--after AGE & operate on tasks older than AGE. Expected format is a number followed by the time unit (s,h,m,y), such as '10d' for 10 days
61
+ -S|--states STATES & operate on tasks in STATES, comma separated list of states, set to all to operate on tasks in any state. Has to be used together with -s|--search
62
+ -a|--after AGE & operate on tasks older than AGE. Expected format is a number followed by the time unit (s,h,m,y), such as '10d' for 10 days. Has to be used together with -s|--search
48
63
  -b|--backup & backup deleted tasks
49
64
  -n|--noop & do a dry run, print what would be done
50
65
  -s|--search QUERY & use QUERY in scoped search format to match tasks to delete
@@ -119,6 +134,8 @@ while true; do
119
134
  shift
120
135
  done
121
136
 
137
+ validate_options!
138
+
122
139
  if [ "$EXECUTE" -eq 1 ]; then
123
140
  build_rake | sh
124
141
  else
@@ -300,7 +300,7 @@ namespace :foreman_tasks do
300
300
  end
301
301
  end
302
302
 
303
- SKIP_ERRORS = ['true', '1', 'y', 'yes'].include? ENV['SKIP_FAILED'].downcase
303
+ SKIP_ERRORS = ['true', '1', 'y', 'yes'].include? (ENV['SKIP_FAILED'] || '').downcase
304
304
 
305
305
  filter = if ENV['TASK_SEARCH'].nil? && ENV['TASK_DAYS'].nil?
306
306
  "started_at > \"#{7.days.ago.to_s(:db)}\" || " \
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = '5.2.0'.freeze
2
+ VERSION = '5.2.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman-tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0
4
+ version: 5.2.1
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: 2021-11-11 00:00:00.000000000 Z
11
+ date: 2022-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dynflow