dtk-client 0.9.1 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/Gemfile +1 -3
- data/README.md +2 -121
- data/Rakefile +44 -0
- data/bin/dtk +10 -88
- data/dtk-client.gemspec +21 -44
- data/examples/simple/dtk.module.yaml +32 -0
- data/{lib/git-logs/git.log → examples/simple/test/README.md} +0 -0
- data/examples/spark/dtk.module.yaml +120 -0
- data/examples/with_repo_content/deploy/puppet/manifests/hostname.pp +54 -0
- data/examples/with_repo_content/dtk.module.yaml +49 -0
- data/examples/with_repo_content/test/README.txt +0 -0
- data/features/dtk.feature +8 -0
- data/features/step_definitions/dtk_steps.rb +6 -0
- data/features/support/env.rb +15 -0
- data/lib/cli/command/mixin.rb +101 -0
- data/lib/cli/command/module/clone.rb +42 -0
- data/lib/cli/command/module/install.rb +52 -0
- data/lib/cli/command/module/list.rb +31 -0
- data/lib/cli/command/module/list_assemblies.rb +39 -0
- data/lib/cli/command/module/push.rb +34 -0
- data/lib/cli/command/module/uninstall.rb +46 -0
- data/lib/cli/command/module.rb +33 -0
- data/lib/cli/command/options.rb +33 -0
- data/lib/cli/command/service/cancel_task.rb +33 -0
- data/lib/cli/command/service/converge.rb +37 -0
- data/lib/{parser/adapters/thor/common_option_defs.rb → cli/command/service/create_workspace.rb} +13 -17
- data/lib/cli/command/service/destroy.rb +47 -0
- data/lib/cli/command/service/edit.rb +47 -0
- data/lib/cli/command/service/exec.rb +42 -0
- data/lib/cli/command/service/exec_sync.rb +53 -0
- data/lib/cli/command/service/list.rb +30 -0
- data/lib/cli/command/service/list_actions.rb +39 -0
- data/lib/cli/command/service/list_attributes.rb +44 -0
- data/lib/cli/command/service/list_component_links.rb +33 -0
- data/lib/cli/command/service/list_components.rb +39 -0
- data/lib/cli/command/service/list_dependent_modules.rb +33 -0
- data/lib/cli/command/service/list_nodes.rb +33 -0
- data/lib/cli/command/service/list_violations.rb +33 -0
- data/lib/cli/command/service/pull.rb +32 -0
- data/lib/cli/command/service/push.rb +37 -0
- data/lib/{shell/parse_monkey_patch.rb → cli/command/service/set_default_target.rb} +9 -17
- data/lib/cli/command/service/set_required_attributes.rb +32 -0
- data/lib/cli/command/service/ssh.rb +42 -0
- data/lib/cli/command/service/stage.rb +55 -0
- data/lib/cli/command/service/start.rb +33 -0
- data/lib/{shell/context_aux.rb → cli/command/service/stop.rb} +10 -23
- data/lib/cli/command/service/task_status.rb +39 -0
- data/lib/cli/command/service.rb +55 -0
- data/lib/{commands.rb → cli/command/subcommand.rb} +22 -25
- data/lib/{bundler_monkey_patch.rb → cli/command/token/arg.rb} +6 -6
- data/lib/cli/command/token/class_mixin.rb +96 -0
- data/lib/cli/command/token/flag.rb +42 -0
- data/lib/{execute/command/rest_call.rb → cli/command/token/mixin.rb} +23 -14
- data/lib/cli/command/token/switch.rb +35 -0
- data/lib/cli/command/token.rb +76 -0
- data/lib/cli/command.rb +46 -0
- data/lib/cli/context/attributes.rb +50 -0
- data/lib/cli/context/type/module.rb +34 -0
- data/lib/{commands/thor/state_change.rb → cli/context/type/service.rb} +11 -5
- data/lib/cli/context/type/top.rb +32 -0
- data/lib/cli/context/type.rb +42 -0
- data/lib/cli/context.rb +174 -0
- data/lib/cli/directory_parser/file_system.rb +105 -0
- data/lib/{execute/command.rb → cli/directory_parser.rb} +14 -17
- data/lib/{execute.rb → cli/file_obj.rb} +13 -9
- data/lib/cli/processor/plugin/gli.rb +70 -0
- data/lib/cli/processor.rb +60 -0
- data/lib/cli/runner/dtkn_access.rb +75 -0
- data/lib/cli/runner.rb +58 -0
- data/lib/cli/version.rb +8 -0
- data/lib/{config → client/config}/cacert.pem +0 -0
- data/lib/client/config/default.conf +20 -0
- data/lib/client/config.rb +106 -0
- data/lib/client/configurator.rb +182 -0
- data/lib/client/conn.rb +197 -0
- data/lib/client/content_generator.rb +127 -0
- data/lib/client/error/subclasses.rb +105 -0
- data/lib/client/error.rb +98 -0
- data/lib/client/git_repo/adapter/git_gem/error_handler.rb +70 -0
- data/lib/client/git_repo/adapter/git_gem.rb +179 -0
- data/lib/client/git_repo.rb +122 -0
- data/lib/client/logger.rb +136 -0
- data/lib/client/operation/account.rb +66 -0
- data/lib/client/operation/client_module_dir/git_repo.rb +286 -0
- data/lib/client/operation/client_module_dir.rb +138 -0
- data/lib/client/operation/module/clone_module.rb +52 -0
- data/lib/client/operation/module/install/common_module.rb +58 -0
- data/lib/client/operation/module/install/external_module.rb +122 -0
- data/lib/client/operation/module/install.rb +91 -0
- data/lib/client/operation/module/install_from_catalog.rb +76 -0
- data/lib/client/operation/module/list.rb +34 -0
- data/lib/client/operation/module/list_assemblies.rb +35 -0
- data/lib/client/operation/module/push.rb +62 -0
- data/lib/client/operation/module/uninstall.rb +44 -0
- data/lib/client/operation/module.rb +58 -0
- data/lib/{commands/common/thor/reparse.rb → client/operation/module_service_common.rb} +27 -16
- data/lib/client/operation/service/cancel_task.rb +29 -0
- data/lib/client/operation/service/commit_and_push.rb +128 -0
- data/lib/client/operation/service/converge.rb +50 -0
- data/lib/{util/common_util.rb → client/operation/service/create_workspace.rb} +13 -13
- data/lib/client/operation/service/destroy.rb +42 -0
- data/lib/client/operation/service/edit.rb +54 -0
- data/lib/client/operation/service/exec.rb +73 -0
- data/lib/client/operation/service/list.rb +32 -0
- data/lib/client/operation/service/list_actions.rb +34 -0
- data/lib/{commands/thor/dependency.rb → client/operation/service/list_attributes.rb} +16 -12
- data/lib/client/operation/service/list_component_links.rb +29 -0
- data/lib/{commands/common/thor/pull_clone_changes.rb → client/operation/service/list_components.rb} +13 -7
- data/lib/client/operation/service/list_dependent_modules.rb +29 -0
- data/lib/client/operation/service/list_nodes.rb +29 -0
- data/lib/{commands/thor/project.rb → client/operation/service/list_violations.rb} +8 -13
- data/lib/client/operation/service/pull.rb +37 -0
- data/lib/client/operation/service/set_default_target.rb +31 -0
- data/lib/client/operation/service/set_required_attributes.rb +41 -0
- data/lib/client/operation/service/ssh.rb +118 -0
- data/lib/client/operation/service/stage.rb +54 -0
- data/lib/client/operation/service/start.rb +29 -0
- data/lib/client/operation/service/stop.rb +30 -0
- data/lib/{task_status → client/operation/service/task_status}/refresh_mode.rb +15 -25
- data/lib/{task_status → client/operation/service/task_status}/snapshot_mode.rb +4 -5
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/format.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/result/action.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/result/components.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/result/node_level.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/result.rb +4 -4
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/steps/action.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/steps/components.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/steps/node_level.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/steps.rb +4 -4
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task.rb +3 -3
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/no_results.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/render.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/stage/render.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/stage.rb +3 -3
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/task_end.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/task_start.rb +1 -1
- data/lib/{task_status → client/operation/service/task_status}/stream_mode/element.rb +13 -13
- data/lib/{task_status → client/operation/service/task_status}/stream_mode.rb +5 -9
- data/lib/client/operation/service/task_status.rb +77 -0
- data/lib/client/operation/service.rb +54 -0
- data/lib/client/operation.rb +67 -0
- data/lib/client/operation_args.rb +40 -0
- data/lib/{execute/execute_context/result_store.rb → client/render/view/simple.rb} +15 -14
- data/lib/client/render/view/table/processor.rb +248 -0
- data/lib/client/render/view/table.rb +75 -0
- data/lib/client/render.rb +113 -0
- data/lib/client/response/error_handler.rb +97 -0
- data/lib/client/response/render_helper.rb +78 -0
- data/lib/client/response/subclasses.rb +62 -0
- data/lib/client/response.rb +83 -0
- data/lib/client/session.rb +62 -0
- data/lib/client/util/auxiliary.rb +34 -0
- data/lib/client/util/console.rb +81 -0
- data/lib/client/util/disk_cacher.rb +66 -0
- data/lib/client/util/dtk_path.rb +28 -0
- data/lib/{search_hash.rb → client/util/hash_with_optional_keys.rb} +29 -21
- data/lib/client/util/interactive_wizard.rb +84 -0
- data/lib/client/util/module_ref.rb +92 -0
- data/lib/client/util/os_util/print.rb +121 -0
- data/lib/client/util/os_util.rb +122 -0
- data/lib/{commands/thor/utils.rb → client/util/post_body.rb} +1 -1
- data/lib/{execute/error_usage.rb → client/util/query_string_hash.rb} +2 -2
- data/lib/client/util/remote_dependency.rb +67 -0
- data/lib/client/util/ssh_util.rb +89 -0
- data/lib/client/util/validation.rb +28 -0
- data/lib/client/util.rb +18 -0
- data/lib/{util/permission_util.rb → dtk_cli.rb} +10 -9
- data/lib/dtk_client.rb +18 -14
- data/test/default_test.rb +14 -0
- data/test/test_helper.rb +9 -0
- metadata +196 -307
- data/Gemfile_dev +0 -13
- data/bin/dtk-execute +0 -32
- data/bin/dtk-shell +0 -31
- data/lib/auxiliary.rb +0 -61
- data/lib/client.rb +0 -58
- data/lib/command_helper.rb +0 -33
- data/lib/command_helpers/git_repo/merge.rb +0 -153
- data/lib/command_helpers/git_repo.rb +0 -589
- data/lib/command_helpers/jenkins_client/config_xml.rb +0 -288
- data/lib/command_helpers/jenkins_client.rb +0 -106
- data/lib/command_helpers/service_importer.rb +0 -251
- data/lib/command_helpers/service_link.rb +0 -33
- data/lib/command_helpers/test_module_creator.rb +0 -69
- data/lib/command_helpers/test_module_templates/dtk.model.yaml.eruby +0 -10
- data/lib/command_helpers/test_module_templates/spec_helper.rb.eruby +0 -10
- data/lib/command_helpers/test_module_templates/temp_component_spec.rb.eruby +0 -5
- data/lib/commands/common/thor/access_control.rb +0 -133
- data/lib/commands/common/thor/action_result_handler.rb +0 -74
- data/lib/commands/common/thor/assembly_template.rb +0 -92
- data/lib/commands/common/thor/assembly_workspace.rb +0 -1638
- data/lib/commands/common/thor/base_command_helper.rb +0 -59
- data/lib/commands/common/thor/clone.rb +0 -82
- data/lib/commands/common/thor/common.rb +0 -88
- data/lib/commands/common/thor/common_base.rb +0 -49
- data/lib/commands/common/thor/create_target.rb +0 -70
- data/lib/commands/common/thor/edit.rb +0 -255
- data/lib/commands/common/thor/inventory_parser.rb +0 -98
- data/lib/commands/common/thor/list_diffs.rb +0 -128
- data/lib/commands/common/thor/module/import.rb +0 -215
- data/lib/commands/common/thor/module.rb +0 -1011
- data/lib/commands/common/thor/node.rb +0 -53
- data/lib/commands/common/thor/poller.rb +0 -65
- data/lib/commands/common/thor/pull_from_remote.rb +0 -152
- data/lib/commands/common/thor/puppet_forge.rb +0 -72
- data/lib/commands/common/thor/purge_clone.rb +0 -101
- data/lib/commands/common/thor/push_clone_changes.rb +0 -162
- data/lib/commands/common/thor/push_to_remote.rb +0 -94
- data/lib/commands/common/thor/remotes.rb +0 -71
- data/lib/commands/common/thor/set_required_attributes.rb +0 -46
- data/lib/commands/thor/account.rb +0 -239
- data/lib/commands/thor/assembly.rb +0 -361
- data/lib/commands/thor/attribute.rb +0 -79
- data/lib/commands/thor/component.rb +0 -70
- data/lib/commands/thor/component_module.rb +0 -501
- data/lib/commands/thor/component_template.rb +0 -174
- data/lib/commands/thor/developer.rb +0 -144
- data/lib/commands/thor/dtk.rb +0 -152
- data/lib/commands/thor/library.rb +0 -125
- data/lib/commands/thor/node.rb +0 -504
- data/lib/commands/thor/node_group.rb +0 -203
- data/lib/commands/thor/node_template.rb +0 -94
- data/lib/commands/thor/provider.rb +0 -233
- data/lib/commands/thor/remotes.rb +0 -49
- data/lib/commands/thor/service.rb +0 -932
- data/lib/commands/thor/service_module.rb +0 -900
- data/lib/commands/thor/target.rb +0 -250
- data/lib/commands/thor/task.rb +0 -116
- data/lib/commands/thor/test_module.rb +0 -310
- data/lib/commands/thor/workspace.rb +0 -698
- data/lib/config/client.conf.header +0 -20
- data/lib/config/configuration.rb +0 -99
- data/lib/config/default.conf +0 -16
- data/lib/config/disk_cacher.rb +0 -80
- data/lib/configurator.rb +0 -176
- data/lib/context_router.rb +0 -44
- data/lib/core.rb +0 -489
- data/lib/domain/git_adapter.rb +0 -412
- data/lib/domain/git_error_handler.rb +0 -64
- data/lib/domain/response/error_handler.rb +0 -86
- data/lib/domain/response.rb +0 -285
- data/lib/dtk-client/version.rb +0 -20
- data/lib/dtk_constants.rb +0 -40
- data/lib/dtk_error.rb +0 -114
- data/lib/dtk_logger.rb +0 -113
- data/lib/error.rb +0 -85
- data/lib/execute/cli_pure/cli_rerouter.rb +0 -102
- data/lib/execute/command/api_call/map.rb +0 -60
- data/lib/execute/command/api_call/service.rb +0 -91
- data/lib/execute/command/api_call/translation_term.rb +0 -119
- data/lib/execute/command/api_call.rb +0 -60
- data/lib/execute/command_processor/rest_call.rb +0 -59
- data/lib/execute/command_processor.rb +0 -30
- data/lib/execute/execute_context.rb +0 -86
- data/lib/execute/script/add_tenant.rb +0 -121
- data/lib/execute/script.rb +0 -64
- data/lib/parser/adapters/option_parser.rb +0 -70
- data/lib/parser/adapters/thor.rb +0 -555
- data/lib/require_first.rb +0 -104
- data/lib/shell/context.rb +0 -1064
- data/lib/shell/domain/active_context.rb +0 -186
- data/lib/shell/domain/context_entity.rb +0 -89
- data/lib/shell/domain/context_params.rb +0 -223
- data/lib/shell/domain/override_tasks.rb +0 -88
- data/lib/shell/domain/shadow_entity.rb +0 -76
- data/lib/shell/header_shell.rb +0 -44
- data/lib/shell/help_monkey_patch.rb +0 -283
- data/lib/shell/interactive_wizard.rb +0 -256
- data/lib/shell/message_queue.rb +0 -63
- data/lib/shell/status_monitor.rb +0 -124
- data/lib/shell.rb +0 -261
- data/lib/task_status.rb +0 -83
- data/lib/util/console.rb +0 -235
- data/lib/util/dtk_puppet.rb +0 -65
- data/lib/util/module_util.rb +0 -66
- data/lib/util/os_util.rb +0 -385
- data/lib/util/remote_dependency_util.rb +0 -84
- data/lib/util/ssh_util.rb +0 -94
- data/lib/view_processor/augmented_simple_list.rb +0 -44
- data/lib/view_processor/hash_pretty_print.rb +0 -123
- data/lib/view_processor/simple_list.rb +0 -156
- data/lib/view_processor/table_print.rb +0 -309
- data/lib/view_processor.rb +0 -129
- data/puppet/manifests/init.pp +0 -72
- data/puppet/manifests/params.pp +0 -16
- data/puppet/r8meta.puppet.yml +0 -35
- data/puppet/templates/bash_profile.erb +0 -2
- data/puppet/templates/client.conf.erb +0 -1
- data/puppet/templates/dtkclient.erb +0 -2
- data/spec/component_module_spec.rb +0 -34
- data/spec/dependency_spec.rb +0 -6
- data/spec/dtk_shell_spec.rb +0 -13
- data/spec/dtk_spec.rb +0 -33
- data/spec/lib/spec_helper.rb +0 -10
- data/spec/lib/spec_thor.rb +0 -108
- data/spec/node_template_spec.rb +0 -24
- data/spec/project_spec.rb +0 -6
- data/spec/repo_spec.rb +0 -7
- data/spec/response_spec.rb +0 -52
- data/spec/service_module_spec.rb +0 -38
- data/spec/service_spec.rb +0 -50
- data/spec/state_change_spec.rb +0 -7
- data/spec/table_print_spec.rb +0 -48
- data/spec/target_spec.rb +0 -57
- data/spec/task_spec.rb +0 -28
- data/views/assembly/augmented_simple_list.rb +0 -12
- data/views/assembly_template/augmented_simple_list.rb +0 -12
- data/views/list_task/augmented_simple_list.rb +0 -12
@@ -1,59 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2010-2016 dtk contributors
|
3
|
-
#
|
4
|
-
# This file is part of the dtk project.
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
module DTK::Client
|
19
|
-
class BaseCommandHelper
|
20
|
-
def initialize(command,context_params=nil)
|
21
|
-
@command = command
|
22
|
-
@context_params = context_params
|
23
|
-
@options = command.options
|
24
|
-
end
|
25
|
-
|
26
|
-
def print_external_dependencies(external_dependencies, location)
|
27
|
-
ambiguous = external_dependencies["ambiguous"]||[]
|
28
|
-
amb_sorted = ambiguous.map { |k,v| "#{k.split('/').last} (#{v.join(', ')})" }
|
29
|
-
inconsistent = external_dependencies["inconsistent"]||[]
|
30
|
-
possibly_missing = external_dependencies["possibly_missing"]||[]
|
31
|
-
|
32
|
-
OsUtil.print("There are inconsistent module dependencies mentioned #{location}: #{inconsistent.join(', ')}", :red) unless inconsistent.empty?
|
33
|
-
OsUtil.print("There are missing module dependencies mentioned #{location}: #{possibly_missing.join(', ')}", :yellow) unless possibly_missing.empty?
|
34
|
-
OsUtil.print("There are ambiguous module dependencies mentioned #{location}: '#{amb_sorted.join(', ')}'. One of the namespaces should be selected by editing the module_refs file", :yellow) if ambiguous && !ambiguous.empty?
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
def context_params()
|
39
|
-
@context_params || raise(DtkError, "[ERROR] @context_params is nil")
|
40
|
-
end
|
41
|
-
|
42
|
-
def retrieve_arguments(mapping, method_info = nil)
|
43
|
-
context_params.retrieve_arguments(mapping, method_info || @command.method_argument_names)
|
44
|
-
end
|
45
|
-
|
46
|
-
def get_namespace_and_name(*args)
|
47
|
-
@command.get_namespace_and_name(*args)
|
48
|
-
end
|
49
|
-
|
50
|
-
def rest_url(*args)
|
51
|
-
@command.rest_url(*args)
|
52
|
-
end
|
53
|
-
|
54
|
-
def post(*args)
|
55
|
-
@command.post(*args)
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
end
|
@@ -1,82 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2010-2016 dtk contributors
|
3
|
-
#
|
4
|
-
# This file is part of the dtk project.
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
dtk_require_common_commands('thor/common')
|
19
|
-
module DTK::Client
|
20
|
-
module CloneMixin
|
21
|
-
extend Console
|
22
|
-
include CommonMixin
|
23
|
-
##
|
24
|
-
#
|
25
|
-
# internal_trigger: this flag means that other method (internal) has trigger this.
|
26
|
-
# This will change behaviour of method
|
27
|
-
# module_type: will be :component_module or :service_module
|
28
|
-
|
29
|
-
def clone_aux(module_type, module_id, version, internal_trigger = false, omit_output = false, opts = {})
|
30
|
-
# if version = base do not clone latest, just base
|
31
|
-
if version && version.eql?('base')
|
32
|
-
version = nil
|
33
|
-
opts[:use_latest] = false
|
34
|
-
end
|
35
|
-
|
36
|
-
module_name, module_namespace, repo_url, branch, not_ok_response, version = workspace_branch_info(module_type, module_id, version, opts)
|
37
|
-
return not_ok_response if not_ok_response
|
38
|
-
|
39
|
-
# clone base version first if not cloned already
|
40
|
-
clone_base_aux(module_type, module_id, "#{module_namespace}:#{module_name}") if opts[:use_latest] && version
|
41
|
-
|
42
|
-
# TODO: DTK-2358: comenyed out because causing error in this jira; see if need to put in in revisedform to avoid this error; below is checking wromg thing ( module_location is set to wromg thing to check)
|
43
|
-
# module_location = OsUtil.module_location(module_type, "#{module_namespace}:#{module_name}", version)
|
44
|
-
# raise DTK::Client::DtkValidationError, "#{module_type.to_s.gsub('_',' ').capitalize} '#{module_name}#{version && "-#{version}"}' already cloned!" if File.directory?(module_location) && !opts[:skip_if_exist_check]
|
45
|
-
|
46
|
-
full_module_name = ModuleUtil.resolve_name(module_name, module_namespace)
|
47
|
-
|
48
|
-
# TODO: should we use instead Helper(:git_repo).create_clone_from_optional_branch
|
49
|
-
response = Helper(:git_repo).create_clone_with_branch(module_type,module_name,repo_url,branch,version,module_namespace,opts)
|
50
|
-
|
51
|
-
if response.ok?
|
52
|
-
print_name = "Module '#{full_module_name}'"
|
53
|
-
print_name << " version '#{version}'" if version
|
54
|
-
puts "#{print_name} has been successfully cloned!" unless omit_output
|
55
|
-
# when puppet forge import, print successfully imported instead of cloned
|
56
|
-
DTK::Client::OsUtil.print("#{print_name} has been successfully imported!", :yellow) if omit_output && opts[:print_imported]
|
57
|
-
unless internal_trigger
|
58
|
-
if Console.confirmation_prompt("Would you like to edit module now?")
|
59
|
-
context_params_for_module = create_context_for_module(full_module_name, module_type)
|
60
|
-
return edit(context_params_for_module)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
response
|
66
|
-
end
|
67
|
-
|
68
|
-
# clone base module version
|
69
|
-
def clone_base_aux(module_type, module_id, full_module_name)
|
70
|
-
base_module_location = OsUtil.module_location(module_type, full_module_name, nil)
|
71
|
-
unless File.directory?(base_module_location)
|
72
|
-
clone_aux(module_type, module_id, nil, true)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def create_context_for_module(full_module_name, module_type)
|
77
|
-
context_params_for_module = DTK::Shell::ContextParams.new
|
78
|
-
context_params_for_module.add_context_to_params(full_module_name, module_type.to_s.gsub!(/\_/,'-').to_sym, full_module_name)
|
79
|
-
return context_params_for_module
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
@@ -1,88 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2010-2016 dtk contributors
|
3
|
-
#
|
4
|
-
# This file is part of the dtk project.
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
module DTK::Client
|
19
|
-
module CommonMixin
|
20
|
-
private
|
21
|
-
# returns module_name, module_namespace, repo_url, branch, not_ok_response( only if error)
|
22
|
-
def workspace_branch_info(module_type, module_id, version, opts={})
|
23
|
-
# shortcut if have info about workspace branch already
|
24
|
-
if info = opts[:workspace_branch_info]
|
25
|
-
name_or_full_module_name = info[:module_name]
|
26
|
-
module_namespace, module_name = ModuleUtil.full_module_name_parts?(name_or_full_module_name)
|
27
|
-
module_namespace ||= info[:module_namespace]
|
28
|
-
ret = [module_name, module_namespace, info[:repo_url], info[:branch]]
|
29
|
-
unless ret.find{|r|r.nil?}
|
30
|
-
return ret
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
# if 'base' returned as version set to nil; 'base' = 'master' = nil
|
35
|
-
version = nil if version == 'base'
|
36
|
-
|
37
|
-
post_body = get_workspace_branch_info_post_body(module_type, module_id, version, opts)
|
38
|
-
response = post(rest_url("#{module_type}/get_workspace_branch_info"),post_body)
|
39
|
-
unless response.ok?
|
40
|
-
ret = [nil, nil, nil, nil, response, nil]
|
41
|
-
else
|
42
|
-
m_name, m_namespace, repo_url, w_branch, version = response.data(:module_name, :module_namespace, :repo_url, :workspace_branch, :version)
|
43
|
-
ret = [m_name, m_namespace, repo_url, w_branch, nil]
|
44
|
-
ret << version if opts[:use_latest]
|
45
|
-
end
|
46
|
-
ret
|
47
|
-
end
|
48
|
-
|
49
|
-
def get_workspace_branch_info_post_body(module_type, module_id, version_explicit, opts={})
|
50
|
-
id_field = "#{module_type}_id"
|
51
|
-
post_body = {
|
52
|
-
id_field => module_id
|
53
|
-
}
|
54
|
-
assembly_module = opts[:assembly_module]
|
55
|
-
if version = version_explicit||(assembly_module && assembly_module[:version])
|
56
|
-
post_body.merge!(:version => version)
|
57
|
-
end
|
58
|
-
if assembly_module
|
59
|
-
post_body.merge!(:assembly_module => true,:assembly_name => assembly_module[:assembly_name])
|
60
|
-
end
|
61
|
-
if use_latest = opts[:use_latest]
|
62
|
-
post_body.merge!(:use_latest => use_latest)
|
63
|
-
end
|
64
|
-
post_body
|
65
|
-
end
|
66
|
-
|
67
|
-
def get_remote_module_info_aux(module_type, module_id, remote_namespace, version=nil, module_refs_content=nil, local_namespace=nil)
|
68
|
-
id_field = "#{module_type}_id"
|
69
|
-
rsa_pub_value = SSHUtil.rsa_pub_key_content()
|
70
|
-
|
71
|
-
post_body = {
|
72
|
-
id_field => module_id,
|
73
|
-
:rsa_pub_key => rsa_pub_value,
|
74
|
-
:access_rights => "rw",
|
75
|
-
:action => "push"
|
76
|
-
}
|
77
|
-
post_body.merge!(:version => version) if version
|
78
|
-
post_body.merge!(:remote_namespace => remote_namespace) if remote_namespace
|
79
|
-
post_body.merge!(:local_namespace => local_namespace) if local_namespace
|
80
|
-
post_body.merge!(:module_ref_content => module_refs_content) if module_refs_content && !module_refs_content.empty?
|
81
|
-
|
82
|
-
response = post(rest_url("#{module_type}/get_remote_module_info"),post_body)
|
83
|
-
RemoteDependencyUtil.print_dependency_warnings(response)
|
84
|
-
response
|
85
|
-
end
|
86
|
-
|
87
|
-
end
|
88
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2010-2016 dtk contributors
|
3
|
-
#
|
4
|
-
# This file is part of the dtk project.
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
module DTK::Client
|
19
|
-
module Commands
|
20
|
-
module Common
|
21
|
-
class Base
|
22
|
-
def initialize(command_base,context_params)
|
23
|
-
@command_base = command_base
|
24
|
-
@context_params = context_params
|
25
|
-
end
|
26
|
-
private
|
27
|
-
def retrieve_arguments(mapping)
|
28
|
-
@context_params.retrieve_arguments(mapping,@command_base.method_argument_names())
|
29
|
-
end
|
30
|
-
|
31
|
-
def retrieve_option_hash(option_list)
|
32
|
-
ret = Hash.new
|
33
|
-
option_values = @context_params.retrieve_thor_options(option_list,@command_base.options)
|
34
|
-
option_values.each_with_index do |val,i|
|
35
|
-
unless val.nil?
|
36
|
-
key = option_list[i].to_s.gsub(/\!$/,'').to_sym
|
37
|
-
ret.merge!(key => val)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
ret
|
41
|
-
end
|
42
|
-
|
43
|
-
def post(url_path,body=nil)
|
44
|
-
@command_base.post(@command_base.rest_url(url_path),body)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2010-2016 dtk contributors
|
3
|
-
#
|
4
|
-
# This file is part of the dtk project.
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
dtk_require('common_base')
|
19
|
-
module DTK; module Client; module Commands::Common
|
20
|
-
class CreateTarget < Base
|
21
|
-
# option_list is of form [:provider!, :region, :keypair, :security_group!] indcating what is optional and what is required
|
22
|
-
def execute(type, option_list)
|
23
|
-
# we use :target_id but that will return provider_id (another name for target template ID)
|
24
|
-
target_name = retrieve_arguments([:option_1])
|
25
|
-
iaas_properties = iaas_properties(type,option_list)
|
26
|
-
provider = iaas_properties.delete(:provider)
|
27
|
-
post_body = {
|
28
|
-
:type => type.to_s,
|
29
|
-
:provider_id => provider,
|
30
|
-
:iaas_properties => iaas_properties
|
31
|
-
}
|
32
|
-
|
33
|
-
# cleanup for target name not being sterilazied correctly
|
34
|
-
post_body.merge!(:target_name => target_name.split(' ').first) if target_name
|
35
|
-
|
36
|
-
post 'target/create', post_body
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
def iaas_properties(type, option_list)
|
41
|
-
iaas_properties = retrieve_option_hash(option_list)
|
42
|
-
special_processing_security_groups!(iaas_properties)
|
43
|
-
special_processing_region!(iaas_properties)
|
44
|
-
iaas_properties
|
45
|
-
end
|
46
|
-
|
47
|
-
def special_processing_region!(iaas_properties)
|
48
|
-
if region = iaas_properties[:region]
|
49
|
-
Shell::InteractiveWizard.validate_region(region)
|
50
|
-
end
|
51
|
-
iaas_properties
|
52
|
-
end
|
53
|
-
|
54
|
-
def special_processing_security_groups!(iaas_properties)
|
55
|
-
if security_group = iaas_properties[:security_group]
|
56
|
-
if security_group.end_with?(',')
|
57
|
-
raise DtkValidationError.new("Multiple security groups should be separated with ',' and without spaces between them (e.g. --security_groups gr1,gr2,gr3,...) ")
|
58
|
-
end
|
59
|
-
security_groups = security_group.split(',')
|
60
|
-
|
61
|
-
unless security_groups.empty? || security_groups.size==1
|
62
|
-
iaas_properties.delete(:security_group)
|
63
|
-
iaas_properties.merge!(:security_group_set => security_groups)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
iaas_properties
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
end; end; end
|
@@ -1,255 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2010-2016 dtk contributors
|
3
|
-
#
|
4
|
-
# This file is part of the dtk project.
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
dtk_require_common_commands('thor/clone')
|
19
|
-
dtk_require_common_commands('thor/push_clone_changes')
|
20
|
-
dtk_require_common_commands('thor/pull_clone_changes')
|
21
|
-
dtk_require_common_commands('thor/reparse')
|
22
|
-
require 'yaml'
|
23
|
-
|
24
|
-
module DTK::Client
|
25
|
-
module EditMixin
|
26
|
-
include CloneMixin
|
27
|
-
include PushCloneChangesMixin
|
28
|
-
include PullCloneChangesMixin
|
29
|
-
include ReparseMixin
|
30
|
-
|
31
|
-
##
|
32
|
-
#
|
33
|
-
# module_type: will be one of
|
34
|
-
# :component_module
|
35
|
-
# :service_module
|
36
|
-
def edit_aux(module_type,module_id,module_name,version,opts={})
|
37
|
-
module_location = OsUtil.module_location(module_type,module_name,version,opts)
|
38
|
-
|
39
|
-
pull_if_needed = opts[:pull_if_needed]
|
40
|
-
# check if there is repository cloned
|
41
|
-
unless File.directory?(module_location)
|
42
|
-
if opts[:automatically_clone] or Console.confirmation_prompt("Edit not possible, module '#{module_name}#{version && "-#{version}"}' has not been cloned. Would you like to clone module now"+'?')
|
43
|
-
internal_trigger = true
|
44
|
-
omit_output = true
|
45
|
-
response = clone_aux(module_type,module_id,version,internal_trigger,omit_output,opts)
|
46
|
-
# if error return
|
47
|
-
return response unless response.ok?
|
48
|
-
pull_if_needed = false
|
49
|
-
else
|
50
|
-
# user choose not to clone needed module
|
51
|
-
return
|
52
|
-
end
|
53
|
-
end
|
54
|
-
# here we should have desired module cloned
|
55
|
-
|
56
|
-
if pull_if_needed
|
57
|
-
response = pull_clone_changes?(module_type,module_id,version,opts)
|
58
|
-
return response unless response.ok?
|
59
|
-
end
|
60
|
-
grit_adapter = Helper(:git_repo).create(module_location)
|
61
|
-
if edit_info = opts[:edit_file]
|
62
|
-
#TODO: cleanup so dont need :base_file_name
|
63
|
-
file_to_edit =
|
64
|
-
if edit_info.kind_of?(String)
|
65
|
-
edit_info
|
66
|
-
else #edit_info.kind_of?(Hash) and has key :base_file_name
|
67
|
-
base_file = edit_info[:base_file_name]
|
68
|
-
(File.exists?("#{module_location}/#{base_file}.yaml") ? "#{base_file}.yaml" : "#{base_file}.json")
|
69
|
-
end
|
70
|
-
OsUtil.edit("#{module_location}/#{file_to_edit}")
|
71
|
-
OsUtil.print("If you want to use different editor please set environment variable EDITOR and log back into dtk-shell!", :yellow) unless ENV['EDITOR']
|
72
|
-
else
|
73
|
-
Console.unix_shell(module_location, module_id, module_type, version)
|
74
|
-
end
|
75
|
-
|
76
|
-
unless grit_adapter.repo_exists?
|
77
|
-
puts "Local module has been removed, skipping changes."
|
78
|
-
return Response::Ok.new()
|
79
|
-
end
|
80
|
-
|
81
|
-
unless grit_adapter.changed?
|
82
|
-
puts "No changes to repository"
|
83
|
-
return Response::Ok.new()
|
84
|
-
end
|
85
|
-
|
86
|
-
unless file_to_edit
|
87
|
-
grit_adapter.print_status
|
88
|
-
end
|
89
|
-
|
90
|
-
# check to see if auto commit flag
|
91
|
-
auto_commit = ::DTK::Configuration.get(:auto_commit_changes)
|
92
|
-
confirmed_ok = false
|
93
|
-
|
94
|
-
# if there is no auto commit ask for confirmation
|
95
|
-
unless auto_commit
|
96
|
-
confirm_msg =
|
97
|
-
if file_to_edit
|
98
|
-
"Would you like to commit changes to the file?"
|
99
|
-
else
|
100
|
-
"Would you like to commit ALL the changes?"
|
101
|
-
end
|
102
|
-
confirmed_ok = Console.confirmation_prompt_simple(confirm_msg)
|
103
|
-
end
|
104
|
-
if (auto_commit || confirmed_ok)
|
105
|
-
if auto_commit
|
106
|
-
puts "[NOTICE] You are using auto-commit option, all changes you have made will be commited."
|
107
|
-
end
|
108
|
-
commit_msg = user_input("Commit message")
|
109
|
-
|
110
|
-
# remove qoutes if they are not closed properly in commit_msg
|
111
|
-
commit_msg.gsub!(/\"/,'') unless commit_msg.count('"') % 2 ==0
|
112
|
-
|
113
|
-
internal_trigger=true
|
114
|
-
reparse_aux(module_location)
|
115
|
-
|
116
|
-
# use_impl_id - if edit-component-module which has version use impl_id from assembly--<assembly_name> version of component instance
|
117
|
-
opts.merge!(:force_parse => true, :update_from_includes => true, :print_dependencies => true, :use_impl_id => true)
|
118
|
-
response = push_clone_changes_aux(module_type,module_id,version,commit_msg,internal_trigger,opts)
|
119
|
-
|
120
|
-
# if error return
|
121
|
-
return response unless response.ok?
|
122
|
-
end
|
123
|
-
|
124
|
-
#TODO: temporary took out; wil put back in
|
125
|
-
#puts "DTK SHELL TIP: Adding the client configuration parameter <config param name>=true will have the client automatically commit each time you exit edit mode" unless auto_commit
|
126
|
-
Response::Ok.new()
|
127
|
-
end
|
128
|
-
|
129
|
-
# returns text string with edited yaml content
|
130
|
-
def attributes_editor(yaml_input)
|
131
|
-
dtk_folder = OsUtil.dtk_local_folder
|
132
|
-
file_path = "#{dtk_folder}/temp_attrs.yaml"
|
133
|
-
File.open(file_path, 'w'){|f| f << yaml_input}
|
134
|
-
OsUtil.edit(file_path)
|
135
|
-
OsUtil.print("If you want to use different editor please set environment variable EDITOR and log back into dtk-shell!", :yellow) unless ENV['EDITOR']
|
136
|
-
edited_yaml = File.open(file_path,'r'){|f|f.read}
|
137
|
-
File.unlink(file_path)
|
138
|
-
edited_yaml
|
139
|
-
end
|
140
|
-
private
|
141
|
-
# removes any nil values and returns hash; also modifies any term that does not serialize
|
142
|
-
def post_process(object)
|
143
|
-
ret = Hash.new
|
144
|
-
if object.kind_of?(Hash)
|
145
|
-
post_process__hash(object)
|
146
|
-
elsif object.kind_of?(Array)
|
147
|
-
post_process__array(object)
|
148
|
-
elsif object.kind_of?(FalseClass)
|
149
|
-
Response::Term::Boolean.false
|
150
|
-
else
|
151
|
-
object
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
def post_process__hash(hash)
|
156
|
-
ret = Hash.new
|
157
|
-
hash.each_pair do |k,v|
|
158
|
-
processed_val = post_process(v)
|
159
|
-
#processed_val can be false so explicitly checking against nil
|
160
|
-
unless processed_val.nil?
|
161
|
-
ret.merge!(k => processed_val)
|
162
|
-
end
|
163
|
-
end
|
164
|
-
ret
|
165
|
-
end
|
166
|
-
|
167
|
-
def post_process__array(array)
|
168
|
-
ret = Array.new
|
169
|
-
array.each do |a|
|
170
|
-
# explicit nil not removed
|
171
|
-
if a.nil?
|
172
|
-
ret << Response::Term.nil()
|
173
|
-
else
|
174
|
-
processed_val = post_process(a)
|
175
|
-
#processed_val can be false so explicitly checking against nil
|
176
|
-
unless processed_val.nil?
|
177
|
-
ret << processed_val
|
178
|
-
end
|
179
|
-
end
|
180
|
-
end
|
181
|
-
ret
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
|
187
|
-
=begin
|
188
|
-
# TODO: probably deprecate
|
189
|
-
def attribute_header()
|
190
|
-
header_string =
|
191
|
-
"#############################\n#### REQUIRED ATTRIBUTES\n#############################\n#\n"
|
192
|
-
end
|
193
|
-
# TODO: probably deprecate
|
194
|
-
def attributes_editor_old_form(attributes,format)
|
195
|
-
if (format.eql?('yaml'))
|
196
|
-
dtk_folder = OsUtil.dtk_local_folder
|
197
|
-
file_path = "#{dtk_folder}/temp_attrs.yaml"
|
198
|
-
|
199
|
-
first_iteration_keys, first_iteration_values = [], []
|
200
|
-
second_iteration_keys, second_iteration_values = [], []
|
201
|
-
required_attributes = []
|
202
|
-
|
203
|
-
attribute_pairs = YAML.load(attributes)
|
204
|
-
|
205
|
-
attribute_pairs.each do |k,v|
|
206
|
-
first_iteration_keys << k
|
207
|
-
|
208
|
-
#prepare required attributes for editor display
|
209
|
-
if v.eql?("*REQUIRED*")
|
210
|
-
required_attributes << k
|
211
|
-
attribute_pairs[k] = nil
|
212
|
-
v = nil
|
213
|
-
end
|
214
|
-
|
215
|
-
first_iteration_values << v
|
216
|
-
end
|
217
|
-
|
218
|
-
File.open(file_path, 'w') do |out|
|
219
|
-
# print out required attributes
|
220
|
-
unless required_attributes.empty?
|
221
|
-
out.write(attribute_header())
|
222
|
-
required_attributes.each do |req_attr|
|
223
|
-
out.write("##{req_attr}\n")
|
224
|
-
end
|
225
|
-
out.write("#\n")
|
226
|
-
end
|
227
|
-
|
228
|
-
YAML.dump(attribute_pairs, out)
|
229
|
-
end
|
230
|
-
|
231
|
-
OsUtil.edit(file_path)
|
232
|
-
OsUtil.print("If you want to use different editor please set environment variable EDITOR and log back into dtk-shell!", :yellow) unless ENV['EDITOR']
|
233
|
-
begin
|
234
|
-
edited = YAML.load_file(file_path)
|
235
|
-
rescue Psych::SyntaxError => e
|
236
|
-
raise DSLParsing::YAMLParsing.new("YAML parsing error #{e} in file",file_path)
|
237
|
-
end
|
238
|
-
|
239
|
-
edited.each do |k,v|
|
240
|
-
second_iteration_keys << k
|
241
|
-
second_iteration_values << v
|
242
|
-
end
|
243
|
-
|
244
|
-
unless first_iteration_keys == second_iteration_keys
|
245
|
-
edited_keys = second_iteration_keys.select{|k| !first_iteration_keys.include?(k)}
|
246
|
-
raise DtkValidationError, "You have changed key(s) '#{edited_keys}'. We do not support key editing yet!"
|
247
|
-
end
|
248
|
-
|
249
|
-
raise DtkValidationError, "No attribute changes have been made." if ((first_iteration_keys == second_iteration_keys) && (first_iteration_values == second_iteration_values))
|
250
|
-
edited
|
251
|
-
else
|
252
|
-
raise DtkValidationError, "Unsupported format type '#{format.to_s}'!"
|
253
|
-
end
|
254
|
-
end
|
255
|
-
=end
|