epc 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/epc.rb +25 -5
- data/lib/epc/client/json_client.rb +4 -4
- data/lib/epc/command/archive_command.rb +7 -6
- data/lib/epc/command/attachto_command.rb +13 -0
- data/lib/epc/command/base_command.rb +120 -29
- data/lib/epc/command/config/create_config_command.rb +7 -11
- data/lib/epc/command/config/delete_config_command.rb +5 -5
- data/lib/epc/command/config/list_configs_command.rb +5 -5
- data/lib/epc/command/config/update_config_command.rb +11 -10
- data/lib/epc/command/copy_command.rb +14 -0
- data/lib/epc/command/create_command.rb +9 -5
- data/lib/epc/command/delete_command.rb +9 -9
- data/lib/epc/command/{copy_deployment_command.rb → deployment/copy_deployment_command.rb} +6 -5
- data/lib/epc/command/deployment/create_deployment_command.rb +15 -15
- data/lib/epc/command/deployment/list_deployments_command.rb +2 -4
- data/lib/epc/command/deployment/show_deployment_command.rb +5 -7
- data/lib/epc/command/deployment/submit_deployment_command.rb +15 -0
- data/lib/epc/command/deployment/update_deployment_command.rb +5 -14
- data/lib/epc/command/deployment/vote_deployment_command.rb +23 -0
- data/lib/epc/command/deploymentstage/list_deploymentstages_command.rb +1 -1
- data/lib/epc/command/detachfrom_command.rb +13 -0
- data/lib/epc/command/group/create_group_command.rb +3 -3
- data/lib/epc/command/group/delete_group_command.rb +4 -5
- data/lib/epc/command/group/show_group_command.rb +2 -3
- data/lib/epc/command/group/update_group_command.rb +9 -7
- data/lib/epc/command/library/create_library_command.rb +1 -2
- data/lib/epc/command/library/delete_library_command.rb +4 -5
- 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 +3 -5
- data/lib/epc/command/librarylanguage/list_librarylanguages_command.rb +1 -1
- data/lib/epc/command/librarylanguage/update_librarylanguage_command.rb +4 -5
- data/lib/epc/command/libraryset/create_libraryset_command.rb +5 -4
- data/lib/epc/command/libraryset/delete_libraryset_command.rb +4 -6
- data/lib/epc/command/libraryset/list_librarysets_command.rb +2 -2
- data/lib/epc/command/libraryset/show_libraryset_command.rb +3 -3
- data/lib/epc/command/libraryset/update_libraryset_command.rb +4 -3
- data/lib/epc/command/list_command.rb +10 -14
- data/lib/epc/command/list_objecttypes_command.rb +1 -1
- data/lib/epc/command/objectrole/create_objectrole_command.rb +4 -5
- data/lib/epc/command/objectrole/list_objectroles_command.rb +3 -8
- data/lib/epc/command/objectrole/update_objectrole_command.rb +3 -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 -2
- data/lib/epc/command/plugin/delete_plugin_command.rb +4 -6
- data/lib/epc/command/plugin/list_plugins_command.rb +1 -1
- data/lib/epc/command/plugin/show_plugin_command.rb +2 -5
- data/lib/epc/command/plugin/update_plugin_command.rb +2 -6
- data/lib/epc/command/project/archive_project_command.rb +3 -12
- data/lib/epc/command/project/attachto_project_command.rb +133 -0
- data/lib/epc/command/project/create_project_command.rb +6 -6
- data/lib/epc/command/project/delete_project_command.rb +3 -24
- data/lib/epc/command/project/detachfrom_project_command.rb +66 -0
- data/lib/epc/command/project/list_projects_command.rb +12 -7
- data/lib/epc/command/project/show_project_command.rb +26 -25
- data/lib/epc/command/project/show_project_snapshot_command.rb +41 -0
- data/lib/epc/command/project/unarchive_project_command.rb +3 -10
- data/lib/epc/command/project/update_project_command.rb +5 -18
- data/lib/epc/command/projecttype/create_projecttype_command.rb +37 -0
- data/lib/epc/command/projecttype/delete_projecttype_command.rb +24 -0
- data/lib/epc/command/projecttype/list_projecttypes_command.rb +1 -1
- data/lib/epc/command/projecttype/show_projecttype_command.rb +2 -4
- data/lib/epc/command/projecttype/update_projecttype_command.rb +61 -0
- data/lib/epc/command/push_command.rb +14 -8
- data/lib/epc/command/role/create_role_command.rb +26 -3
- data/lib/epc/command/role/delete_role_command.rb +3 -5
- data/lib/epc/command/role/list_roles_command.rb +7 -3
- data/lib/epc/command/role/show_role_command.rb +8 -5
- data/lib/epc/command/role/update_role_command.rb +14 -66
- data/lib/epc/command/runtime/create_runtime_command.rb +34 -0
- data/lib/epc/command/runtime/delete_runtime_command.rb +24 -0
- data/lib/epc/command/runtime/list_runtimes_command.rb +2 -2
- data/lib/epc/command/runtime/update_runtime_command.rb +49 -0
- data/lib/epc/command/runtimetype/list_runtimetypes_command.rb +17 -0
- data/lib/epc/command/servicedefinition/create_servicedefinition_command.rb +5 -6
- data/lib/epc/command/servicedefinition/delete_servicedefinition_command.rb +18 -0
- data/lib/epc/command/servicedefinition/list_servicedefinitions_command.rb +2 -2
- data/lib/epc/command/servicetype/list_servicetypes_command.rb +1 -1
- data/lib/epc/command/serviceversion/create_serviceversion_command.rb +8 -12
- data/lib/epc/command/serviceversion/delete_serviceversion_command.rb +3 -5
- data/lib/epc/command/serviceversion/list_serviceversions_command.rb +8 -1
- data/lib/epc/command/show_command.rb +8 -9
- data/lib/epc/command/show_metrics_command.rb +3 -3
- data/lib/epc/command/solution/archive_solution_command.rb +3 -10
- data/lib/epc/command/solution/create_solution_command.rb +2 -2
- data/lib/epc/command/solution/delete_solution_command.rb +3 -7
- data/lib/epc/command/solution/list_solutions_command.rb +11 -3
- data/lib/epc/command/solution/show_solution_command.rb +4 -6
- data/lib/epc/command/solution/unarchive_solution_command.rb +3 -8
- data/lib/epc/command/solution/update_solution_command.rb +4 -6
- data/lib/epc/command/submit_command.rb +16 -0
- data/lib/epc/command/unarchive_command.rb +7 -6
- data/lib/epc/command/update_command.rb +9 -8
- data/lib/epc/command/user/create_user_command.rb +2 -3
- data/lib/epc/command/user/delete_user_command.rb +3 -5
- data/lib/epc/command/user/list_users_command.rb +1 -1
- data/lib/epc/command/user/show_user_command.rb +2 -4
- data/lib/epc/command/user/update_user_command.rb +3 -14
- data/lib/epc/command/userproperty/list_user_properties_command.rb +23 -0
- data/lib/epc/command/vote_command.rb +16 -0
- data/lib/epc/config.rb +7 -1
- data/lib/epc/help.rb +51 -48
- data/lib/epc/modules/config.rb +39 -0
- data/lib/epc/modules/role.rb +133 -0
- data/lib/epc/runner.rb +23 -12
- data/lib/epc/version.rb +1 -1
- data/test/command/archive_project_command_test.rb +2 -13
- data/test/command/archive_solution_command_test.rb +4 -14
- data/test/command/copy_deployment_command_test.rb +4 -8
- data/test/command/create_config_command_test.rb +23 -23
- data/test/command/create_deployment_command_test.rb +33 -32
- data/test/command/create_group_command_test.rb +2 -2
- data/test/command/create_library_command_test.rb +6 -6
- data/test/command/create_librarylanguage_command_test.rb +3 -3
- data/test/command/create_libraryset_command_test.rb +6 -26
- data/test/command/create_objectrole_command_test.rb +4 -13
- data/test/command/create_project_command_test.rb +27 -13
- data/test/command/create_role_command_test.rb +3 -2
- data/test/command/create_runtime_command_test.rb +37 -0
- data/test/command/create_servicedefinition_command_test.rb +4 -17
- data/test/command/create_serviceversion_command_test.rb +8 -22
- data/test/command/create_solution_command_test.rb +5 -5
- data/test/command/create_user_command_test.rb +4 -4
- data/test/command/delete_config_command_test.rb +8 -15
- data/test/command/delete_library_command_test.rb +3 -4
- data/test/command/delete_librarylanguage_command_test.rb +3 -4
- data/test/command/delete_libraryset_command_test.rb +3 -4
- data/test/command/delete_plugin_command_test.rb +3 -4
- data/test/command/delete_project_command_test.rb +2 -10
- data/test/command/delete_projecttype_command_test.rb +31 -0
- data/test/command/delete_role_command_test.rb +5 -14
- data/test/command/delete_runtime_command_test.rb +31 -0
- data/test/command/delete_servicedefinition_command_test.rb +31 -0
- data/test/command/delete_serviceversion_command_test.rb +3 -2
- data/test/command/delete_solution_command_test.rb +3 -16
- data/test/command/delete_user_command_test.rb +3 -3
- data/test/command/list_config_command_test.rb +1 -0
- data/test/command/list_deployments_command_test.rb +11 -41
- data/test/command/list_objectroles_command_test.rb +4 -14
- data/test/command/list_projects_command_test.rb +0 -14
- data/test/command/list_roles_command_test.rb +3 -1
- data/test/command/list_runtimes_command_test.rb +2 -3
- data/test/command/list_runtimetypes_command_test.rb +29 -0
- data/test/command/list_userproperties_command_test.rb +33 -0
- data/test/command/push_command_test.rb +9 -1
- data/test/command/show_deployment_command_test.rb +36 -0
- data/test/command/show_group_command_test.rb +2 -1
- data/test/command/show_libraryset_command_test.rb +5 -3
- data/test/command/show_metrics_command_test.rb +4 -4
- data/test/command/show_plugin_command_test.rb +4 -4
- data/test/command/show_project_command_test.rb +5 -17
- data/test/command/show_project_snapshot_test.rb +33 -0
- data/test/command/show_projecttype_command_test.rb +5 -11
- data/test/command/show_role_command_test.rb +5 -12
- data/test/command/show_solution_command_test.rb +2 -15
- data/test/command/show_user_command_test.rb +4 -3
- data/test/command/submit_deployment_command_test.rb +4 -11
- data/test/command/unarchive_project_command_test.rb +2 -14
- data/test/command/unarchive_solution_command_test.rb +6 -16
- data/test/command/update_config_command_test.rb +14 -3
- data/test/command/update_deployment_command_test.rb +12 -26
- data/test/command/update_group_command_test.rb +2 -10
- data/test/command/update_librarylanguage_command_test.rb +5 -3
- data/test/command/update_libraryset_command_test.rb +4 -2
- data/test/command/update_plugin_command_test.rb +5 -4
- data/test/command/update_project_command_test.rb +6 -20
- data/test/command/update_role_command_test.rb +11 -8
- data/test/command/update_solution_command_test.rb +6 -12
- data/test/command/update_user_command_test.rb +3 -19
- data/test/command/vote_deployment_command_test.rb +2 -6
- metadata +66 -63
- data/lib/epc/command/attach_library_command.rb +0 -82
- data/lib/epc/command/attach_libraryset_command.rb +0 -31
- data/lib/epc/command/attach_runtime_command.rb +0 -26
- data/lib/epc/command/bind_service_command.rb +0 -35
- data/lib/epc/command/create_dependency_command.rb +0 -43
- data/lib/epc/command/dependency/delete_dependency_command.rb +0 -38
- data/lib/epc/command/detach_library_command.rb +0 -35
- data/lib/epc/command/detach_libraryset_command.rb +0 -8
- data/lib/epc/command/list_versions_command.rb +0 -38
- data/lib/epc/command/submit_deployment_command.rb +0 -19
- data/lib/epc/command/unbind_service_command.rb +0 -42
- data/lib/epc/command/undefine_service_command.rb +0 -33
- data/lib/epc/command/update_rolepermissions_command.rb +0 -83
- data/lib/epc/command/vote_deployment_command.rb +0 -29
- data/test/command/attach_library_command_test.rb +0 -124
- data/test/command/attach_libraryset_command_test.rb +0 -49
- data/test/command/attach_runtime_command_test.rb +0 -44
- data/test/command/bind_service_command_test.rb +0 -46
- data/test/command/create_dependency_command_test.rb +0 -55
- data/test/command/create_plugin_command_test.rb +0 -44
- data/test/command/delete_dependency_command_test.rb +0 -42
- data/test/command/detach_library_command_test.rb +0 -53
- data/test/command/unbind_service_command_test.rb +0 -48
- data/test/command/undefine_service_command_test.rb +0 -49
@@ -1,14 +1,14 @@
|
|
1
1
|
module EPC::Command
|
2
|
-
class ListConfigsCommand <
|
2
|
+
class ListConfigsCommand < ListCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(args = [])
|
5
5
|
sol_or_project_configs = false
|
6
|
-
|
6
|
+
|
7
7
|
path = File.expand_path(".")
|
8
8
|
|
9
|
-
config_type, config_id = extract_configuration_level(path,
|
9
|
+
config_type, config_id = extract_configuration_level(path, [target_type, target_id])
|
10
10
|
|
11
|
-
raise FatalError, "Configuration context could not inferred" if config_type.nil?
|
11
|
+
raise FatalError, "Configuration context could not inferred" if config_type.nil? || config_id.nil?
|
12
12
|
|
13
13
|
request_path = EPC::Config::CONFIGURATIONS_PATH+"/#{config_type}/#{config_id}"
|
14
14
|
|
@@ -1,17 +1,18 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class UpdateConfigCommand < UpdateCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(args)
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
path = "."
|
10
|
-
path = File.expand_path(path)
|
6
|
+
value = args[0]
|
7
|
+
path = File.expand_path(".")
|
11
8
|
|
12
9
|
@options[:required] = false if @options[:required].nil?
|
13
10
|
|
14
|
-
config_type, config_id = extract_configuration_level(path,
|
11
|
+
config_type, config_id = extract_configuration_level(path, [target_type, target_id])
|
12
|
+
|
13
|
+
raise InputError, "Config type invalid. Must be one of: [#{CreateConfigCommand::CONFIG_LEVELS.values.join(",")}]" if config_type.blank?
|
14
|
+
raise InputError, "Configuration context could not be determined" if config_id.blank?
|
15
|
+
|
15
16
|
request_path = EPC::Config::CONFIGURATIONS_PATH+"/#{config_type}/#{config_id}"
|
16
17
|
|
17
18
|
if ["solution", "project"].include?(config_type.downcase) && !@options[:stage].nil?
|
@@ -27,7 +28,7 @@ module EPC::Command
|
|
27
28
|
|
28
29
|
keys = response
|
29
30
|
|
30
|
-
key_id = keys.detect{|k| k[:name] ==
|
31
|
+
key_id = keys.detect{|k| k[:name] == object_id}[:id] rescue nil
|
31
32
|
|
32
33
|
if key_id.nil?
|
33
34
|
say("Key does not exist.")
|
@@ -35,7 +36,7 @@ module EPC::Command
|
|
35
36
|
end
|
36
37
|
|
37
38
|
params = {
|
38
|
-
:name =>
|
39
|
+
:name => object_id,
|
39
40
|
}
|
40
41
|
params[:value] = value unless value.nil?
|
41
42
|
params[:required] = @options[:required]
|
@@ -45,7 +46,7 @@ module EPC::Command
|
|
45
46
|
|
46
47
|
if status.successful?
|
47
48
|
unless response[:id].nil?
|
48
|
-
say("#{
|
49
|
+
say("#{object_id} saved.")
|
49
50
|
end
|
50
51
|
else
|
51
52
|
say("Request failed with message [#{response[:message]}]")
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class CopyCommand < BaseCommand
|
3
|
+
|
4
|
+
def execute(*args)
|
5
|
+
raise FatalError, "You need to specify the object for the command" if args.blank?
|
6
|
+
params = resolve_context(args)
|
7
|
+
raise FatalError, "Could not determine ObjectType" if @object_type.blank?
|
8
|
+
@klass_name = "EPC::Command::Copy#{@object_type.to_s.gsub("-","").capitalize}Command"
|
9
|
+
command = eval(@klass_name).new(client, @options)
|
10
|
+
command.context_params = context_params
|
11
|
+
command.execute(params)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,11 +1,15 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class CreateCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
5
|
-
|
6
|
-
params =
|
7
|
-
|
8
|
-
command
|
4
|
+
def execute(*args)
|
5
|
+
raise FatalError, "You need to specify the object for the command" if args.blank?
|
6
|
+
params = resolve_context(args)
|
7
|
+
@klass_name = "EPC::Command::Create#{@object_type.to_s.gsub("-","").capitalize}Command"
|
8
|
+
command = eval(@klass_name)
|
9
|
+
command.include_module(object_type)
|
10
|
+
command = command.new(client, @options)
|
11
|
+
command.context_params = context_params
|
12
|
+
command.execute(params)
|
9
13
|
end
|
10
14
|
|
11
15
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class DeleteCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
command =
|
11
|
-
|
12
|
-
command.
|
4
|
+
def execute(*args)
|
5
|
+
raise FatalError, "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"}})
|
7
|
+
@klass_name = "EPC::Command::Delete#{@object_type.to_s.gsub("-","").capitalize}Command"
|
8
|
+
command = eval(@klass_name)
|
9
|
+
command.include_module(object_type)
|
10
|
+
command = command.new(client, @options)
|
11
|
+
command.context_params = context_params
|
12
|
+
command.execute(params)
|
13
13
|
end
|
14
14
|
|
15
15
|
end
|
@@ -1,12 +1,13 @@
|
|
1
1
|
module EPC::Command
|
2
|
-
class CopyDeploymentCommand <
|
2
|
+
class CopyDeploymentCommand < CopyCommand
|
3
3
|
|
4
|
-
def execute(
|
5
|
-
|
4
|
+
def execute(args = [])
|
5
|
+
require_object
|
6
|
+
stage = args[0]
|
6
7
|
|
7
|
-
raise FatalError, "You must specify a deployment id and the stage name" if
|
8
|
+
raise FatalError, "You must specify a deployment id and the stage name" if stage.nil?
|
8
9
|
|
9
|
-
status, response, headers = client.post(EPC::Config::DEPLOYMENTS_PATH + "/#{
|
10
|
+
status, response, headers = client.post(EPC::Config::DEPLOYMENTS_PATH + "/#{object_id}/copy", {:stage_name => stage})
|
10
11
|
|
11
12
|
if status.failure?
|
12
13
|
say("Request failed: [#{response[:message]}]")
|
@@ -1,14 +1,12 @@
|
|
1
1
|
module EPC::Command
|
2
|
-
class CreateDeploymentCommand <
|
3
|
-
def execute(
|
2
|
+
class CreateDeploymentCommand < CreateCommand
|
3
|
+
def execute(args = [])
|
4
4
|
|
5
|
-
|
6
|
-
stage_name = params[1]
|
5
|
+
stage_name = args[0]
|
7
6
|
|
8
7
|
path = File.expand_path(".")
|
9
8
|
|
10
9
|
stage_name = "Development" if stage_name.nil?
|
11
|
-
solution_name = @options[:solution_name]
|
12
10
|
|
13
11
|
solution_id, solution_name = infer_solution_context(target_id, path, {:get_solution_name => true})
|
14
12
|
|
@@ -19,12 +17,12 @@ module EPC::Command
|
|
19
17
|
return 1
|
20
18
|
end
|
21
19
|
|
22
|
-
versions, instances = {}, {}
|
23
|
-
versions, instances = parse_projects(@options[:project_name]) unless blank?(@options[:project_name])
|
20
|
+
versions, instances, memory = {}, {}, {}
|
21
|
+
versions, instances, memory = parse_projects(@options[:project_name]) unless blank?(@options[:project_name])
|
24
22
|
|
25
23
|
begin
|
26
|
-
status, @id = create_deployment(solution_name, stage_name, versions, instances)
|
27
|
-
return status
|
24
|
+
status, @id = create_deployment(solution_name, stage_name, versions, instances, memory)
|
25
|
+
return status
|
28
26
|
rescue Exception => ex
|
29
27
|
say("Create deployment failed [Exception Caught (#{ex.class.name}): #{ex.to_s}].")
|
30
28
|
return 1
|
@@ -44,16 +42,17 @@ module EPC::Command
|
|
44
42
|
end
|
45
43
|
|
46
44
|
def execute_internal(stage_name = nil)
|
47
|
-
execute(stage_name)
|
45
|
+
execute([stage_name])
|
48
46
|
return @id
|
49
47
|
end
|
50
48
|
|
51
49
|
private
|
52
50
|
|
53
|
-
def create_deployment(solution_name, stage_name, versions = nil, instances = nil)
|
51
|
+
def create_deployment(solution_name, stage_name, versions = nil, instances = nil, memory = nil)
|
54
52
|
params = {:solution_name => solution_name, :stage_name => stage_name}
|
55
53
|
params[:versions] = versions unless blank?(versions)
|
56
54
|
params[:instances] = instances unless blank?(instances)
|
55
|
+
params[:runtime_memory] = memory unless blank?(memory)
|
57
56
|
status, response, headers = client.post("#{EPC::Config::DEPLOYMENTS_PATH}", params)
|
58
57
|
if status.successful?
|
59
58
|
say("Successfully created deployment [#{response[:id]}] with [#{target_url}]")
|
@@ -65,18 +64,19 @@ module EPC::Command
|
|
65
64
|
end
|
66
65
|
|
67
66
|
def parse_projects(data)
|
68
|
-
return [], [] if data.blank?
|
67
|
+
return [], [], [] if data.blank?
|
69
68
|
versions = []
|
70
69
|
instances = []
|
70
|
+
memory = []
|
71
71
|
projects_data = data.split("|")
|
72
72
|
projects_data.each do |project_data|
|
73
|
-
project_id, ver, inst = project_data.split(":")
|
73
|
+
project_id, ver, inst, mem = project_data.split(":")
|
74
74
|
next if blank?(project_id)
|
75
75
|
versions << {:project_id => project_id, :version => ver} unless blank?(ver)
|
76
76
|
instances << {:project_id => project_id, :instances => inst} unless blank?(inst)
|
77
|
+
memory << {:project_id => project_id, :runtime_memory => mem} unless blank?(mem)
|
77
78
|
end
|
78
|
-
|
79
|
-
return versions, instances
|
79
|
+
return versions, instances, memory
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
@@ -2,12 +2,10 @@
|
|
2
2
|
module EPC::Command
|
3
3
|
class ListDeploymentsCommand < BaseCommand
|
4
4
|
|
5
|
-
def execute(
|
6
|
-
target_type, target_id = target.split(":") rescue [nil, nil]
|
5
|
+
def execute(args = [])
|
7
6
|
path = File.expand_path(".")
|
8
7
|
|
9
|
-
|
10
|
-
if target.present?
|
8
|
+
if target_type.present?
|
11
9
|
id = retrieve_identifier_for(target_type, target_id)
|
12
10
|
if target_type.downcase == "solution"
|
13
11
|
url = EPC::Config::SOLUTIONS_PATH + "/#{id}/deployments"
|
@@ -2,15 +2,15 @@ require 'time'
|
|
2
2
|
module EPC::Command
|
3
3
|
class ShowDeploymentCommand < ShowCommand
|
4
4
|
|
5
|
-
def execute(
|
6
|
-
|
7
|
-
status, response, headers = client.get(EPC::Config::DEPLOYMENTS_PATH + "/#{
|
5
|
+
def execute(args)
|
6
|
+
|
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("Request failed: [#{response[:message]}]")
|
10
10
|
return status
|
11
11
|
end
|
12
12
|
|
13
|
-
@showables = args
|
13
|
+
@showables = args.map(&:to_sym) rescue []
|
14
14
|
|
15
15
|
response[:created_at] = Time.parse(response[:created_at]).strftime("%m/%d/%Y %I:%M%p") unless response[:created_at].nil?
|
16
16
|
response[:updated_at] = Time.parse(response[:updated_at]).strftime("%m/%d/%Y %I:%M%p") unless response[:updated_at].nil?
|
@@ -27,8 +27,6 @@ module EPC::Command
|
|
27
27
|
say(deployments_table.print)
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
30
|
if show? :approvals
|
33
31
|
say("\nApprovals:")
|
34
32
|
approvals_table = EPC::TabularOutputter.new(response[:approvals], [:id, :name, :approved, :approver_id, :approver_name])
|
@@ -42,7 +40,7 @@ module EPC::Command
|
|
42
40
|
projects.each do |project|
|
43
41
|
say("\n## #{project[:name]}")
|
44
42
|
project[:uri] = project[:uris].first unless project[:uris].nil?
|
45
|
-
projects_table = EPC::TabularOutputter.new([project], [:id, :name, :version, :status, :uri, :instances])
|
43
|
+
projects_table = EPC::TabularOutputter.new([project], [:id, :name, :version, :status, :uri, :instances, :deployed_project_id])
|
46
44
|
say(projects_table.print)
|
47
45
|
|
48
46
|
config_values = project[:config_values]
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class SubmitDeploymentCommand < SubmitCommand
|
3
|
+
def execute(args = [])
|
4
|
+
require_object
|
5
|
+
|
6
|
+
status, response, headers = client.put(EPC::Config::DEPLOYMENTS_PATH + "/#{object_id}/submit")
|
7
|
+
if status.successful?
|
8
|
+
say("Deployment submitted for approval")
|
9
|
+
else
|
10
|
+
say("Request failed: [#{response[:message]}]")
|
11
|
+
end
|
12
|
+
return status
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,23 +1,14 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class UpdateDeploymentCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
5
|
-
|
6
|
-
project_id = target.split(":")[1] rescue nil
|
4
|
+
def execute(args)
|
7
5
|
|
8
6
|
instances = @options[:instances]
|
9
7
|
uris = @options[:uris]
|
10
8
|
|
11
9
|
raise FatalError, "You need to specify either an instance count or uris" if blank?(instances) && blank?(uris)
|
12
10
|
|
13
|
-
|
14
|
-
field = :id
|
15
|
-
project_id = project_id.to_i
|
16
|
-
else
|
17
|
-
field = :name
|
18
|
-
end
|
19
|
-
|
20
|
-
deployed_project_id = get_deployed_project_id(deployment_id, field, project_id)
|
11
|
+
deployed_project_id = get_deployed_project_id(object_id, target_id)
|
21
12
|
|
22
13
|
raise FatalError, "Deployed project id not found" if deployed_project_id.nil?
|
23
14
|
|
@@ -25,7 +16,7 @@ module EPC::Command
|
|
25
16
|
params[:instances] = instances.to_i unless blank?(instances)
|
26
17
|
params[:uris] = uris.split(",") unless blank?(uris)
|
27
18
|
|
28
|
-
status, response, headers = client.put(EPC::Config::DEPLOYMENTS_PATH + "/#{
|
19
|
+
status, response, headers = client.put(EPC::Config::DEPLOYMENTS_PATH + "/#{object_id}/deployed_projects/#{deployed_project_id}", params)
|
29
20
|
|
30
21
|
if status.successful?
|
31
22
|
say("Deployment updated")
|
@@ -37,7 +28,7 @@ module EPC::Command
|
|
37
28
|
|
38
29
|
private
|
39
30
|
|
40
|
-
def get_deployed_project_id(deployment_id,
|
31
|
+
def get_deployed_project_id(deployment_id, value)
|
41
32
|
status, response, headers = client.get(EPC::Config::DEPLOYMENTS_PATH + "/#{deployment_id}")
|
42
33
|
|
43
34
|
raise FatalError, "Deployed projects retrieval failed: [#{response[:message]}]" if status.failure?
|
@@ -45,7 +36,7 @@ module EPC::Command
|
|
45
36
|
return nil if response.blank?
|
46
37
|
|
47
38
|
projects = response[:solution][:projects] rescue []
|
48
|
-
deployed_project_id = projects.detect{|p| p[
|
39
|
+
deployed_project_id = projects.detect{|p| p[:id] == value}[:deployed_project_id] rescue nil
|
49
40
|
|
50
41
|
deployed_project_id
|
51
42
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class VoteDeploymentCommand < VoteCommand
|
3
|
+
|
4
|
+
def execute(args = [])
|
5
|
+
require_object
|
6
|
+
|
7
|
+
if @options[:approval] == "approve"
|
8
|
+
approved = true
|
9
|
+
else
|
10
|
+
approved = false
|
11
|
+
end
|
12
|
+
|
13
|
+
status, response, headers = client.put(EPC::Config::DEPLOYMENTS_PATH + "/#{object_id}/vote", {:approved => approved})
|
14
|
+
if status.successful?
|
15
|
+
say("Deployment [#{object_id}] has been #{approved ? "approved" : "rejected"} by you.")
|
16
|
+
else
|
17
|
+
say("Request failed: [#{response[:message]}]")
|
18
|
+
end
|
19
|
+
return status
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class DetachfromCommand < BaseCommand
|
3
|
+
|
4
|
+
def execute(*args)
|
5
|
+
raise FatalError, "You need to specify the object for the command" if args.blank?
|
6
|
+
params = resolve_context(args)
|
7
|
+
@klass_name = "EPC::Command::Detachfrom#{@object_type.to_s.gsub("-","").capitalize}Command"
|
8
|
+
command = eval(@klass_name).new(client, @options)
|
9
|
+
command.context_params = context_params
|
10
|
+
command.execute(params)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class CreateGroupCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
5
|
-
name =
|
4
|
+
def execute(args = [])
|
5
|
+
name = args[0]
|
6
6
|
|
7
|
-
raise FatalError, "
|
7
|
+
raise FatalError, "Name is required" if name.blank?
|
8
8
|
|
9
9
|
status, response, headers = client.post(EPC::Config::GROUPS_PATH, {:name => name})
|
10
10
|
|
@@ -1,16 +1,15 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class DeleteGroupCommand < DeleteCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(args)
|
5
|
+
require_object
|
5
6
|
|
6
|
-
proceed = ask_yn("Are you sure you want to delete the [#{
|
7
|
+
proceed = ask_yn("Are you sure you want to delete the [#{object_id}] group? [Yn] ")
|
7
8
|
if proceed.upcase == "N"
|
8
9
|
return 1
|
9
10
|
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
status, response, headers = client.delete(EPC::Config::GROUPS_PATH + "/#{group_id}")
|
12
|
+
status, response, headers = client.delete(EPC::Config::GROUPS_PATH + "/#{object_id}")
|
14
13
|
|
15
14
|
if status.successful?
|
16
15
|
say("Group deleted")
|
@@ -1,10 +1,9 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class ShowGroupCommand < BaseCommand
|
3
|
-
def execute(
|
3
|
+
def execute(args)
|
4
4
|
|
5
|
-
group_id = retrieve_identifier_for("UserGroup", group)
|
6
5
|
|
7
|
-
status, response, headers = client.get(EPC::Config::GROUPS_PATH + "/#{
|
6
|
+
status, response, headers = client.get(EPC::Config::GROUPS_PATH + "/#{object_id}?include=users")
|
8
7
|
|
9
8
|
unless status.successful?
|
10
9
|
say("Request failed: [#{response[:message]}]")
|