ops_manager_ui_drivers 2.38.0 → 2.39.0

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
  SHA1:
3
- metadata.gz: c4262f871354d3b702ed178707a0cb3d48aa0636
4
- data.tar.gz: 2f3c8c47cec74d4494ae43cf2ebcc0050bcb5846
3
+ metadata.gz: da61c9c42150aa9081f7cf5372522cac0c38ad66
4
+ data.tar.gz: 5c0cfa42da0ac2295b544beabeadfd7a026d8853
5
5
  SHA512:
6
- metadata.gz: 5babc80b4c96ba1a49259fa71acd864aea9db976d642f69d13e83f311d1d55be78313f29db68ad2808272b100f4a224f8dc235c69662372f87ca3f44462b712d
7
- data.tar.gz: 04399690977f72cf42ce5a5ec2fd4b27446a85988f71e969d5a082890c2bb9e60aa4a61f4488c70dee49079cb274220c3063fba0bfdd241f87c96180f3b12969
6
+ metadata.gz: b0a9f47efd363554ac1cda74e558da094ab85326002e3c7cb90c946e6e3875ace23a2fba4ab7b08a74b91726753ffb01a9b1873f23eec882489263b7c6935aec
7
+ data.tar.gz: 77d88f0ac130aa9b0e70cc833097f9f277720516f44b70ba6a65fa52b72fb257902d356bd67c641e54b53eb4ce3d0968e0e7e00720c86c55278829312ece179e
@@ -1,3 +1,3 @@
1
1
  module OpsManagerUiDrivers
2
- VERSION = '2.38.0'
2
+ VERSION = '2.39.0'
3
3
  end
@@ -3,6 +3,74 @@ require 'ops_manager_ui_drivers/version19/product_dashboard'
3
3
  module OpsManagerUiDrivers
4
4
  module Version110
5
5
  class ProductDashboard < Version19::ProductDashboard
6
+ def apply_updates(validate: true, errands: {})
7
+ open_dashboard
8
+ select_errand_states(errands)
9
+
10
+ browser.click_on 'install-action'
11
+ if validate
12
+ fail 'Install failed verification' if nonignorable_verification_failed?
13
+ allow_cpu_verification_errors
14
+ allow_privilege_verification_errors
15
+ allow_icmp_verification_errors #this is only for AWS; consider moving out
16
+
17
+ ignore_allowable_errors
18
+ assert_installation_started
19
+ end
20
+
21
+ ApplyUpdatesResult.new(browser: @browser)
22
+ end
23
+
24
+ def errands_with_state(product_name, errand_state)
25
+ option_value = translate_errand_state(errand_state)
26
+ open_dashboard
27
+ browser.execute_script "$('li.expandable > a.title').click()"
28
+ browser.all("[ name ^= 'errands[#{product_name}-' ]").
29
+ select { |select| select[:value] == option_value }.
30
+ map { |select| select[:name].match(/^errands\[.*\]\[run_(?:post_deploy|pre_delete)\]\[(.*)\]$/)[1]}
31
+ end
32
+
33
+ private
34
+
35
+ def translate_errand_state(errand_state)
36
+ case errand_state
37
+ when 'On'
38
+ 'true'
39
+ when 'Off'
40
+ 'false'
41
+ when 'When Changed'
42
+ 'when-changed'
43
+ else
44
+ raise "Unknown errand state: #{errand_state.inspect}"
45
+ end
46
+ end
47
+
48
+ def select_errand_states(errands)
49
+ browser.execute_script "$('li.expandable > a.title').click()"
50
+
51
+ errands.each do |product_name, errand_types|
52
+ errand_types.each do |errand_type, errand_selections|
53
+ errand_selections.each do |errand_identifier, errand_run_state|
54
+
55
+ state_map = {
56
+ true => 0,
57
+ false => 1,
58
+ 'when-changed' => 2,
59
+ }
60
+
61
+ browser.execute_script(
62
+ <<-JS
63
+ $(
64
+ '[ name ^= "errands[#{product_name}-" ]' +
65
+ '[ name *= "][#{errand_type}" ]' +
66
+ '[ name $= "][#{errand_identifier}]" ]'
67
+ ).prop('selectedIndex', #{state_map[errand_run_state]})
68
+ JS
69
+ )
70
+ end
71
+ end
72
+ end
73
+ end
6
74
  end
7
75
  end
8
76
  end
@@ -3,43 +3,39 @@ require 'ops_manager_ui_drivers/version19/product_errands'
3
3
  module OpsManagerUiDrivers
4
4
  module Version110
5
5
  class ProductErrands < Version19::ProductErrands
6
- def enable_errand(errand_name)
6
+ def set_errand_state(errand_name, errand_state)
7
+ validate_errand_state(errand_state)
7
8
  open_form
8
- set_check_box("errands[#{errand_name}][run_errand_pre_delete]", true)
9
- set_check_box("errands[#{errand_name}][run_errand_post_deploy]", true)
9
+ browser.first(:css, %Q(select[name*="#{errand_name}"])).select(errand_state.to_s)
10
10
  save_form
11
11
  end
12
12
 
13
- def disable_errand(errand_name)
14
- open_form
15
- set_check_box("errands[#{errand_name}][run_errand_pre_delete]", false)
16
- set_check_box("errands[#{errand_name}][run_errand_post_deploy]", false)
17
- save_form
18
- end
13
+ def errands_with_state(errand_state)
14
+ validate_errand_state(errand_state)
19
15
 
20
- def enabled_errands
21
16
  open_form
22
17
 
23
18
  result = []
24
19
 
25
- browser.all("input[type='checkbox'][name^='errands['][name$='][run_errand_post_deploy]'][checked='checked']").map do |checkbox|
26
- errand_name = checkbox[:name].match(/errands\[(.*)\]\[run_errand_post_deploy\]/)[1]
27
- result << errand_name
28
- end
29
-
30
- browser.all("input[type='checkbox'][name^='errands['][name$='][run_errand_pre_delete]'][checked='checked']").map do |checkbox|
31
- errand_name = checkbox[:name].match(/errands\[(.*)\]\[run_errand_pre_delete\]/)[1]
32
- result << errand_name
20
+ browser.all("select[ name^='errands[' ][ name*='][run_errand_' ]").map do |errand|
21
+ errand_name = errand[:name].match(/errands\[(.*)\]\[run_errand_.*\]/)[1]
22
+ selected_option = errand.find('option[selected]')
23
+ result << errand_name if selected_option.text == errand_state
33
24
  end
34
25
 
35
26
  result
36
27
  end
37
28
 
29
+ %i(enabled_errands enable_errand disable_errand).each do |method_name|
30
+ define_method(method_name) do
31
+ raise "#{method_name} is deprecated in 1.10 and above"
32
+ end
33
+ end
34
+
38
35
  private
39
36
 
40
- def set_check_box(name, value)
41
- check_box = browser.first(:css, %Q(input[type="checkbox"][name="#{name}"]))
42
- check_box.set(value) if check_box
37
+ def validate_errand_state(errand_state)
38
+ raise "Invalid errand state: #{errand_state.inspect}" unless ['On', 'Off', 'When Changed'].include?(errand_state)
43
39
  end
44
40
  end
45
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ops_manager_ui_drivers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.38.0
4
+ version: 2.39.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-09 00:00:00.000000000 Z
11
+ date: 2017-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport