avst-wizard 0.0.36 → 0.0.37

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: 2ee2da0daaa4a3ca100f74e05003691cce0cd4103c2f6552335a1261c0b027e4
4
- data.tar.gz: 4b75fc0e27bcda51bc8f237890067c17b56033755b446e663c8f6c607b18e875
3
+ metadata.gz: a8d37c5820ea2f6fd92a477ccdee3c2e05678005cad08336d4872ccb7624ef71
4
+ data.tar.gz: 10c1045d59f7c9c2e1b4e935a790f784e26180b3c6098cfdf5e7240f3932087a
5
5
  SHA512:
6
- metadata.gz: 39e7116d9b6ba67513541a3f0fb81866b7fde3ddb50df901f1fb141a9d80e54c2e45d94e9a16118d2062cd755f5d85c2c091269f3094ac07d4213c7570c8647d
7
- data.tar.gz: bb5cc00b75e0ca00cf059a2436cdfa38d3ac49d66c9219204eb3fd2d22933053875f6062cb8e0056ddc6ce7877551f3727daf9ec5f9174596794f48da8aeaa7f
6
+ metadata.gz: 38dc274c2f493edd5313a2f56598b94311b18758b7828d6220dc6c8e4bfb847a7a230eb15dff67c9d378b531210a0e4506c80704f17b3515052f344a7861b74e
7
+ data.tar.gz: d4be9c5face01d2a53d450c8bd315304056d214de0fac8b1a351fad3a9dac40c36db5400cf8612ca549e80f3ee0dd56b70ce60c2169dd0d3a63af981307dcfcc
data/README.md CHANGED
@@ -23,11 +23,14 @@ avst-wizard --hostname hostname --product_type product_type --base_url url --hie
23
23
  - hostname - will reference custom hiera config
24
24
  - product_type - the product, one of (bamboo, confluence, crowd, fisheye, jira, stash)
25
25
  - url - url to access the instance, http://jira.vagrant or http://jira.vagrant:8090
26
+ - context_path - context path of the url
26
27
  - hiera_config - custom hiera.yaml file, defaults to hiera.yaml in project root
27
28
  - custom_config - file with required params setup, defaults to config/config.yaml
28
29
  - ops - Prints out required parameters to set for specified product
29
30
  -p, --use_tomcat_port PORT - Use tomcat port to connect to the application
30
31
 
32
+ An example: avst-wizard --custom_config /tmp/avst-wizard.yaml --product_type jira --base_url https://server.adaptavist.com/jira --context_path /jira --version 6.4.14
33
+
31
34
  ## Default usage and configuration
32
35
 
33
36
  Each Atlassian app requires in default usage parameters. The list per product_type can be displayed while running
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "avst-wizard"
7
- spec.version = '0.0.36'
7
+ spec.version = '0.0.37'
8
8
  spec.authors = ["Martin Brehovsky"]
9
9
  spec.email = ["mbrehovsky@adaptavist.com"]
10
10
  spec.summary = %q{Avstwizard}
@@ -36,6 +36,7 @@ Options:
36
36
  -n, --hostname HOST Hostname for the server
37
37
  -p, --product_type PRODUCT_TYPE Type of atlassian product (jira, confluence,...)
38
38
  -b, --base_url BASE_URL Url where the product is accessible
39
+ -t, --context_path CONTEXT_PATH The context_path, if used, e.g /jira
39
40
  -c, --hiera_config CONFIG Hiera config file
40
41
  -f, --custom_config CUSTOM Contains key-values that will be available to hiera to configure stages [default: #{avst_wizard_base}/config/config.yaml]
41
42
  -p, --use_tomcat_port PORT Use tomcat port to connect to the application
@@ -54,6 +55,7 @@ end
54
55
  hostname = options["--hostname"]
55
56
  product_type = options["--product_type"]
56
57
  base_url = options["--base_url"]
58
+ context_path = options["--context_path"]
57
59
  use_tomcat_port = options["--use_tomcat_port"]
58
60
 
59
61
  hiera_config = options["--hiera_config"]
@@ -147,7 +149,7 @@ begin
147
149
  host_url = nil
148
150
  puts "Going via #{base_url}"
149
151
  end
150
- runner = AvstWizard::AvstWizard.new(base_url, required_config, url_required_part, host_url)
152
+ runner = AvstWizard::AvstWizard.new(base_url, context_path, required_config, url_required_part, host_url)
151
153
 
152
154
 
153
155
  # wait for app to start
@@ -24,7 +24,7 @@ module AvstWizard
24
24
 
25
25
  attr_writer :atl_token
26
26
 
27
- def initialize(url, required_config = {}, url_required_part=nil, host_url)
27
+ def initialize(url, context_path, required_config = {}, url_required_part=nil, host_url)
28
28
  @url = url
29
29
  @cookie = ""
30
30
  @current_url = ""
@@ -32,6 +32,7 @@ module AvstWizard
32
32
  @required_config = required_config
33
33
  @url_required_part = url_required_part
34
34
  @host_url = host_url
35
+ @context_path = context_path
35
36
  end
36
37
 
37
38
  # Does GET requests to url, follows redirects, stores cookies and xsrf.token if present
@@ -109,11 +110,11 @@ module AvstWizard
109
110
  else
110
111
  # in Jira 7.1.7 location is databaseSetup.jspa not secure/databaseSetup.jspa
111
112
  if @url_required_part and !location.include? "/#{@url_required_part}/"
112
- "#{@url}/#{@url_required_part}/#{location}"
113
+ "#{@url}/#{@url_required_part}/#{remove_context_path(location)}"
113
114
  else
114
115
  # if required url part is present prepend url
115
116
  # TODO: better check with regexp
116
- "#{@url}#{location}"
117
+ "#{@url}#{remove_context_path(location)}"
117
118
  end
118
119
  end
119
120
 
@@ -131,7 +132,11 @@ module AvstWizard
131
132
 
132
133
  # get rid of params and other trash
133
134
  def get_current_url
134
- @current_url.split(";")[0].split("?")[0]
135
+ remove_context_path(@current_url)
136
+ end
137
+
138
+ def remove_context_path(url)
139
+ @context_path ? url.split(";")[0].split("?")[0].sub(@context_path, "") : url.split(";")[0].split("?")[0]
135
140
  end
136
141
 
137
142
  # get the value from the page's element
@@ -233,10 +238,10 @@ module AvstWizard
233
238
  response = http.request(req)
234
239
  puts "Response: #{response.inspect}".yellow
235
240
  puts "Location: #{response['location'].to_s}".yellow
236
- puts "Current : #{@url}#{@current_url}".yellow
241
+ puts "Current : #{@url}#{get_current_url}".yellow
237
242
  # puts "BODY: #{response.body}"
238
243
  redirected = true
239
- if response['location'] and !"#{@url}/#{@current_url}".include? response['location']
244
+ if response['location'] and !"#{@url}/#{get_current_url}".include? response['location']
240
245
  redirection_url = compose_redirection_url(response['location'])
241
246
  @current_url = URI.parse(redirection_url).request_uri
242
247
  else
@@ -255,7 +260,7 @@ module AvstWizard
255
260
  # follow redirects, if redirected
256
261
  if redirected and redirected == true
257
262
  puts "Doing the redirection... #{redirected}".yellow
258
- get_stage_and_fetch_cookie("#{@url}#{@current_url}")
263
+ get_stage_and_fetch_cookie("#{@url}#{get_current_url}")
259
264
  else
260
265
  # in case the app is waiting for an event
261
266
  if wait_for_next_state != nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avst-wizard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.36
4
+ version: 0.0.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Brehovsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-26 00:00:00.000000000 Z
11
+ date: 2018-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler