epc 1.0.4 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/epc.rb +3 -0
- data/lib/epc/client/base_client.rb +2 -1
- data/lib/epc/client/json_client.rb +22 -0
- data/lib/epc/command/archive_command.rb +1 -1
- data/lib/epc/command/attachto_command.rb +1 -1
- data/lib/epc/command/base_command.rb +35 -25
- data/lib/epc/command/build_command.rb +2 -2
- data/lib/epc/command/config/create_config_command.rb +1 -1
- data/lib/epc/command/config/delete_config_command.rb +4 -4
- data/lib/epc/command/config/list_configs_command.rb +1 -1
- data/lib/epc/command/config/update_config_command.rb +3 -3
- data/lib/epc/command/copy_command.rb +1 -1
- data/lib/epc/command/create_command.rb +1 -1
- data/lib/epc/command/delete_command.rb +2 -2
- data/lib/epc/command/deploy_command.rb +4 -3
- data/lib/epc/command/deployment/copy_deployment_command.rb +1 -1
- data/lib/epc/command/deployment/create_deployment_command.rb +3 -3
- data/lib/epc/command/deployment/list_deployments_command.rb +1 -1
- data/lib/epc/command/deployment/show_deployment_command.rb +1 -1
- data/lib/epc/command/deployment/submit_deployment_command.rb +1 -1
- data/lib/epc/command/deployment/update_deployment_command.rb +1 -1
- data/lib/epc/command/deployment/vote_deployment_command.rb +1 -1
- data/lib/epc/command/deploymentstage/list_deploymentstages_command.rb +1 -1
- data/lib/epc/command/detachfrom_command.rb +1 -1
- data/lib/epc/command/group/create_group_command.rb +1 -1
- data/lib/epc/command/group/delete_group_command.rb +1 -1
- data/lib/epc/command/group/list_groups_command.rb +1 -1
- data/lib/epc/command/group/show_group_command.rb +2 -1
- data/lib/epc/command/group/update_group_command.rb +1 -1
- data/lib/epc/command/library/create_library_command.rb +2 -2
- data/lib/epc/command/library/delete_library_command.rb +1 -1
- data/lib/epc/command/library/list_libraries_command.rb +1 -1
- data/lib/epc/command/librarylanguage/create_librarylanguage_command.rb +1 -1
- data/lib/epc/command/librarylanguage/delete_librarylanguage_command.rb +1 -1
- data/lib/epc/command/librarylanguage/list_librarylanguages_command.rb +1 -1
- data/lib/epc/command/librarylanguage/update_librarylanguage_command.rb +1 -1
- data/lib/epc/command/libraryset/create_libraryset_command.rb +2 -2
- data/lib/epc/command/libraryset/delete_libraryset_command.rb +1 -1
- data/lib/epc/command/libraryset/list_librarysets_command.rb +1 -1
- data/lib/epc/command/libraryset/show_libraryset_command.rb +1 -1
- data/lib/epc/command/libraryset/update_libraryset_command.rb +3 -3
- data/lib/epc/command/list_command.rb +1 -1
- data/lib/epc/command/objectrole/create_objectrole_command.rb +2 -1
- data/lib/epc/command/objectrole/list_objectroles_command.rb +1 -1
- data/lib/epc/command/objectrole/update_objectrole_command.rb +5 -1
- data/lib/epc/command/permission/list_permissions_command.rb +1 -1
- data/lib/epc/command/permissiongroup/list_permissiongroups_command.rb +1 -1
- data/lib/epc/command/plugin/create_plugin_command.rb +1 -1
- data/lib/epc/command/plugin/delete_plugin_command.rb +1 -1
- data/lib/epc/command/plugin/list_plugins_command.rb +1 -1
- data/lib/epc/command/plugin/show_plugin_command.rb +1 -1
- data/lib/epc/command/plugin/update_plugin_command.rb +2 -2
- data/lib/epc/command/project/archive_project_command.rb +1 -1
- data/lib/epc/command/project/attachto_project_command.rb +3 -3
- data/lib/epc/command/project/create_project_command.rb +2 -2
- data/lib/epc/command/project/delete_project_command.rb +1 -1
- data/lib/epc/command/project/detachfrom_project_command.rb +4 -4
- data/lib/epc/command/project/list_projects_command.rb +1 -1
- data/lib/epc/command/project/show_project_command.rb +2 -1
- data/lib/epc/command/project/unarchive_project_command.rb +1 -2
- data/lib/epc/command/project/update_project_command.rb +2 -2
- data/lib/epc/command/projecttype/create_projecttype_command.rb +3 -3
- data/lib/epc/command/projecttype/delete_projecttype_command.rb +2 -1
- data/lib/epc/command/projecttype/list_projecttypes_command.rb +1 -1
- data/lib/epc/command/projecttype/show_projecttype_command.rb +2 -1
- data/lib/epc/command/projecttype/update_projecttype_command.rb +4 -3
- data/lib/epc/command/pull_command.rb +12 -10
- data/lib/epc/command/push_command.rb +45 -29
- data/lib/epc/command/role/create_role_command.rb +1 -1
- data/lib/epc/command/role/delete_role_command.rb +2 -1
- data/lib/epc/command/role/list_roles_command.rb +2 -5
- data/lib/epc/command/role/show_role_command.rb +2 -2
- data/lib/epc/command/role/update_role_command.rb +1 -1
- data/lib/epc/command/runtime/create_runtime_command.rb +1 -1
- data/lib/epc/command/runtime/delete_runtime_command.rb +2 -1
- data/lib/epc/command/runtime/list_runtimes_command.rb +1 -1
- data/lib/epc/command/runtime/update_runtime_command.rb +4 -3
- data/lib/epc/command/runtimetype/list_runtimetypes_command.rb +1 -1
- data/lib/epc/command/servicedefinition/create_servicedefinition_command.rb +2 -2
- data/lib/epc/command/servicedefinition/delete_servicedefinition_command.rb +1 -1
- data/lib/epc/command/servicedefinition/list_servicedefinitions_command.rb +1 -1
- data/lib/epc/command/servicetype/list_servicetypes_command.rb +1 -1
- data/lib/epc/command/serviceversion/create_serviceversion_command.rb +2 -2
- data/lib/epc/command/serviceversion/delete_serviceversion_command.rb +3 -1
- data/lib/epc/command/serviceversion/list_serviceversions_command.rb +1 -1
- data/lib/epc/command/show_command.rb +1 -1
- data/lib/epc/command/solution/archive_solution_command.rb +1 -1
- data/lib/epc/command/solution/create_solution_command.rb +2 -2
- data/lib/epc/command/solution/delete_solution_command.rb +1 -1
- data/lib/epc/command/solution/list_solutions_command.rb +1 -1
- data/lib/epc/command/solution/show_solution_command.rb +1 -1
- data/lib/epc/command/solution/unarchive_solution_command.rb +1 -1
- data/lib/epc/command/solution/update_solution_command.rb +1 -1
- data/lib/epc/command/submit_command.rb +1 -1
- data/lib/epc/command/unarchive_command.rb +1 -1
- data/lib/epc/command/update_command.rb +1 -1
- data/lib/epc/command/user/create_user_command.rb +1 -1
- data/lib/epc/command/user/delete_user_command.rb +1 -1
- data/lib/epc/command/user/list_users_command.rb +1 -1
- data/lib/epc/command/user/show_user_command.rb +2 -1
- data/lib/epc/command/user/update_user_command.rb +3 -3
- data/lib/epc/command/userproperty/delete_user_property_command.rb +48 -0
- data/lib/epc/command/userproperty/get_user_property_command.rb +61 -0
- data/lib/epc/command/userproperty/list_user_properties_command.rb +1 -1
- data/lib/epc/command/userproperty/set_user_property_command.rb +52 -0
- data/lib/epc/command/vote_command.rb +1 -1
- data/lib/epc/config.rb +12 -0
- data/lib/epc/help.rb +20 -8
- data/lib/epc/runner.rb +22 -11
- data/lib/epc/version.rb +1 -1
- data/test/command/archive_project_command_test.rb +1 -1
- data/test/command/archive_solution_command_test.rb +1 -1
- data/test/command/build_command_test.rb +1 -1
- data/test/command/copy_deployment_command_test.rb +1 -1
- data/test/command/create_config_command_test.rb +1 -1
- data/test/command/create_deployment_command_test.rb +3 -3
- data/test/command/create_group_command_test.rb +1 -1
- data/test/command/create_library_command_test.rb +1 -1
- data/test/command/create_librarylanguage_command_test.rb +2 -2
- data/test/command/create_libraryset_command_test.rb +2 -2
- data/test/command/create_objectrole_command_test.rb +1 -1
- data/test/command/create_project_command_test.rb +2 -2
- data/test/command/create_projecttypes_command_test.rb +33 -0
- data/test/command/create_role_command_test.rb +10 -1
- data/test/command/create_runtime_command_test.rb +1 -1
- data/test/command/create_servicedefinition_command_test.rb +1 -1
- data/test/command/create_serviceversion_command_test.rb +1 -1
- data/test/command/create_solution_command_test.rb +2 -2
- data/test/command/create_user_command_test.rb +1 -1
- data/test/command/delete_config_command_test.rb +3 -3
- data/test/command/delete_library_command_test.rb +1 -1
- data/test/command/delete_librarylanguage_command_test.rb +1 -1
- data/test/command/delete_libraryset_command_test.rb +1 -1
- data/test/command/delete_plugin_command_test.rb +1 -1
- data/test/command/delete_project_command_test.rb +1 -1
- data/test/command/delete_projecttype_command_test.rb +1 -1
- data/test/command/delete_role_command_test.rb +1 -1
- data/test/command/delete_runtime_command_test.rb +1 -1
- data/test/command/delete_servicedefinition_command_test.rb +1 -1
- data/test/command/delete_serviceversion_command_test.rb +1 -1
- data/test/command/delete_solution_command_test.rb +1 -1
- data/test/command/delete_user_command_test.rb +1 -1
- data/test/command/delete_user_property_command_test.rb +60 -0
- data/test/command/deploy_command_test.rb +14 -6
- data/test/command/get_user_property_command_test.rb +58 -0
- data/test/command/list_command_test.rb +28 -0
- data/test/command/list_config_command_test.rb +1 -1
- data/test/command/list_deployments_command_test.rb +1 -1
- data/test/command/list_deploymentstages_command_test.rb +1 -1
- data/test/command/list_libraries_command_test.rb +1 -1
- data/test/command/list_librarylanguages_command_test.rb +1 -1
- data/test/command/list_librarysets_command_test.rb +1 -1
- data/test/command/list_objectroles_command_test.rb +1 -1
- data/test/command/list_permissiongroups_command_test.rb +1 -1
- data/test/command/list_permissions_command_test.rb +1 -1
- data/test/command/list_plugins_command_test.rb +1 -1
- data/test/command/list_projects_command_test.rb +1 -1
- data/test/command/list_projecttypes_command_test.rb +1 -1
- data/test/command/list_roles_command_test.rb +9 -1
- data/test/command/list_runtimes_command_test.rb +1 -1
- data/test/command/list_runtimetypes_command_test.rb +1 -1
- data/test/command/list_service_types_command_test.rb +1 -1
- data/test/command/list_servicedefinitions_command_test.rb +1 -1
- data/test/command/list_serviceversions_command_test.rb +1 -1
- data/test/command/list_solutions_command_test.rb +1 -1
- data/test/command/list_userproperties_command_test.rb +3 -3
- data/test/command/list_users_command_test.rb +1 -1
- data/test/command/pull_command_test.rb +8 -8
- data/test/command/push_command_test.rb +38 -8
- data/test/command/set_user_property_command_test.rb +50 -0
- data/test/command/show_command_test.rb +28 -0
- data/test/command/show_deployment_command_test.rb +1 -1
- data/test/command/show_group_command_test.rb +1 -1
- data/test/command/show_libraryset_command_test.rb +1 -1
- data/test/command/show_plugin_command_test.rb +1 -1
- data/test/command/show_project_command_test.rb +1 -1
- data/test/command/show_projecttype_command_test.rb +1 -1
- data/test/command/show_role_command_test.rb +1 -1
- data/test/command/show_solution_command_test.rb +1 -1
- data/test/command/show_user_command_test.rb +1 -1
- data/test/command/submit_deployment_command_test.rb +1 -1
- data/test/command/unarchive_project_command_test.rb +1 -1
- data/test/command/unarchive_solution_command_test.rb +1 -1
- data/test/command/update_config_command_test.rb +2 -2
- data/test/command/update_deployment_command_test.rb +1 -1
- data/test/command/update_group_command_test.rb +1 -1
- data/test/command/update_librarylanguage_command_test.rb +1 -1
- data/test/command/update_libraryset_command_test.rb +3 -3
- data/test/command/update_plugin_command_test.rb +2 -2
- data/test/command/update_project_command_test.rb +2 -2
- data/test/command/update_solution_command_test.rb +1 -1
- data/test/command/update_user_command_test.rb +2 -2
- data/test/command/vote_deployment_command_test.rb +1 -1
- metadata +38 -23
data/lib/epc.rb
CHANGED
@@ -144,6 +144,9 @@ module EPC
|
|
144
144
|
autoload(:UpdateProjecttypeCommand, "#{ROOT}/epc/command/projecttype/update_projecttype_command")
|
145
145
|
autoload(:ShowProjectSnapshotCommand, "#{ROOT}/epc/command/project/show_project_snapshot_command")
|
146
146
|
autoload(:ListUserpropertiesCommand, "#{ROOT}/epc/command/userproperty/list_user_properties_command")
|
147
|
+
autoload(:SetUserPropertyCommand, "#{ROOT}/epc/command/userproperty/set_user_property_command")
|
148
|
+
autoload(:GetUserPropertyCommand, "#{ROOT}/epc/command/userproperty/get_user_property_command")
|
149
|
+
autoload(:DeleteUserpropertyCommand, "#{ROOT}/epc/command/userproperty/delete_user_property_command")
|
147
150
|
|
148
151
|
|
149
152
|
autoload(:CreateCommand, "#{ROOT}/epc/command/create_command")
|
@@ -9,7 +9,7 @@ module EPC
|
|
9
9
|
class BadResponse < RuntimeError; end
|
10
10
|
class HTTPException < RuntimeError; end
|
11
11
|
|
12
|
-
def initialize(target_url=EPC::Config::DEFAULT_TARGET, caller_id = nil, auth_token = nil)
|
12
|
+
def initialize(target_url=EPC::Config::DEFAULT_TARGET, caller_id = nil, auth_token = nil, debug = false)
|
13
13
|
target_url = "http://#{target_url}" unless target_url =~ /^https?/
|
14
14
|
target_url = target_url.gsub(/\/+$/, '')
|
15
15
|
@target = target_url
|
@@ -17,6 +17,7 @@ module EPC
|
|
17
17
|
@caller_id = caller_id || EPC::Config.caller_id
|
18
18
|
@auth_token = auth_token || EPC::Config.auth_token
|
19
19
|
@digest = OpenSSL::Digest::Digest.new('sha256')
|
20
|
+
@debug = debug
|
20
21
|
end
|
21
22
|
|
22
23
|
# returns an array of status, body, response_headers
|
@@ -4,8 +4,10 @@ require 'json'
|
|
4
4
|
module EPC::Client
|
5
5
|
class JsonClient < HttpClient
|
6
6
|
def get(url, skip_signature = false)
|
7
|
+
debug_request(:get, url) if @debug
|
7
8
|
begin
|
8
9
|
status, body, headers = super(url, 'application/json', skip_signature)
|
10
|
+
debug_response(status, json_parse(body), headers) if @debug
|
9
11
|
[status, json_parse(body), headers]
|
10
12
|
rescue JSON::ParserError
|
11
13
|
raise BadResponse, "Invalid response received. Response status: #{status}", body
|
@@ -13,8 +15,10 @@ module EPC::Client
|
|
13
15
|
end
|
14
16
|
|
15
17
|
def post(url, payload = {}, skip_signature = false)
|
18
|
+
debug_request(:post, url, payload) if @debug
|
16
19
|
begin
|
17
20
|
status, body, headers = super(url, payload.to_json, 'application/json', {}, skip_signature)
|
21
|
+
debug_response(status, json_parse(body), headers) if @debug
|
18
22
|
[status, json_parse(body), headers]
|
19
23
|
rescue JSON::ParserError
|
20
24
|
raise BadResponse, "Invalid response received. Response status: #{status}", body
|
@@ -22,8 +26,10 @@ module EPC::Client
|
|
22
26
|
end
|
23
27
|
|
24
28
|
def put(url, payload = {})
|
29
|
+
debug_request(:put, url, payload) if @debug
|
25
30
|
begin
|
26
31
|
status, body, headers = super(url, payload.to_json, 'application/json')
|
32
|
+
debug_response(status, json_parse(body), headers) if @debug
|
27
33
|
[status, json_parse(body), headers]
|
28
34
|
rescue JSON::ParserError
|
29
35
|
raise BadResponse, "Invalid response received. Response status: #{status}", body
|
@@ -31,8 +37,10 @@ module EPC::Client
|
|
31
37
|
end
|
32
38
|
|
33
39
|
def delete(url, payload = {})
|
40
|
+
debug_request(:delete, url, payload) if @debug
|
34
41
|
begin
|
35
42
|
status, body, headers = super(url, payload.to_json, 'application/json')
|
43
|
+
debug_response(status, json_parse(body), headers) if @debug
|
36
44
|
[status, json_parse(body), headers]
|
37
45
|
rescue JSON::ParserError
|
38
46
|
raise BadResponse, "Invalid response received. Response status: #{status}", body
|
@@ -41,6 +49,20 @@ module EPC::Client
|
|
41
49
|
|
42
50
|
private
|
43
51
|
|
52
|
+
def debug_request(action, url, payload = nil)
|
53
|
+
say("\n## Request data")
|
54
|
+
say("\t" + action.to_s.capitalize + ": #{url}")
|
55
|
+
say("\t" + payload.to_s) if payload.present?
|
56
|
+
end
|
57
|
+
|
58
|
+
def debug_response(status, body, headers)
|
59
|
+
say("\n## Response data")
|
60
|
+
say("\tStatus: " + status.to_s)
|
61
|
+
say("\tResponse: " + body.to_s)
|
62
|
+
say("\tHeaders: " + headers.to_s)
|
63
|
+
say("\n\n")
|
64
|
+
end
|
65
|
+
|
44
66
|
def json_parse(body)
|
45
67
|
JSON.parse(body, :symbolize_names => true) if body
|
46
68
|
end
|
@@ -2,7 +2,7 @@ module EPC::Command
|
|
2
2
|
class ArchiveCommand < BaseCommand
|
3
3
|
|
4
4
|
def execute(*args)
|
5
|
-
raise
|
5
|
+
raise InputError, "You need to specify the object for the command" if args.blank?
|
6
6
|
params = resolve_context(args)
|
7
7
|
@klass_name = "EPC::Command::Archive#{@object_type.to_s.gsub("-","").capitalize}Command"
|
8
8
|
command = eval(@klass_name).new(client, @options)
|
@@ -2,7 +2,7 @@ module EPC::Command
|
|
2
2
|
class AttachtoCommand < BaseCommand
|
3
3
|
|
4
4
|
def execute(*args)
|
5
|
-
raise
|
5
|
+
raise InputError, "You need to specify the object for the command" if args.blank?
|
6
6
|
params = resolve_context(args)
|
7
7
|
@klass_name = "EPC::Command::Attachto#{@object_type.to_s.gsub("-","").capitalize}Command"
|
8
8
|
command = eval(@klass_name).new(client, @options)
|
@@ -15,22 +15,7 @@ module EPC
|
|
15
15
|
attr_accessor :object_id
|
16
16
|
attr_accessor :target_type
|
17
17
|
attr_accessor :target_id
|
18
|
-
|
19
|
-
|
20
|
-
@@retrieval_rules = {
|
21
|
-
:Role => {
|
22
|
-
:required_type => :numeric,
|
23
|
-
},
|
24
|
-
:User => {
|
25
|
-
:required_type => :numeric,
|
26
|
-
},
|
27
|
-
:UserGroup => {
|
28
|
-
:required_type => :numeric,
|
29
|
-
},
|
30
|
-
:LibrarySet => {
|
31
|
-
:required_type => :numeric,
|
32
|
-
}
|
33
|
-
}
|
18
|
+
attr_writer :klass_name
|
34
19
|
|
35
20
|
@@required_options = []
|
36
21
|
|
@@ -78,6 +63,11 @@ module EPC
|
|
78
63
|
end
|
79
64
|
end
|
80
65
|
|
66
|
+
def say_err(statement)
|
67
|
+
EPC::Config.say_err(statement)
|
68
|
+
end
|
69
|
+
|
70
|
+
|
81
71
|
def check_options
|
82
72
|
@@required_options.each do |req_opt|
|
83
73
|
raise FatalError, req_opt[:message] unless req_opt[:name].map{|opt| @options[opt].present?}.send(req_opt[:mode])
|
@@ -93,6 +83,11 @@ module EPC
|
|
93
83
|
@object_type, @object_id, @target_type, @target_id = params
|
94
84
|
end
|
95
85
|
|
86
|
+
def klass_name
|
87
|
+
return self.class.name if @klass_name.blank?
|
88
|
+
@klass_name
|
89
|
+
end
|
90
|
+
|
96
91
|
private
|
97
92
|
|
98
93
|
def translate_status_to_exit_code(status)
|
@@ -148,21 +143,35 @@ module EPC
|
|
148
143
|
return target_type.present? && target_id.present?
|
149
144
|
end
|
150
145
|
|
151
|
-
|
152
|
-
|
146
|
+
|
147
|
+
def has_object?
|
148
|
+
return object_type.present? && object_id.present?
|
153
149
|
end
|
154
150
|
|
155
|
-
def
|
156
|
-
|
151
|
+
def require_object(msg = "You need to specify the object")
|
152
|
+
if object_type.blank?
|
153
|
+
raise FatalError, msg
|
154
|
+
elsif object_id.blank?
|
155
|
+
raise InputError, "#{object_type.capitalize} not found" if object_type.blank? || object_id.blank?
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def require_target(msg = "You need to specify the target")
|
160
|
+
if target_type.blank?
|
161
|
+
raise FatalError, msg
|
162
|
+
elsif target_id.blank?
|
163
|
+
raise InputError, "#{target_type.capitalize} not found"
|
164
|
+
end
|
157
165
|
end
|
158
166
|
|
159
167
|
def resolve_context(args, opts = {})
|
160
168
|
defaults = {
|
161
169
|
:skip_object_resolution => Proc.new{|type, id| false},
|
162
|
-
:skip_target_resolution => Proc.new{|type, id| false}
|
170
|
+
:skip_target_resolution => Proc.new{|type, id| false},
|
171
|
+
:accept_no_object => false
|
163
172
|
}.merge!(opts)
|
164
173
|
@object_id, @object_type, args = parse_context_param(args, defaults[:skip_object_resolution])
|
165
|
-
raise
|
174
|
+
raise NameError if @object_type.blank? && !defaults[:accept_no_object]
|
166
175
|
@target_id, @target_type, args = parse_context_param(args, defaults[:skip_target_resolution])
|
167
176
|
return args
|
168
177
|
end
|
@@ -170,7 +179,7 @@ module EPC
|
|
170
179
|
def parse_context_param(params, skip_proc)
|
171
180
|
return [nil, nil, params] unless is_context_param?((params.first rescue nil))
|
172
181
|
param = params.shift
|
173
|
-
param_parts = param.split(":")
|
182
|
+
param_parts = param.split(":")
|
174
183
|
type = param_parts[0]
|
175
184
|
id = param_parts[1..-1].join(":")
|
176
185
|
if skip_proc.call(type, id)
|
@@ -298,7 +307,8 @@ module EPC
|
|
298
307
|
solution
|
299
308
|
user
|
300
309
|
metrics
|
301
|
-
|
310
|
+
userproperty
|
311
|
+
userproperties
|
302
312
|
)
|
303
313
|
|
304
314
|
end
|
@@ -307,7 +317,7 @@ module EPC
|
|
307
317
|
entity = entity.to_sym
|
308
318
|
match_value = args.join(":")
|
309
319
|
return nil if match_value.blank?
|
310
|
-
rule =
|
320
|
+
rule = {:required_type => :numeric}
|
311
321
|
if rule[:required_type] == :numeric
|
312
322
|
if numeric?(match_value)
|
313
323
|
return match_value.to_i
|
@@ -58,7 +58,7 @@ module EPC::Command
|
|
58
58
|
return poll_for_build_status(id)
|
59
59
|
end
|
60
60
|
else
|
61
|
-
|
61
|
+
say_err("Failed to find the project ID in the EPC configuration. Aborting")
|
62
62
|
end
|
63
63
|
return 1
|
64
64
|
end
|
@@ -75,7 +75,7 @@ module EPC::Command
|
|
75
75
|
say("Successfully kicked off a build with [#{target_url}]")
|
76
76
|
return true, response[:id]
|
77
77
|
else
|
78
|
-
|
78
|
+
say_err("Build kickoff failed [#{response[:message]}]. Aborting.")
|
79
79
|
return false
|
80
80
|
end
|
81
81
|
end
|
@@ -27,7 +27,7 @@ module EPC::Command
|
|
27
27
|
|
28
28
|
key_id = existing_keys.detect{|k| k[:name] == key }[:id] rescue nil
|
29
29
|
if key_id.nil?
|
30
|
-
|
30
|
+
say_err("#{key} is not defined.")
|
31
31
|
return 1
|
32
32
|
end
|
33
33
|
|
@@ -44,10 +44,10 @@ module EPC::Command
|
|
44
44
|
end
|
45
45
|
|
46
46
|
status, response, headers = client.delete(EPC::Config::CONFIGURATIONS_PATH + "/#{key_id}")
|
47
|
-
if status.
|
48
|
-
say("Request failed: [#{response[:message]}]")
|
49
|
-
else
|
47
|
+
if status.successful?
|
50
48
|
say("#{key} succesfully removed.")
|
49
|
+
else
|
50
|
+
say_err("Request failed: [#{response[:message]}]")
|
51
51
|
end
|
52
52
|
return status
|
53
53
|
|
@@ -43,7 +43,7 @@ module EPC::Command
|
|
43
43
|
status, response, headers = client.get(path)
|
44
44
|
@status = status
|
45
45
|
if status.failure?
|
46
|
-
|
46
|
+
say_err("Configuration retrieval failed with [#{response[:message]}]")
|
47
47
|
return false
|
48
48
|
end
|
49
49
|
|
@@ -22,7 +22,7 @@ module EPC::Command
|
|
22
22
|
status, response, headers = client.get(request_path)
|
23
23
|
|
24
24
|
if status.failure?
|
25
|
-
|
25
|
+
say_err("Configuration retrieval failed with [#{response[:message]}]")
|
26
26
|
return status
|
27
27
|
end
|
28
28
|
|
@@ -31,7 +31,7 @@ module EPC::Command
|
|
31
31
|
key_id = keys.detect{|k| k[:name] == object_id}[:id] rescue nil
|
32
32
|
|
33
33
|
if key_id.nil?
|
34
|
-
|
34
|
+
say_err("Key does not exist.")
|
35
35
|
return 1
|
36
36
|
end
|
37
37
|
|
@@ -49,7 +49,7 @@ module EPC::Command
|
|
49
49
|
say("#{object_id} saved.")
|
50
50
|
end
|
51
51
|
else
|
52
|
-
|
52
|
+
say_err("Request failed with message [#{response[:message]}]")
|
53
53
|
end
|
54
54
|
return status
|
55
55
|
end
|
@@ -2,7 +2,7 @@ module EPC::Command
|
|
2
2
|
class CopyCommand < BaseCommand
|
3
3
|
|
4
4
|
def execute(*args)
|
5
|
-
raise
|
5
|
+
raise InputError, "You need to specify the object for the command" if args.blank?
|
6
6
|
params = resolve_context(args)
|
7
7
|
raise FatalError, "Could not determine ObjectType" if @object_type.blank?
|
8
8
|
@klass_name = "EPC::Command::Copy#{@object_type.to_s.gsub("-","").capitalize}Command"
|
@@ -2,7 +2,7 @@ module EPC::Command
|
|
2
2
|
class CreateCommand < BaseCommand
|
3
3
|
|
4
4
|
def execute(*args)
|
5
|
-
raise
|
5
|
+
raise InputError, "You need to specify the object for the command" if args.blank?
|
6
6
|
params = resolve_context(args)
|
7
7
|
@klass_name = "EPC::Command::Create#{@object_type.to_s.gsub("-","").capitalize}Command"
|
8
8
|
command = eval(@klass_name)
|
@@ -2,8 +2,8 @@ module EPC::Command
|
|
2
2
|
class DeleteCommand < BaseCommand
|
3
3
|
|
4
4
|
def execute(*args)
|
5
|
-
raise
|
6
|
-
params = resolve_context(args, {:skip_object_resolution => Proc.new{|type, id| type.downcase == "config" || type.downcase == "objectrole"}})
|
5
|
+
raise InputError, "You need to specify the object for the command" if args.blank?
|
6
|
+
params = resolve_context(args, {:skip_object_resolution => Proc.new{|type, id| type.downcase == "config" || type.downcase == "objectrole" || type.downcase == "userproperty"}})
|
7
7
|
@klass_name = "EPC::Command::Delete#{@object_type.to_s.gsub("-","").capitalize}Command"
|
8
8
|
command = eval(@klass_name)
|
9
9
|
command.include_module(object_type)
|
@@ -11,7 +11,7 @@ module EPC::Command
|
|
11
11
|
path = File.expand_path(path)
|
12
12
|
|
13
13
|
if !( EPC::Config.is_solution_dir?(path) || EPC::Config.is_project_dir?(path)) && @options[:deployment_id].nil?
|
14
|
-
|
14
|
+
say_err("This is not a solution directory.")
|
15
15
|
return 1
|
16
16
|
end
|
17
17
|
|
@@ -59,7 +59,7 @@ module EPC::Command
|
|
59
59
|
display_statuses(deployment_status, response[:deployed_projects])
|
60
60
|
end
|
61
61
|
rescue Exception => ex
|
62
|
-
|
62
|
+
say_err("Deploy failed [#{ex.to_s}].")
|
63
63
|
return 1
|
64
64
|
end
|
65
65
|
return status
|
@@ -131,7 +131,8 @@ module EPC::Command
|
|
131
131
|
def display_statuses(deployment_status, deployed_projects)
|
132
132
|
say("\nStatus = #{deployment_status}\n")
|
133
133
|
deployed_projects.each do |project|
|
134
|
-
|
134
|
+
uris = project[:uris].join(",") rescue "N/A"
|
135
|
+
say("#{project[:project_name]} -> #{uris}\n") rescue ""
|
135
136
|
end
|
136
137
|
|
137
138
|
end
|
@@ -10,7 +10,7 @@ module EPC::Command
|
|
10
10
|
status, response, headers = client.post(EPC::Config::DEPLOYMENTS_PATH + "/#{object_id}/copy", {:stage_name => stage})
|
11
11
|
|
12
12
|
if status.failure?
|
13
|
-
|
13
|
+
say_err("Request failed: [#{response[:message]}]")
|
14
14
|
else
|
15
15
|
say("Copied new deployment to the #{stage} stage. ID: #{response[:id]}")
|
16
16
|
end
|
@@ -24,7 +24,7 @@ module EPC::Command
|
|
24
24
|
status, @id = create_deployment(solution_name, stage_name, versions, instances, memory)
|
25
25
|
return status
|
26
26
|
rescue Exception => ex
|
27
|
-
|
27
|
+
say_err("Create deployment failed [Exception Caught (#{ex.class.name}): #{ex.to_s}].")
|
28
28
|
return 1
|
29
29
|
end
|
30
30
|
|
@@ -32,7 +32,7 @@ module EPC::Command
|
|
32
32
|
if @options[:replaces].present?
|
33
33
|
status, response, headers = client.put(EPC::Config::DEPLOYMENTS_PATH + "/#{@id}", {:stage_name => "no_change", :replaces_id => @options[:replaces], :versions => "no_change"})
|
34
34
|
if status.failure?
|
35
|
-
|
35
|
+
say_err("Replacement request failed: [#{response[:message]}]")
|
36
36
|
else
|
37
37
|
say("Replacement request successful")
|
38
38
|
end
|
@@ -58,7 +58,7 @@ module EPC::Command
|
|
58
58
|
say("Successfully created deployment [#{response[:id]}] with [#{target_url}]")
|
59
59
|
return status, response[:id]
|
60
60
|
else
|
61
|
-
|
61
|
+
say_err("Deployment creation failed [#{response[:message]}]. Aborting.")
|
62
62
|
return status, nil
|
63
63
|
end
|
64
64
|
end
|
@@ -26,7 +26,7 @@ module EPC::Command
|
|
26
26
|
status, response, headers = client.get(url)
|
27
27
|
|
28
28
|
if status.failure?
|
29
|
-
|
29
|
+
say_err("Deployments retrieval failed with [#{response[:message]}]")
|
30
30
|
elsif response.empty?
|
31
31
|
say("You have no deployments created. You can create them with epc create deployment.")
|
32
32
|
else
|
@@ -6,7 +6,7 @@ module EPC::Command
|
|
6
6
|
|
7
7
|
status, response, headers = client.get(EPC::Config::DEPLOYMENTS_PATH + "/#{object_id}?include=solution,deployment_stage,approvals,deployer,submitter")
|
8
8
|
if status.failure?
|
9
|
-
|
9
|
+
say_err("Request failed: [#{response[:message]}]")
|
10
10
|
return status
|
11
11
|
end
|
12
12
|
|