ruby_aem 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruby_aem/client.rb +14 -19
- data/lib/ruby_aem/error.rb +13 -17
- data/lib/ruby_aem/handlers/file.rb +14 -19
- data/lib/ruby_aem/handlers/html.rb +17 -24
- data/lib/ruby_aem/handlers/json.rb +19 -33
- data/lib/ruby_aem/handlers/simple.rb +18 -22
- data/lib/ruby_aem/handlers/xml.rb +14 -19
- data/lib/ruby_aem/resources/aem.rb +25 -30
- data/lib/ruby_aem/resources/bundle.rb +13 -17
- data/lib/ruby_aem/resources/config_property.rb +13 -18
- data/lib/ruby_aem/resources/flush_agent.rb +25 -25
- data/lib/ruby_aem/resources/group.rb +19 -27
- data/lib/ruby_aem/resources/node.rb +15 -19
- data/lib/ruby_aem/resources/outbox_replication_agent.rb +23 -23
- data/lib/ruby_aem/resources/package.rb +46 -46
- data/lib/ruby_aem/resources/path.rb +13 -17
- data/lib/ruby_aem/resources/replication_agent.rb +23 -23
- data/lib/ruby_aem/resources/repository.rb +13 -17
- data/lib/ruby_aem/resources/reverse_replication_agent.rb +23 -23
- data/lib/ruby_aem/resources/user.rb +18 -26
- data/lib/ruby_aem/response.rb +13 -17
- data/lib/ruby_aem/result.rb +13 -17
- data/lib/ruby_aem/swagger.rb +20 -26
- data/lib/ruby_aem.rb +29 -32
- metadata +5 -5
@@ -1,24 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
limitations under the License.
|
15
|
-
=end
|
1
|
+
# Copyright 2016-2017 Shine Solutions
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
16
14
|
|
17
15
|
module RubyAem
|
18
16
|
module Resources
|
19
17
|
# Bundle class contains API calls related to managing an AEM bundle.
|
20
18
|
class Bundle
|
21
|
-
|
22
19
|
# Initialise a bundle.
|
23
20
|
#
|
24
21
|
# @param client RubyAem::Client
|
@@ -44,7 +41,6 @@ module RubyAem
|
|
44
41
|
def stop
|
45
42
|
@client.call(self.class, __callee__.to_s, @call_params)
|
46
43
|
end
|
47
|
-
|
48
44
|
end
|
49
45
|
end
|
50
46
|
end
|
@@ -1,25 +1,22 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
limitations under the License.
|
15
|
-
=end
|
1
|
+
# Copyright 2016-2017 Shine Solutions
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
16
14
|
require 'ruby_aem/swagger'
|
17
15
|
|
18
16
|
module RubyAem
|
19
17
|
module Resources
|
20
18
|
# ConfigProperty class contains API calls related to managing an AEM config property.
|
21
19
|
class ConfigProperty
|
22
|
-
|
23
20
|
# Initialise a config property
|
24
21
|
#
|
25
22
|
# @param client RubyAem::Client
|
@@ -42,7 +39,6 @@ module RubyAem
|
|
42
39
|
# @param @param config_node_name the node name of a given OSGI config
|
43
40
|
# @return RubyAem::Result
|
44
41
|
def create(run_mode, config_node_name)
|
45
|
-
|
46
42
|
name = RubyAem::Swagger.property_to_parameter(@call_params[:name])
|
47
43
|
type_hint_prefix = name.gsub(/^_/, '')
|
48
44
|
|
@@ -54,7 +50,6 @@ module RubyAem
|
|
54
50
|
config_name = Swagger.config_node_name_to_config_name(config_node_name)
|
55
51
|
@client.call(self.class, __callee__.to_s.concat(config_name.downcase.gsub(/\s+/, '')), @call_params)
|
56
52
|
end
|
57
|
-
|
58
53
|
end
|
59
54
|
end
|
60
55
|
end
|
@@ -1,25 +1,22 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
limitations under the License.
|
15
|
-
=end
|
1
|
+
# Copyright 2016-2017 Shine Solutions
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
16
14
|
require 'uri'
|
17
15
|
|
18
16
|
module RubyAem
|
19
17
|
module Resources
|
20
18
|
# FlushAgent class contains API calls related to managing an AEM flush agent.
|
21
19
|
class FlushAgent
|
22
|
-
|
23
20
|
# Initialise a flush agent.
|
24
21
|
#
|
25
22
|
# @param client RubyAem::Client
|
@@ -41,13 +38,17 @@ module RubyAem
|
|
41
38
|
# @param dest_base_url base URL of the agent target destination, e.g. http://somedispatcher:8080
|
42
39
|
# @param opts optional parameters:
|
43
40
|
# - log_level: error, info, debug, default is error
|
44
|
-
# - retry_delay: in milliseconds, default is
|
41
|
+
# - retry_delay: in milliseconds, default is 30_000
|
45
42
|
# @return RubyAem::Result
|
46
|
-
def create_update(
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
43
|
+
def create_update(
|
44
|
+
title,
|
45
|
+
description,
|
46
|
+
dest_base_url,
|
47
|
+
opts = {
|
48
|
+
log_level: 'error',
|
49
|
+
retry_delay: 30_000
|
50
|
+
}
|
51
|
+
)
|
51
52
|
@call_params[:title] = title
|
52
53
|
@call_params[:description] = description
|
53
54
|
@call_params[:dest_base_url] = dest_base_url
|
@@ -62,7 +63,7 @@ module RubyAem
|
|
62
63
|
# Delete the flush agent.
|
63
64
|
#
|
64
65
|
# @return RubyAem::Result
|
65
|
-
def delete
|
66
|
+
def delete
|
66
67
|
@client.call(self.class, __callee__.to_s, @call_params)
|
67
68
|
end
|
68
69
|
|
@@ -71,10 +72,9 @@ module RubyAem
|
|
71
72
|
# false otherwise.
|
72
73
|
#
|
73
74
|
# @return RubyAem::Result
|
74
|
-
def exists
|
75
|
+
def exists
|
75
76
|
@client.call(self.class, __callee__.to_s, @call_params)
|
76
77
|
end
|
77
|
-
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
@@ -1,24 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
limitations under the License.
|
15
|
-
=end
|
1
|
+
# Copyright 2016-2017 Shine Solutions
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
16
14
|
|
17
15
|
module RubyAem
|
18
16
|
module Resources
|
19
17
|
# Group class contains API calls related to managing an AEM group.
|
20
18
|
class Group
|
21
|
-
|
22
19
|
# Initialise a group.
|
23
20
|
#
|
24
21
|
# @param client RubyAem::Client
|
@@ -36,17 +33,15 @@ module RubyAem
|
|
36
33
|
# Create a new group.
|
37
34
|
#
|
38
35
|
# @return RubyAem::Result
|
39
|
-
def create
|
40
|
-
|
41
|
-
@call_params[:path] = "/#{@call_params[:path]}"
|
42
|
-
end
|
36
|
+
def create
|
37
|
+
@call_params[:path] = "/#{@call_params[:path]}" unless @call_params[:path].match(%r{^/})
|
43
38
|
@client.call(self.class, __callee__.to_s, @call_params)
|
44
39
|
end
|
45
40
|
|
46
41
|
# Delete the group.
|
47
42
|
#
|
48
43
|
# @return RubyAem::Result
|
49
|
-
def delete
|
44
|
+
def delete
|
50
45
|
result = find_authorizable_id
|
51
46
|
@call_params[:authorizable_id] = result.data
|
52
47
|
@call_params[:path] = RubyAem::Swagger.path(@call_params[:path])
|
@@ -58,7 +53,7 @@ module RubyAem
|
|
58
53
|
# false otherwise.
|
59
54
|
#
|
60
55
|
# @return RubyAem::Result
|
61
|
-
def exists
|
56
|
+
def exists
|
62
57
|
result = find_authorizable_id
|
63
58
|
@call_params[:authorizable_id] = result.data
|
64
59
|
@call_params[:path] = RubyAem::Swagger.path(@call_params[:path])
|
@@ -93,13 +88,10 @@ module RubyAem
|
|
93
88
|
# cannot be found.
|
94
89
|
#
|
95
90
|
# @return RubyAem::Result
|
96
|
-
def find_authorizable_id
|
97
|
-
|
98
|
-
@call_params[:path] = "/#{@call_params[:path]}"
|
99
|
-
end
|
91
|
+
def find_authorizable_id
|
92
|
+
@call_params[:path] = "/#{@call_params[:path]}" unless @call_params[:path].match(%r{^/})
|
100
93
|
@client.call(self.class, __callee__.to_s, @call_params)
|
101
94
|
end
|
102
|
-
|
103
95
|
end
|
104
96
|
end
|
105
97
|
end
|
@@ -1,24 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
limitations under the License.
|
15
|
-
=end
|
1
|
+
# Copyright 2016-2017 Shine Solutions
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
16
14
|
|
17
15
|
module RubyAem
|
18
16
|
module Resources
|
19
17
|
# Node class contains API calls related to managing an AEM node.
|
20
18
|
class Node
|
21
|
-
|
22
19
|
# Initialise a node.
|
23
20
|
#
|
24
21
|
# @param client RubyAem::Client
|
@@ -47,7 +44,7 @@ module RubyAem
|
|
47
44
|
# Delete the node.
|
48
45
|
#
|
49
46
|
# @return RubyAem::Result
|
50
|
-
def delete
|
47
|
+
def delete
|
51
48
|
@client.call(self.class, __callee__.to_s, @call_params)
|
52
49
|
end
|
53
50
|
|
@@ -56,10 +53,9 @@ module RubyAem
|
|
56
53
|
# false otherwise.
|
57
54
|
#
|
58
55
|
# @return RubyAem::Result
|
59
|
-
def exists
|
56
|
+
def exists
|
60
57
|
@client.call(self.class, __callee__.to_s, @call_params)
|
61
58
|
end
|
62
|
-
|
63
59
|
end
|
64
60
|
end
|
65
61
|
end
|
@@ -1,24 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
limitations under the License.
|
15
|
-
=end
|
1
|
+
# Copyright 2016-2017 Shine Solutions
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
16
14
|
|
17
15
|
module RubyAem
|
18
16
|
module Resources
|
19
17
|
# OutboxReplicationAgent class contains API calls related to managing an AEM outbox replication agent.
|
20
18
|
class OutboxReplicationAgent
|
21
|
-
|
22
19
|
# Initialise a outbox replication agent.
|
23
20
|
#
|
24
21
|
# @param client RubyAem::Client
|
@@ -41,14 +38,18 @@ module RubyAem
|
|
41
38
|
# @param opts optional parameters:
|
42
39
|
# - user_id: outbox agent's user ID, default is admin
|
43
40
|
# - log_level: error, info, debug, default is error
|
44
|
-
# - retry_delay: in milliseconds, default is
|
41
|
+
# - retry_delay: in milliseconds, default is 30_000
|
45
42
|
# @return RubyAem::Result
|
46
|
-
def create_update(
|
43
|
+
def create_update(
|
44
|
+
title,
|
45
|
+
description,
|
46
|
+
dest_base_url,
|
47
47
|
opts = {
|
48
48
|
user_id: 'admin',
|
49
49
|
log_level: 'error',
|
50
|
-
retry_delay:
|
51
|
-
}
|
50
|
+
retry_delay: 30_000
|
51
|
+
}
|
52
|
+
)
|
52
53
|
@call_params[:title] = title
|
53
54
|
@call_params[:description] = description
|
54
55
|
@call_params[:dest_base_url] = dest_base_url
|
@@ -59,7 +60,7 @@ module RubyAem
|
|
59
60
|
# Delete the outbox replication agent.
|
60
61
|
#
|
61
62
|
# @return RubyAem::Result
|
62
|
-
def delete
|
63
|
+
def delete
|
63
64
|
@client.call(self.class, __callee__.to_s, @call_params)
|
64
65
|
end
|
65
66
|
|
@@ -68,10 +69,9 @@ module RubyAem
|
|
68
69
|
# false otherwise.
|
69
70
|
#
|
70
71
|
# @return RubyAem::Result
|
71
|
-
def exists
|
72
|
+
def exists
|
72
73
|
@client.call(self.class, __callee__.to_s, @call_params)
|
73
74
|
end
|
74
|
-
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
@@ -1,18 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
limitations under the License.
|
15
|
-
=end
|
1
|
+
# Copyright 2016-2017 Shine Solutions
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
16
14
|
|
17
15
|
require 'retries'
|
18
16
|
|
@@ -20,7 +18,6 @@ module RubyAem
|
|
20
18
|
module Resources
|
21
19
|
# Package class contains API calls related to managing an AEM package.
|
22
20
|
class Package
|
23
|
-
|
24
21
|
# Initialise a package.
|
25
22
|
# Package name and version will then be used to construct the package file in the filesystem.
|
26
23
|
# E.g. package name 'somepackage' with version '1.2.3' will translate to somepackage-1.2.3.zip in the filesystem.
|
@@ -42,7 +39,7 @@ module RubyAem
|
|
42
39
|
# Create the package.
|
43
40
|
#
|
44
41
|
# @return RubyAem::Result
|
45
|
-
def create
|
42
|
+
def create
|
46
43
|
@client.call(self.class, __callee__.to_s, @call_params)
|
47
44
|
end
|
48
45
|
|
@@ -59,14 +56,14 @@ module RubyAem
|
|
59
56
|
# Delete the package.
|
60
57
|
#
|
61
58
|
# @return RubyAem::Result
|
62
|
-
def delete
|
59
|
+
def delete
|
63
60
|
@client.call(self.class, __callee__.to_s, @call_params)
|
64
61
|
end
|
65
62
|
|
66
63
|
# Build the package.
|
67
64
|
#
|
68
65
|
# @return RubyAem::Result
|
69
|
-
def build
|
66
|
+
def build
|
70
67
|
@client.call(self.class, __callee__.to_s, @call_params)
|
71
68
|
end
|
72
69
|
|
@@ -76,8 +73,8 @@ module RubyAem
|
|
76
73
|
# - recursive: if true then subpackages will also be installed, false otherwise
|
77
74
|
# @return RubyAem::Result
|
78
75
|
def install(opts = {
|
79
|
-
|
80
|
-
|
76
|
+
recursive: true
|
77
|
+
})
|
81
78
|
@call_params = @call_params.merge(opts)
|
82
79
|
@client.call(self.class, __callee__.to_s, @call_params)
|
83
80
|
end
|
@@ -85,7 +82,7 @@ module RubyAem
|
|
85
82
|
# Uninstall the package.
|
86
83
|
#
|
87
84
|
# @return RubyAem::Result
|
88
|
-
def uninstall
|
85
|
+
def uninstall
|
89
86
|
@client.call(self.class, __callee__.to_s, @call_params)
|
90
87
|
end
|
91
88
|
|
@@ -93,7 +90,7 @@ module RubyAem
|
|
93
90
|
# Package will then be added to replication agents.
|
94
91
|
#
|
95
92
|
# @return RubyAem::Result
|
96
|
-
def replicate
|
93
|
+
def replicate
|
97
94
|
@client.call(self.class, __callee__.to_s, @call_params)
|
98
95
|
end
|
99
96
|
|
@@ -112,10 +109,12 @@ module RubyAem
|
|
112
109
|
# @param opts optional parameters:
|
113
110
|
# - force: if false then a package file will not be uploaded when the package already exists with the same group, name, and version, default is true (will overwrite existing package file)
|
114
111
|
# @return RubyAem::Result
|
115
|
-
def upload(
|
112
|
+
def upload(
|
113
|
+
file_path,
|
116
114
|
opts = {
|
117
115
|
force: true
|
118
|
-
}
|
116
|
+
}
|
117
|
+
)
|
119
118
|
@call_params[:file_path] = file_path
|
120
119
|
@call_params = @call_params.merge(opts)
|
121
120
|
@client.call(self.class, __callee__.to_s, @call_params)
|
@@ -125,7 +124,7 @@ module RubyAem
|
|
125
124
|
# Filter value is stored as result data as an array of paths.
|
126
125
|
#
|
127
126
|
# @return RubyAem::Result
|
128
|
-
def get_filter
|
127
|
+
def get_filter
|
129
128
|
@client.call(self.class, __callee__.to_s, @call_params)
|
130
129
|
end
|
131
130
|
|
@@ -138,7 +137,7 @@ module RubyAem
|
|
138
137
|
# @param modified_only if true, then only modified items in the path will be activated
|
139
138
|
# @return an array of RubyAem::Result
|
140
139
|
def activate_filter(ignore_deactivated, modified_only)
|
141
|
-
result = get_filter
|
140
|
+
result = get_filter
|
142
141
|
|
143
142
|
results = [result]
|
144
143
|
result.data.each { |filter_path|
|
@@ -151,7 +150,7 @@ module RubyAem
|
|
151
150
|
# List all packages available in AEM instance.
|
152
151
|
#
|
153
152
|
# @return RubyAem::Result
|
154
|
-
def list_all
|
153
|
+
def list_all
|
155
154
|
@client.call(self.class, __callee__.to_s, @call_params)
|
156
155
|
end
|
157
156
|
|
@@ -159,8 +158,8 @@ module RubyAem
|
|
159
158
|
# True result data indicates that the package is uploaded, false otherwise.
|
160
159
|
#
|
161
160
|
# @return RubyAem::Result
|
162
|
-
def is_uploaded
|
163
|
-
packages = list_all
|
161
|
+
def is_uploaded
|
162
|
+
packages = list_all.data
|
164
163
|
package = packages.xpath("//packages/package[group=\"#{@call_params[:group_name]}\" and name=\"#{@call_params[:package_name]}\" and version=\"#{@call_params[:package_version]}\"]")
|
165
164
|
|
166
165
|
if package.to_s != ''
|
@@ -180,8 +179,8 @@ module RubyAem
|
|
180
179
|
# True result data indicates that the package is installed, false otherwise.
|
181
180
|
#
|
182
181
|
# @return RubyAem::Result
|
183
|
-
def is_installed
|
184
|
-
packages = list_all
|
182
|
+
def is_installed
|
183
|
+
packages = list_all.data
|
185
184
|
package = packages.xpath("//packages/package[group=\"#{@call_params[:group_name]}\" and name=\"#{@call_params[:package_name]}\" and version=\"#{@call_params[:package_version]}\"]")
|
186
185
|
last_unpacked_by = package.xpath('lastUnpackedBy')
|
187
186
|
|
@@ -205,7 +204,8 @@ module RubyAem
|
|
205
204
|
# - force: if false then a package file will not be uploaded when the package already exists with the same group, name, and version, default is true (will overwrite existing package file)
|
206
205
|
# - _retries: retries library's options (http://www.rubydoc.info/gems/retries/0.0.5#Usage), restricted to max_trie, base_sleep_seconds, max_sleep_seconds
|
207
206
|
# @return RubyAem::Result
|
208
|
-
def upload_wait_until_ready(
|
207
|
+
def upload_wait_until_ready(
|
208
|
+
file_path,
|
209
209
|
opts = {
|
210
210
|
force: true,
|
211
211
|
_retries: {
|
@@ -213,7 +213,8 @@ module RubyAem
|
|
213
213
|
base_sleep_seconds: 2,
|
214
214
|
max_sleep_seconds: 2
|
215
215
|
}
|
216
|
-
}
|
216
|
+
}
|
217
|
+
)
|
217
218
|
opts[:force] ||= true
|
218
219
|
opts[:_retries] ||= {}
|
219
220
|
opts[:_retries][:max_tries] ||= 30
|
@@ -226,9 +227,9 @@ module RubyAem
|
|
226
227
|
opts[:_retries][:max_sleep_seconds] = opts[:_retries][:max_sleep_seconds].to_i
|
227
228
|
|
228
229
|
result = upload(file_path, opts)
|
229
|
-
with_retries(:
|
230
|
-
check_result = is_uploaded
|
231
|
-
puts 'Upload check #%d: %s - %s'
|
230
|
+
with_retries(max_tries: opts[:_retries][:max_tries], base_sleep_seconds: opts[:_retries][:base_sleep_seconds], max_sleep_seconds: opts[:_retries][:max_sleep_seconds]) { |retries_count|
|
231
|
+
check_result = is_uploaded
|
232
|
+
puts format('Upload check #%d: %s - %s', retries_count, check_result.data, check_result.message)
|
232
233
|
if check_result.data == false
|
233
234
|
raise StandardError.new(check_result.message)
|
234
235
|
end
|
@@ -259,10 +260,10 @@ module RubyAem
|
|
259
260
|
opts[:_retries][:base_sleep_seconds] = opts[:_retries][:base_sleep_seconds].to_i
|
260
261
|
opts[:_retries][:max_sleep_seconds] = opts[:_retries][:max_sleep_seconds].to_i
|
261
262
|
|
262
|
-
result = install
|
263
|
-
with_retries(:
|
264
|
-
check_result = is_installed
|
265
|
-
puts 'Install check #%d: %s - %s'
|
263
|
+
result = install
|
264
|
+
with_retries(max_tries: opts[:_retries][:max_tries], base_sleep_seconds: opts[:_retries][:base_sleep_seconds], max_sleep_seconds: opts[:_retries][:max_sleep_seconds]) { |retries_count|
|
265
|
+
check_result = is_installed
|
266
|
+
puts format('Install check #%d: %s - %s', retries_count, check_result.data, check_result.message)
|
266
267
|
if check_result.data == false
|
267
268
|
raise StandardError.new(check_result.message)
|
268
269
|
end
|
@@ -293,17 +294,16 @@ module RubyAem
|
|
293
294
|
opts[:_retries][:base_sleep_seconds] = opts[:_retries][:base_sleep_seconds].to_i
|
294
295
|
opts[:_retries][:max_sleep_seconds] = opts[:_retries][:max_sleep_seconds].to_i
|
295
296
|
|
296
|
-
result = delete
|
297
|
-
with_retries(:
|
298
|
-
check_result = is_uploaded
|
299
|
-
puts 'Delete check #%d: %s - %s'
|
297
|
+
result = delete
|
298
|
+
with_retries(max_tries: opts[:_retries][:max_tries], base_sleep_seconds: opts[:_retries][:base_sleep_seconds], max_sleep_seconds: opts[:_retries][:max_sleep_seconds]) { |retries_count|
|
299
|
+
check_result = is_uploaded
|
300
|
+
puts format('Delete check #%d: %s - %s', retries_count, !check_result.data, check_result.message)
|
300
301
|
if check_result.data == true
|
301
302
|
raise StandardError.new(check_result.message)
|
302
303
|
end
|
303
304
|
}
|
304
305
|
result
|
305
306
|
end
|
306
|
-
|
307
307
|
end
|
308
308
|
end
|
309
309
|
end
|