epc 1.0.2 → 1.0.3
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 +71 -54
- data/lib/epc/command/archive_command.rb +12 -0
- data/lib/epc/command/attach_libraryset_command.rb +1 -2
- data/lib/epc/command/attach_runtime_command.rb +0 -1
- data/lib/epc/command/base_command.rb +52 -63
- data/lib/epc/command/config/delete_config_command.rb +57 -0
- data/lib/epc/command/{list_config_command.rb → config/list_configs_command.rb} +1 -1
- data/lib/epc/command/config/update_config_command.rb +56 -0
- data/lib/epc/command/create_command.rb +0 -1
- data/lib/epc/command/delete_command.rb +16 -0
- data/lib/epc/command/{delete_dependency_command.rb → dependency/delete_dependency_command.rb} +14 -16
- data/lib/epc/command/deploy_command.rb +1 -2
- data/lib/epc/command/deployment/list_deployments_command.rb +49 -0
- data/lib/epc/command/deployment/show_deployment_command.rb +61 -0
- data/lib/epc/command/{update_deploymentproject_command.rb → deployment/update_deployment_command.rb} +3 -3
- data/lib/epc/command/{list_stages_command.rb → deploymentstage/list_deploymentstages_command.rb} +1 -1
- data/lib/epc/command/group/delete_group_command.rb +25 -0
- data/lib/epc/command/{list_groups_command.rb → group/list_groups_command.rb} +1 -1
- data/lib/epc/command/{show_group_command.rb → group/show_group_command.rb} +2 -9
- data/lib/epc/command/{update_group_command.rb → group/update_group_command.rb} +3 -20
- data/lib/epc/command/library/create_library_command.rb +2 -5
- data/lib/epc/command/library/delete_library_command.rb +23 -0
- data/lib/epc/command/{list_libraries_command.rb → library/list_libraries_command.rb} +1 -1
- data/lib/epc/command/librarylanguage/delete_librarylanguage_command.rb +24 -0
- data/lib/epc/command/{list_librarylanguages_command.rb → librarylanguage/list_librarylanguages_command.rb} +1 -1
- data/lib/epc/command/{update_librarylanguage_command.rb → librarylanguage/update_librarylanguage_command.rb} +6 -10
- data/lib/epc/command/libraryset/create_libraryset_command.rb +1 -6
- data/lib/epc/command/{delete_libraryset_command.rb → libraryset/delete_libraryset_command.rb} +2 -18
- data/lib/epc/command/{list_librarysets_command.rb → libraryset/list_librarysets_command.rb} +1 -1
- data/lib/epc/command/{show_libraryset_command.rb → libraryset/show_libraryset_command.rb} +2 -17
- data/lib/epc/command/{update_libraryset_command.rb → libraryset/update_libraryset_command.rb} +4 -16
- data/lib/epc/command/list_command.rb +22 -0
- data/lib/epc/command/list_metrics_command.rb +25 -0
- data/lib/epc/command/list_objecttypes_command.rb +2 -4
- data/lib/epc/command/list_versions_command.rb +0 -1
- data/lib/epc/command/{list_objectroles_command.rb → objectrole/list_objectroles_command.rb} +3 -3
- data/lib/epc/command/objectrole/update_objectrole_command.rb +14 -0
- data/lib/epc/command/{list_rolepermissions_command.rb → permission/list_permissions_command.rb} +2 -2
- data/lib/epc/command/{list_permissiongroups_command.rb → permissiongroup/list_permissiongroups_command.rb} +1 -1
- data/lib/epc/command/plugin/create_plugin_command.rb +42 -0
- data/lib/epc/command/plugin/delete_plugin_command.rb +26 -0
- data/lib/epc/command/plugin/list_plugins_command.rb +19 -0
- data/lib/epc/command/plugin/show_plugin_command.rb +29 -0
- data/lib/epc/command/plugin/update_plugin_command.rb +53 -0
- data/lib/epc/command/{archive_project_command.rb → project/archive_project_command.rb} +4 -3
- data/lib/epc/command/{delete_project_command.rb → project/delete_project_command.rb} +11 -7
- data/lib/epc/command/{list_projects_command.rb → project/list_projects_command.rb} +8 -9
- data/lib/epc/command/{show_project_command.rb → project/show_project_command.rb} +64 -29
- data/lib/epc/command/{unarchive_project_command.rb → project/unarchive_project_command.rb} +5 -4
- data/lib/epc/command/{update_project_command.rb → project/update_project_command.rb} +11 -5
- data/lib/epc/command/{list_projecttypes_command.rb → projecttype/list_projecttypes_command.rb} +1 -1
- data/lib/epc/command/{show_projecttype_command.rb → projecttype/show_projecttype_command.rb} +4 -3
- data/lib/epc/command/pull_command.rb +33 -35
- data/lib/epc/command/{delete_role_command.rb → role/delete_role_command.rb} +3 -4
- data/lib/epc/command/{list_roles_command.rb → role/list_roles_command.rb} +4 -3
- data/lib/epc/command/{show_role_command.rb → role/show_role_command.rb} +18 -10
- data/lib/epc/command/role/update_role_command.rb +95 -0
- data/lib/epc/command/{list_runtimes_command.rb → runtime/list_runtimes_command.rb} +0 -0
- data/lib/epc/command/servicedefinition/create_servicedefinition_command.rb +23 -0
- data/lib/epc/command/{list_servicedefinitions_command.rb → servicedefinition/list_servicedefinitions_command.rb} +1 -0
- data/lib/epc/command/{list_service_types_command.rb → servicetype/list_servicetypes_command.rb} +0 -0
- data/lib/epc/command/serviceversion/delete_serviceversion_command.rb +24 -0
- data/lib/epc/command/{list_serviceversions_command.rb → serviceversion/list_serviceversions_command.rb} +1 -1
- data/lib/epc/command/show_command.rb +27 -0
- data/lib/epc/command/show_instances_command.rb +33 -0
- data/lib/epc/command/show_metrics_command.rb +55 -0
- data/lib/epc/command/{archive_solution_command.rb → solution/archive_solution_command.rb} +2 -1
- data/lib/epc/command/solution/create_solution_command.rb +0 -1
- data/lib/epc/command/{delete_solution_command.rb → solution/delete_solution_command.rb} +5 -10
- data/lib/epc/command/solution/list_solutions_command.rb +1 -1
- data/lib/epc/command/{show_solution_command.rb → solution/show_solution_command.rb} +12 -7
- data/lib/epc/command/{unarchive_solution_command.rb → solution/unarchive_solution_command.rb} +1 -1
- data/lib/epc/command/solution/update_solution_command.rb +2 -1
- data/lib/epc/command/unarchive_command.rb +12 -0
- data/lib/epc/command/update_command.rb +15 -0
- data/lib/epc/command/update_rolepermissions_command.rb +2 -2
- data/lib/epc/command/{delete_user_command.rb → user/delete_user_command.rb} +4 -12
- data/lib/epc/command/{list_users_command.rb → user/list_users_command.rb} +1 -1
- data/lib/epc/command/{show_user_command.rb → user/show_user_command.rb} +3 -17
- data/lib/epc/command/{update_user_command.rb → user/update_user_command.rb} +2 -4
- data/lib/epc/config.rb +4 -1
- data/lib/epc/help.rb +50 -35
- data/lib/epc/runner.rb +16 -5
- data/lib/epc/version.rb +1 -1
- data/lib/epc/vertical_bar.rb +40 -0
- data/test/command/create_library_command_test.rb +5 -2
- data/test/command/create_libraryset_command_test.rb +1 -1
- data/test/command/create_plugin_command_test.rb +44 -0
- data/test/command/create_servicedefinition_command_test.rb +43 -0
- data/test/command/delete_config_command_test.rb +0 -11
- data/test/command/delete_dependency_command_test.rb +3 -11
- data/test/command/delete_library_command_test.rb +2 -15
- data/test/command/delete_librarylanguage_command_test.rb +2 -24
- data/test/command/delete_libraryset_command_test.rb +2 -24
- data/test/command/delete_plugin_command_test.rb +32 -0
- data/test/command/delete_project_command_test.rb +0 -6
- data/test/command/delete_role_command_test.rb +1 -1
- data/test/command/delete_serviceversion_command_test.rb +0 -22
- data/test/command/delete_solution_command_test.rb +4 -4
- data/test/command/delete_user_command_test.rb +2 -24
- data/test/command/list_config_command_test.rb +3 -3
- data/test/command/list_deployments_command_test.rb +17 -20
- data/test/command/list_deploymentstages_command_test.rb +2 -2
- data/test/command/list_metrics_command_test.rb +40 -0
- data/test/command/{list_rolepermissions_command_test.rb → list_permissions_command_test.rb} +2 -2
- data/test/command/list_plugins_command_test.rb +27 -0
- data/test/command/list_projects_command_test.rb +3 -5
- data/test/command/list_roles_command_test.rb +2 -3
- data/test/command/pull_command_test.rb +13 -9
- data/test/command/show_group_command_test.rb +1 -23
- data/test/command/show_instances_command_test.rb +33 -0
- data/test/command/show_libraryset_command_test.rb +0 -11
- data/test/command/show_metrics_command_test.rb +51 -0
- data/test/command/show_plugin_command_test.rb +28 -0
- data/test/command/show_project_command_test.rb +1 -1
- data/test/command/show_projecttype_command_test.rb +0 -5
- 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 +2 -22
- data/test/command/update_config_command_test.rb +3 -9
- data/test/command/{update_deploymentproject_command_test.rb → update_deployment_command_test.rb} +6 -11
- data/test/command/update_group_command_test.rb +1 -20
- data/test/command/update_librarylanguage_command_test.rb +0 -15
- data/test/command/update_libraryset_command_test.rb +0 -13
- data/test/command/update_plugin_command_test.rb +41 -0
- data/test/command/update_project_command_test.rb +3 -3
- data/test/command/update_role_command_test.rb +2 -1
- data/test/command/update_solution_command_test.rb +3 -9
- data/test/command/update_user_command_test.rb +0 -6
- metadata +177 -165
- data/lib/epc/command/define_service_command.rb +0 -37
- data/lib/epc/command/delete_config_command.rb +0 -63
- data/lib/epc/command/delete_group_command.rb +0 -40
- data/lib/epc/command/delete_library_command.rb +0 -30
- data/lib/epc/command/delete_librarylanguage_command.rb +0 -40
- data/lib/epc/command/delete_serviceversion_command.rb +0 -52
- data/lib/epc/command/list_approvals_command.rb +0 -27
- data/lib/epc/command/list_attachedlibraries_command.rb +0 -42
- data/lib/epc/command/list_boundservices_command.rb +0 -40
- data/lib/epc/command/list_dependencies_command.rb +0 -43
- data/lib/epc/command/list_deployments_command.rb +0 -68
- data/lib/epc/command/list_solutions_command.rb +0 -25
- data/lib/epc/command/show_deployment_command.rb +0 -57
- data/lib/epc/command/update_config_command.rb +0 -62
- data/lib/epc/command/update_role_command.rb +0 -47
- data/lib/epc/command/update_solution_command.rb +0 -45
- data/test/command/define_service_command_test.rb +0 -55
- data/test/command/delete_group_command_test.rb +0 -56
- data/test/command/list_approvals_command_test.rb +0 -41
- data/test/command/list_boundservices_command_test.rb +0 -46
- data/test/command/list_dependencies_command_test.rb +0 -46
- data/test/command/update_rolepermissions_command_test.rb +0 -54
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module EPC::Command
|
|
2
|
+
class UpdateConfigCommand < UpdateCommand
|
|
3
|
+
|
|
4
|
+
def execute(name = nil, *args )
|
|
5
|
+
|
|
6
|
+
target = args[0]
|
|
7
|
+
value = args[1]
|
|
8
|
+
|
|
9
|
+
path = "."
|
|
10
|
+
path = File.expand_path(path)
|
|
11
|
+
|
|
12
|
+
@options[:required] = false if @options[:required].nil?
|
|
13
|
+
|
|
14
|
+
config_type, config_id = extract_configuration_level(path, target)
|
|
15
|
+
request_path = EPC::Config::CONFIGURATIONS_PATH+"/#{config_type}/#{config_id}"
|
|
16
|
+
|
|
17
|
+
if ["solution", "project"].include?(config_type.downcase) && !@options[:stage].nil?
|
|
18
|
+
request_path += "/#{@options[:stage]}"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
status, response, headers = client.get(request_path)
|
|
22
|
+
|
|
23
|
+
if status.failure?
|
|
24
|
+
say("Configuration retrieval failed with [#{response[:message]}]")
|
|
25
|
+
return status
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
keys = response
|
|
29
|
+
|
|
30
|
+
key_id = keys.detect{|k| k[:name] == name}[:id] rescue nil
|
|
31
|
+
|
|
32
|
+
if key_id.nil?
|
|
33
|
+
say("Key does not exist.")
|
|
34
|
+
return 1
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
params = {
|
|
38
|
+
:name => name,
|
|
39
|
+
}
|
|
40
|
+
params[:value] = value unless value.nil?
|
|
41
|
+
params[:required] = @options[:required]
|
|
42
|
+
params[:no_override] = @options[:no_override] unless @options[:no_override].nil?
|
|
43
|
+
|
|
44
|
+
status, response, headers = client.put(EPC::Config::CONFIGURATIONS_PATH + "/#{key_id}", params)
|
|
45
|
+
|
|
46
|
+
if status.successful?
|
|
47
|
+
unless response[:id].nil?
|
|
48
|
+
say("#{name} saved.")
|
|
49
|
+
end
|
|
50
|
+
else
|
|
51
|
+
say("Request failed with message [#{response[:message]}]")
|
|
52
|
+
end
|
|
53
|
+
return status
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
module EPC::Command
|
|
2
2
|
class CreateCommand < BaseCommand
|
|
3
|
-
required_arguments_count 1, :message => "You have to specify an object for the create command"
|
|
4
3
|
|
|
5
4
|
def execute(object_type = nil, *params)
|
|
6
5
|
klass = "EPC::Command::Create#{object_type.to_s.gsub("-","").capitalize}Command"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module EPC::Command
|
|
2
|
+
class DeleteCommand < BaseCommand
|
|
3
|
+
|
|
4
|
+
def execute(object = nil, *params)
|
|
5
|
+
@object_type = object.split(":").first rescue nil
|
|
6
|
+
@object_id = object.split(":")[1..-1].join(":") rescue nil
|
|
7
|
+
raise FatalError, "Object incorrectly specified" if @object_type.blank?
|
|
8
|
+
klass = "EPC::Command::Delete#{@object_type.to_s.gsub("-","").capitalize}Command"
|
|
9
|
+
params = normalize_params(params)
|
|
10
|
+
command = eval(klass).new(client, @options)
|
|
11
|
+
check_params
|
|
12
|
+
command.go(@object_id, *params)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/epc/command/{delete_dependency_command.rb → dependency/delete_dependency_command.rb}
RENAMED
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
module EPC::Command
|
|
2
|
-
class DeleteDependencyCommand <
|
|
2
|
+
class DeleteDependencyCommand < DeleteCommand
|
|
3
3
|
|
|
4
|
-
def execute(dependency_id = nil)
|
|
4
|
+
def execute(dependency_id = nil, target = nil)
|
|
5
5
|
path = File.expand_path(".")
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
project_name = @options[:project_name]
|
|
9
|
-
|
|
10
|
-
solution_id, solution_name = infer_solution_context(solution_name, path)
|
|
11
|
-
project_id, project_name = infer_project_context(project_name, path, solution_id)
|
|
7
|
+
project = target.split(":")[1] rescue nil
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
say("You must specify a dependency_id")
|
|
15
|
-
say(EPC::Help::COMMAND_USAGES[:delete_dependency])
|
|
16
|
-
return 1
|
|
17
|
-
end
|
|
9
|
+
ids = project.split(":") rescue [nil, nil]
|
|
18
10
|
|
|
19
|
-
if
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
if ids.size == 1
|
|
12
|
+
project_name = ids[0]
|
|
13
|
+
solution_name = nil
|
|
14
|
+
elsif ids.size == 2
|
|
15
|
+
solution_name, project_name = ids
|
|
23
16
|
end
|
|
24
17
|
|
|
18
|
+
solution_id, solution_name = infer_solution_context(solution_name, path)
|
|
19
|
+
project_id, project_name = infer_project_context(project_name, path, solution_id)
|
|
20
|
+
|
|
21
|
+
raise FatalError, "Project could not be inferred" if project_id.blank? || project_id == 0
|
|
22
|
+
|
|
25
23
|
proceed = ask_yn("Are you sure you want to delete the dependency with id = [#{dependency_id}]. Correct? [Yn] ")
|
|
26
24
|
if proceed.upcase == 'N'
|
|
27
25
|
return 1
|
|
@@ -9,7 +9,7 @@ module EPC::Command
|
|
|
9
9
|
def execute(stage = nil)
|
|
10
10
|
path = "."
|
|
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("This is not a solution directory.")
|
|
15
15
|
return 1
|
|
@@ -23,7 +23,6 @@ module EPC::Command
|
|
|
23
23
|
|
|
24
24
|
solution_id, solution_name = infer_solution_context(nil, path)
|
|
25
25
|
|
|
26
|
-
|
|
27
26
|
if @options[:deployment_id].nil?
|
|
28
27
|
proceed = ask_yn("You are deploying the [#{solution_name}] solution. Correct? [Yn]: ")
|
|
29
28
|
return 1 if proceed.upcase == 'N'
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
module EPC::Command
|
|
3
|
+
class ListDeploymentsCommand < BaseCommand
|
|
4
|
+
|
|
5
|
+
def execute(target = nil, *args)
|
|
6
|
+
target_type, target_id = target.split(":") rescue [nil, nil]
|
|
7
|
+
path = File.expand_path(".")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
if target.present?
|
|
11
|
+
id = retrieve_identifier_for(target_type, target_id)
|
|
12
|
+
if target_type.downcase == "solution"
|
|
13
|
+
url = EPC::Config::SOLUTIONS_PATH + "/#{id}/deployments"
|
|
14
|
+
elsif target_type.downcase == "deploymentstage"
|
|
15
|
+
url = EPC::Config::DEPLOYMENT_STAGES_PATH + "/#{id}/deployments"
|
|
16
|
+
elsif target_type.downcase == "user"
|
|
17
|
+
url = EPC::Config::USERS_PATH + "/#{id}/deployments"
|
|
18
|
+
end
|
|
19
|
+
elsif EPC::Config.is_solution_dir?(path) || EPC::Config.is_project_dir?(path)
|
|
20
|
+
id, name = infer_solution_context(nil, path)
|
|
21
|
+
if id.present?
|
|
22
|
+
url = EPC::Config::SOLUTIONS_PATH + "/#{id}/deployments"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
raise FatalError, "Solution/stage/deployer could not be inferred." if id.nil?
|
|
27
|
+
|
|
28
|
+
status, response, headers = client.get(url)
|
|
29
|
+
|
|
30
|
+
if status.failure?
|
|
31
|
+
say("Deployments retrieval failed with [#{response[:message]}]")
|
|
32
|
+
elsif response.empty?
|
|
33
|
+
say("You have no deployments created. You can create them with epc create deployment.")
|
|
34
|
+
else
|
|
35
|
+
response = response.select{|d| d[:status] == @options[:status]} unless @options[:status].nil?
|
|
36
|
+
if response.empty?
|
|
37
|
+
say("You have no deployments created. You can create them with epc create deployment.")
|
|
38
|
+
return 0
|
|
39
|
+
end
|
|
40
|
+
response.sort!{|a, b| b[:id] <=> a[:id]}
|
|
41
|
+
deployments_table = EPC::TabularOutputter.new(response, {:id => "ID", :deployer_name => "DEPLOYER", :solution_name => "SOLUTION", :deployment_stage_name => "STAGE", :status => "STATUS"})
|
|
42
|
+
say(deployments_table.print)
|
|
43
|
+
end
|
|
44
|
+
return status
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
require 'time'
|
|
2
|
+
module EPC::Command
|
|
3
|
+
class ShowDeploymentCommand < ShowCommand
|
|
4
|
+
|
|
5
|
+
def execute(deployment_id = nil, *args)
|
|
6
|
+
|
|
7
|
+
status, response, headers = client.get(EPC::Config::DEPLOYMENTS_PATH + "/#{deployment_id}?include=solution,deployment_stage,approvals,deployer,submitter")
|
|
8
|
+
if status.failure?
|
|
9
|
+
say("Request failed: [#{response[:message]}]")
|
|
10
|
+
return status
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
@showables = args[1..-1].map(&:to_sym) rescue []
|
|
14
|
+
|
|
15
|
+
response[:created_at] = Time.parse(response[:created_at]).strftime("%m/%d/%Y %I:%M%p") unless response[:created_at].nil?
|
|
16
|
+
response[:updated_at] = Time.parse(response[:updated_at]).strftime("%m/%d/%Y %I:%M%p") unless response[:updated_at].nil?
|
|
17
|
+
response[:stage] = response[:deployment_stage][:name]
|
|
18
|
+
response[:solution_id] = response[:solution][:id]
|
|
19
|
+
response[:solution_name] = response[:solution][:name]
|
|
20
|
+
response[:submitter] = response[:submitter][:name] rescue nil
|
|
21
|
+
response[:deployer] = response[:deployer][:name] rescue nil
|
|
22
|
+
|
|
23
|
+
@response = response
|
|
24
|
+
|
|
25
|
+
if @showables.blank?
|
|
26
|
+
deployments_table = EPC::TabularOutputter.new([response], [:id, :status, :stage, :solution_name, :submitter, :deployer, :updated_at, :note, :replaces])
|
|
27
|
+
say(deployments_table.print)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
if show? :approvals
|
|
33
|
+
say("\nApprovals:")
|
|
34
|
+
approvals_table = EPC::TabularOutputter.new(response[:approvals], [:id, :name, :approved, :approver_id, :approver_name])
|
|
35
|
+
say(approvals_table.print)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
if @showables.include?(:projects) || @showables.blank?
|
|
39
|
+
projects = response[:solution][:projects]
|
|
40
|
+
unless projects.nil? || projects.empty?
|
|
41
|
+
say("\n\nProjects details:")
|
|
42
|
+
projects.each do |project|
|
|
43
|
+
say("\n## #{project[:name]}")
|
|
44
|
+
project[:uri] = project[:uris].first unless project[:uris].nil?
|
|
45
|
+
projects_table = EPC::TabularOutputter.new([project], [:id, :name, :version, :status, :uri, :instances])
|
|
46
|
+
say(projects_table.print)
|
|
47
|
+
|
|
48
|
+
config_values = project[:config_values]
|
|
49
|
+
unless config_values.nil? || config_values.empty?
|
|
50
|
+
say("\nConfig values: ")
|
|
51
|
+
config_values_table = EPC::TabularOutputter.new(config_values, [:name, :value])
|
|
52
|
+
say(config_values_table.print)
|
|
53
|
+
end
|
|
54
|
+
say("\n\n")
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
return status
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
data/lib/epc/command/{update_deploymentproject_command.rb → deployment/update_deployment_command.rb}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
module EPC::Command
|
|
2
|
-
class
|
|
2
|
+
class UpdateDeploymentCommand < BaseCommand
|
|
3
3
|
|
|
4
|
-
def execute(deployment_id = nil,
|
|
4
|
+
def execute(deployment_id = nil, target = nil, *args)
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
project_id = target.split(":")[1] rescue nil
|
|
7
7
|
|
|
8
8
|
instances = @options[:instances]
|
|
9
9
|
uris = @options[:uris]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module EPC::Command
|
|
2
|
+
class DeleteGroupCommand < DeleteCommand
|
|
3
|
+
|
|
4
|
+
def execute(group = nil, *args)
|
|
5
|
+
|
|
6
|
+
proceed = ask_yn("Are you sure you want to delete the [#{group}] group? [Yn] ")
|
|
7
|
+
if proceed.upcase == "N"
|
|
8
|
+
return 1
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
group_id = retrieve_identifier_for("UserGroup", group)
|
|
12
|
+
|
|
13
|
+
status, response, headers = client.delete(EPC::Config::GROUPS_PATH + "/#{group_id}")
|
|
14
|
+
|
|
15
|
+
if status.successful?
|
|
16
|
+
say("Group deleted")
|
|
17
|
+
else
|
|
18
|
+
say("Request failed: [#{response[:message]}]")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
return status
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
module EPC::Command
|
|
2
2
|
class ShowGroupCommand < BaseCommand
|
|
3
|
-
def execute(group = nil)
|
|
4
|
-
raise FatalError, "You need to specify a group id/name" if group.nil?
|
|
3
|
+
def execute(group = nil, *args)
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
group_id = group.to_i
|
|
8
|
-
else
|
|
9
|
-
group_id = get_resource_id(EPC::Config::GROUPS_PATH, :name, group)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
raise FatalError, "Could not determine group" if group_id.nil?
|
|
5
|
+
group_id = retrieve_identifier_for("UserGroup", group)
|
|
13
6
|
|
|
14
7
|
status, response, headers = client.get(EPC::Config::GROUPS_PATH + "/#{group_id}?include=users")
|
|
15
8
|
|
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
module EPC::Command
|
|
2
2
|
class UpdateGroupCommand < BaseCommand
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
if group.nil?
|
|
6
|
-
say("You must specify the group id/name")
|
|
7
|
-
say(EPC::Help::COMMAND_USAGES[:update_group])
|
|
8
|
-
return 1
|
|
9
|
-
end
|
|
4
|
+
required_options :add_user, :remove_user, :mode => :any?, :message => "You must specify a user/group/grant to added or removed"
|
|
10
5
|
|
|
11
|
-
|
|
12
|
-
group_id = group.to_i
|
|
13
|
-
else
|
|
14
|
-
group_id = get_resource_id(EPC::Config::GROUPS_PATH, :name, group)
|
|
15
|
-
end
|
|
6
|
+
def execute(group = nil, *args)
|
|
16
7
|
|
|
17
|
-
|
|
18
|
-
say("Group could not be found")
|
|
19
|
-
return 1
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
if @options[:add_user].nil? && @options[:remove_user].nil?
|
|
23
|
-
say("You must specify a user to be added or removed")
|
|
24
|
-
return 1
|
|
25
|
-
end
|
|
8
|
+
group_id = retrieve_identifier_for("UserGroup", group)
|
|
26
9
|
|
|
27
10
|
failures = []
|
|
28
11
|
if @options[:add_user].present?
|
|
@@ -8,11 +8,8 @@ module EPC::Command
|
|
|
8
8
|
params = {}
|
|
9
9
|
params[:name] = args[0]
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
else
|
|
14
|
-
params[:language_id] = get_resource_id(EPC::Config::LIBRARY_LANGUAGES_PATH, :name, args[1], :case_sensitivity => false)
|
|
15
|
-
end
|
|
11
|
+
params[:language_id] = retrieve_identifier_for("LibraryLanguage", args[1])
|
|
12
|
+
|
|
16
13
|
|
|
17
14
|
raise InputError, "Unable to determine library language" if params[:language_id].nil? || params[:language_id] == 0
|
|
18
15
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module EPC::Command
|
|
2
|
+
class DeleteLibraryCommand < BaseCommand
|
|
3
|
+
|
|
4
|
+
def execute(library = nil, *args)
|
|
5
|
+
|
|
6
|
+
proceed = ask_yn("Are you sure you want to delete the [#{library}] library? [Yn] ")
|
|
7
|
+
if proceed.upcase == 'N'
|
|
8
|
+
return 1
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
library_id = retrieve_identifier_for("Library", library.split(":"))
|
|
12
|
+
|
|
13
|
+
status, response, headers = client.delete(EPC::Config::LIBRARIES_PATH + "/#{library_id}")
|
|
14
|
+
if status.successful?
|
|
15
|
+
say("Library deleted")
|
|
16
|
+
else
|
|
17
|
+
say("Request failed: [#{response[:message]}]")
|
|
18
|
+
end
|
|
19
|
+
return status
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module EPC::Command
|
|
2
|
+
class DeleteLibrarylanguageCommand < DeleteCommand
|
|
3
|
+
|
|
4
|
+
def execute(language = nil, *args)
|
|
5
|
+
proceed = ask_yn("Are you sure you want to delete the [#{language}] language? [Yn] ")
|
|
6
|
+
if proceed.upcase == "N"
|
|
7
|
+
return 1
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
language_id = retrieve_identifier_for("LibraryLanguage", language)
|
|
11
|
+
|
|
12
|
+
status, response, headers = client.delete(EPC::Config::LIBRARY_LANGUAGES_PATH + "/#{language_id}")
|
|
13
|
+
|
|
14
|
+
if status.successful?
|
|
15
|
+
say("Language deleted")
|
|
16
|
+
else
|
|
17
|
+
say("Request failed: [#{response[:message]}]")
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
return status
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
end
|