dtk-client 0.11.3 → 0.11.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.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/lib/cli/command/module/install.rb +81 -21
- data/lib/cli/command/module.rb +1 -1
- data/lib/cli/command/service/exec.rb +4 -2
- data/lib/cli/command/service/exec_sync.rb +2 -0
- data/lib/cli/command/service/list_attributes.rb +8 -8
- data/lib/cli/command/service/uninstall.rb +4 -7
- data/lib/cli/command/token.rb +1 -0
- data/lib/cli/version.rb +1 -1
- data/lib/client/operation/module/clone_module.rb +9 -3
- data/lib/client/operation/module/install/dependent_modules/component_dependency_tree.rb +1 -1
- data/lib/client/operation/module/install_from_catalog.rb +23 -19
- data/lib/client/operation/module/pull_dtkn.rb +5 -2
- data/lib/client/operation/module/push.rb +8 -2
- data/lib/client/operation/module/push_dtkn.rb +1 -1
- data/lib/client/operation/service/exec.rb +3 -1
- data/lib/client/operation/service/list_attributes.rb +4 -4
- data/lib/client/operation/service/uninstall.rb +3 -9
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a4fe37c7f760ab997a0789958481c16a3924f8fc
         | 
| 4 | 
            +
              data.tar.gz: 4329e1f91b5b7542cccbe0d27105e831d7b7f498
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e7ee7ed59d2b153fa7e4815f006f6a7fc42a1ffcf67b67818a9278a4a44c44c9d08a65f9859f0d56f14e7066285f0a49f96677ea916d2f9c12907faae5208372
         | 
| 7 | 
            +
              data.tar.gz: e09ab967d418e7445f6d584682f2059d8a07f06b5e1fde7a09a4541d4bb353c5e5b7b2410cb4efc9066238695b0c81c6528aedb5709673b526f08d5c553084bc
         | 
    
        data/.gitignore
    CHANGED
    
    
| @@ -30,40 +30,100 @@ module DTK::Client | |
| 30 30 | 
             
                      sc.switch Token.update_deps
         | 
| 31 31 |  | 
| 32 32 | 
             
                      sc.action do |_global_options, options, args|
         | 
| 33 | 
            -
                        directory_path | 
| 34 | 
            -
                        version | 
| 35 | 
            -
                        update_deps | 
| 33 | 
            +
                        directory_path  = args[1] || options[:directory_path]
         | 
| 34 | 
            +
                        version         = options[:version]
         | 
| 35 | 
            +
                        update_deps     = options[:update_deps]
         | 
| 36 36 | 
             
                        has_remote_repo = false
         | 
| 37 | 
            -
             | 
| 37 | 
            +
                        is_clone        = false
         | 
| 38 | 
            +
             | 
| 38 39 | 
             
                        if module_name = args[0]
         | 
| 39 40 | 
             
                          # reached if installing from dtkn
         | 
| 40 41 | 
             
                          # installs content from dtkn (later probably from other remote catalogs) onto client machine
         | 
| 41 42 | 
             
                          # in so doing installes depedent modules onto teh dtk server; this step though does not install main module onto
         | 
| 42 43 | 
             
                          # server (the later step Operation::Module.install does this)
         | 
| 43 | 
            -
                          has_remote_repo | 
| 44 | 
            -
                          module_ref | 
| 45 | 
            -
                           | 
| 46 | 
            -
                        end
         | 
| 44 | 
            +
                          has_remote_repo    = true
         | 
| 45 | 
            +
                          module_ref         = module_ref_object_from_options_or_context?(:module_ref => module_name, :version => version)
         | 
| 46 | 
            +
                          remote_module_info = nil
         | 
| 47 47 |  | 
| 48 | 
            -
             | 
| 48 | 
            +
                          unless version
         | 
| 49 | 
            +
                            remote_module_info = get_remote_module_info(module_ref)
         | 
| 50 | 
            +
                            version            = remote_module_info.required(:version)
         | 
| 51 | 
            +
                            module_ref.version = version
         | 
| 52 | 
            +
                          end
         | 
| 49 53 |  | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 54 | 
            +
                          if Operation::Module.module_version_exists?(module_ref, :type => :common_module)
         | 
| 55 | 
            +
                            clone_module(module_ref, directory_path, version)
         | 
| 56 | 
            +
                            is_clone = true
         | 
| 57 | 
            +
                          else
         | 
| 58 | 
            +
                            target_repo_dir = Operation::Module.install_from_catalog(:module_ref => module_ref, :version => version, :directory_path => directory_path, :remote_module_info => remote_module_info)
         | 
| 59 | 
            +
                          end
         | 
| 52 60 | 
             
                        end
         | 
| 53 61 |  | 
| 54 | 
            -
                         | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
                           | 
| 58 | 
            -
             | 
| 59 | 
            -
                           | 
| 60 | 
            -
             | 
| 61 | 
            -
                          : | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 62 | 
            +
                        unless is_clone
         | 
| 63 | 
            +
                          raise Error::Usage, "You can use version only with 'namespace/name' provided" if version && module_name.nil?
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                          if target_repo_dir
         | 
| 66 | 
            +
                            directory_path ||= target_repo_dir.data[:target_repo_dir]
         | 
| 67 | 
            +
                          end
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                          install_opts = directory_path ? { :directory_path => directory_path, :version => (version || 'master') } : options
         | 
| 70 | 
            +
                          module_ref   = module_ref_object_from_options_or_context?(install_opts)
         | 
| 71 | 
            +
                          operation_args = {
         | 
| 72 | 
            +
                            :module_ref          => module_ref,
         | 
| 73 | 
            +
                            :base_dsl_file_obj   => @base_dsl_file_obj,
         | 
| 74 | 
            +
                            :has_directory_param => !options["d"].nil?,
         | 
| 75 | 
            +
                            :has_remote_repo     => has_remote_repo,
         | 
| 76 | 
            +
                            :update_deps         => update_deps
         | 
| 77 | 
            +
                          }
         | 
| 78 | 
            +
                          Operation::Module.install(operation_args)
         | 
| 79 | 
            +
                        end
         | 
| 64 80 | 
             
                      end
         | 
| 65 81 | 
             
                    end
         | 
| 66 82 | 
             
                  end
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                  def clone_module(module_ref, directory_path, version)
         | 
| 85 | 
            +
                    arg = {
         | 
| 86 | 
            +
                      :module_ref => module_ref,
         | 
| 87 | 
            +
                      :target_directory => Operation::ClientModuleDir.create_module_dir_from_path(directory_path || OsUtil.current_dir)
         | 
| 88 | 
            +
                    }
         | 
| 89 | 
            +
                    repo_dir_info = Operation::Module.clone_module(arg).data
         | 
| 90 | 
            +
                    repo_dir      = repo_dir_info[:target_repo_dir]
         | 
| 91 | 
            +
             | 
| 92 | 
            +
                    # DTK-3088 - need this to pull service info for dependency module on clone
         | 
| 93 | 
            +
                    if repo_dir_info[:pull_service_info]# && (version.nil? || version.eql?('master'))
         | 
| 94 | 
            +
                      repo_dir = repo_dir_info[:target_repo_dir]
         | 
| 95 | 
            +
                      module_ref = module_ref_object_from_options_or_context(:directory_path => repo_dir)
         | 
| 96 | 
            +
             | 
| 97 | 
            +
                      operation_args = {
         | 
| 98 | 
            +
                        :module_ref          => module_ref,
         | 
| 99 | 
            +
                        :base_dsl_file_obj   => @base_dsl_file_obj,
         | 
| 100 | 
            +
                        :has_directory_param => true,
         | 
| 101 | 
            +
                        :directory_path      => repo_dir,
         | 
| 102 | 
            +
                        :update_deps         => false,
         | 
| 103 | 
            +
                        :do_not_print        => true,
         | 
| 104 | 
            +
                        :force               => true,
         | 
| 105 | 
            +
                        :allow_version       => true
         | 
| 106 | 
            +
                      }
         | 
| 107 | 
            +
             | 
| 108 | 
            +
                      Operation::Module.pull_dtkn(operation_args)
         | 
| 109 | 
            +
                      Operation::Module.push(operation_args.merge(:method => "pulled"))
         | 
| 110 | 
            +
                    end
         | 
| 111 | 
            +
             | 
| 112 | 
            +
                    OsUtil.print_info("DTK module '#{module_ref.pretty_print}' has been successfully cloned from server into '#{repo_dir}'")
         | 
| 113 | 
            +
                  end
         | 
| 114 | 
            +
             | 
| 115 | 
            +
                  private
         | 
| 116 | 
            +
             | 
| 117 | 
            +
                  def get_remote_module_info(module_ref)
         | 
| 118 | 
            +
                    query_string_hash = QueryStringHash.new(
         | 
| 119 | 
            +
                      :module_name => module_ref.module_name,
         | 
| 120 | 
            +
                      :namespace   => module_ref.namespace,
         | 
| 121 | 
            +
                      :rsa_pub_key => SSHUtil.rsa_pub_key_content,
         | 
| 122 | 
            +
                      :version?    => nil
         | 
| 123 | 
            +
                    )
         | 
| 124 | 
            +
             | 
| 125 | 
            +
                    Operation::Module.rest_get("#{Operation::Module::BaseRoute}/remote_module_info", query_string_hash)
         | 
| 126 | 
            +
                  end
         | 
| 67 127 | 
             
                end
         | 
| 68 128 | 
             
              end
         | 
| 69 129 | 
             
            end
         | 
    
        data/lib/cli/command/module.rb
    CHANGED
    
    
| @@ -23,18 +23,20 @@ module DTK::Client | |
| 23 23 | 
             
                    c.arg Token::Arg.action_params, :optional => true
         | 
| 24 24 | 
             
                    command_body c, :exec, 'Execute action asynchronously' do |sc|
         | 
| 25 25 | 
             
                      sc.flag Token.directory_path, :desc => 'Absolute or relative path to service instance directory containing updates to pull; not need if in the service instance directory'
         | 
| 26 | 
            +
                      sc.switch Token.breakpoint
         | 
| 26 27 | 
             
                      sc.action do |_global_options, options, args|
         | 
| 27 28 |  | 
| 28 29 | 
             
                        service_instance = service_instance_in_options_or_context(options)
         | 
| 29 | 
            -
             | 
| 30 | 
            +
             | 
| 30 31 | 
             
                        action        = args[0]
         | 
| 31 32 | 
             
                        action_params = args[1]
         | 
| 32 33 | 
             
                        directory_path = options[:d] || @base_dsl_file_obj.parent_dir
         | 
| 33 | 
            -
             | 
| 34 | 
            +
             | 
| 34 35 | 
             
                        args = {
         | 
| 35 36 | 
             
                          :service_instance => service_instance,
         | 
| 36 37 | 
             
                          :action           => action,
         | 
| 37 38 | 
             
                          :action_params    => action_params,
         | 
| 39 | 
            +
                          :breakpoint       => options['breakpoint'],
         | 
| 38 40 | 
             
                          :directory_path   => directory_path,
         | 
| 39 41 | 
             
                          :command          => 'exec'
         | 
| 40 42 | 
             
                        }
         | 
| @@ -23,6 +23,7 @@ module DTK::Client | |
| 23 23 | 
             
                    c.arg Token::Arg.action_params, :optional => true
         | 
| 24 24 | 
             
                    command_body c, 'exec-sync', 'Execute action synchronously' do |sc|
         | 
| 25 25 | 
             
                     sc.flag Token.directory_path, :desc => 'Absolute or relative path to service instance directory containing updates to pull; not need if in the service instance directory'
         | 
| 26 | 
            +
                     sc.switch Token.breakpoint
         | 
| 26 27 | 
             
                      sc.action do |_global_options, options, args|
         | 
| 27 28 | 
             
                        service_instance = service_instance_in_options_or_context(options)
         | 
| 28 29 |  | 
| @@ -34,6 +35,7 @@ module DTK::Client | |
| 34 35 | 
             
                          :service_instance => service_instance,
         | 
| 35 36 | 
             
                          :action           => action,
         | 
| 36 37 | 
             
                          :action_params    => action_params,
         | 
| 38 | 
            +
                          :breakpoint       => options['breakpoint'],
         | 
| 37 39 | 
             
                          :directory_path   => directory_path,
         | 
| 38 40 | 
             
                          :command          => 'exec-sync'
         | 
| 39 41 | 
             
                        }
         | 
| @@ -21,10 +21,10 @@ module DTK::Client; module CLI | |
| 21 21 | 
             
                  subcommand_def 'list-attributes' do |c|
         | 
| 22 22 | 
             
                    command_body c, 'attributes', 'List attributes associated with service instance.' do |sc|
         | 
| 23 23 | 
             
                      sc.flag Token.directory_path, :desc => 'Absolute or relative path to service instance directory containing updates to pull; not need if in the service instance directory'
         | 
| 24 | 
            -
                      sc.flag Token.node, :desc => 'Filter attributes by node'
         | 
| 24 | 
            +
            #          sc.flag Token.node, :desc => 'Filter attributes by node'
         | 
| 25 25 | 
             
                      sc.flag Token.format
         | 
| 26 | 
            -
                      sc.flag Token.component, :desc => 'Filter attributes by component'
         | 
| 27 | 
            -
                       | 
| 26 | 
            +
            #          sc.flag Token.component, :desc => 'Filter attributes by component'
         | 
| 27 | 
            +
                      sc.switch Token.all, :desc => 'List component and node level attributes with top level ones'
         | 
| 28 28 | 
             
                      sc.switch Token.links, :desc => 'Display attribute links'
         | 
| 29 29 |  | 
| 30 30 | 
             
                      sc.action do |_global_options, options, _args|
         | 
| @@ -32,10 +32,10 @@ module DTK::Client; module CLI | |
| 32 32 |  | 
| 33 33 | 
             
                        args = {
         | 
| 34 34 | 
             
                          :service_instance => service_instance,
         | 
| 35 | 
            -
                          :links            => options[:links] | 
| 36 | 
            -
                          :node             => options[:node],
         | 
| 37 | 
            -
                          :component        => options[:component],
         | 
| 38 | 
            -
                           | 
| 35 | 
            +
                          :links            => options[:links],
         | 
| 36 | 
            +
                          # :node             => options[:node],
         | 
| 37 | 
            +
                          # :component        => options[:component],
         | 
| 38 | 
            +
                          :all              => options[:all],
         | 
| 39 39 | 
             
                          :format           => options[:format]
         | 
| 40 40 | 
             
                        }
         | 
| 41 41 | 
             
                        Operation::Service.list_attributes(args)
         | 
| @@ -44,4 +44,4 @@ module DTK::Client; module CLI | |
| 44 44 | 
             
                  end
         | 
| 45 45 | 
             
                end
         | 
| 46 46 | 
             
              end
         | 
| 47 | 
            -
            end; end
         | 
| 47 | 
            +
            end; end
         | 
| @@ -24,13 +24,11 @@ module DTK::Client; module CLI | |
| 24 24 | 
             
                      sc.flag Token.uninstall_name
         | 
| 25 25 | 
             
                      sc.switch Token.skip_prompt, :desc => 'Skip prompt that checks if user wants to delete the service instance'
         | 
| 26 26 | 
             
                      sc.switch Token.purge, :desc => 'Delete the service instance directory on the client'
         | 
| 27 | 
            -
                      sc.switch Token.delete, :desc => 'Removes service instance with all nodes and modules'
         | 
| 28 27 | 
             
                      sc.switch Token.recursive, :desc => 'Delete dependent service instances'
         | 
| 29 28 | 
             
                      sc.switch Token.force, :desc => 'Ignore errors and delete service instance. This will not terminate aws instances, you will have to do that manually'
         | 
| 30 29 | 
             
                      sc.action do |_global_options, options, args|
         | 
| 31 30 | 
             
                        directory_path = options[:directory_path]
         | 
| 32 31 | 
             
                        purge          = options[:purge]
         | 
| 33 | 
            -
                        delete         = options[:delete]
         | 
| 34 32 | 
             
                        force          = options[:f]
         | 
| 35 33 | 
             
                        recursive      = options[:recursive]
         | 
| 36 34 | 
             
                        name           = options[:uninstall_name]
         | 
| @@ -39,18 +37,17 @@ module DTK::Client; module CLI | |
| 39 37 | 
             
                          raise Error::Usage, "If use option '#{option_ref(:purge)}' then need to call from outside directory and use option '#{option_ref(:directory_path)}'"
         | 
| 40 38 | 
             
                        end
         | 
| 41 39 |  | 
| 42 | 
            -
                        if name.nil? | 
| 43 | 
            -
                          service_instance = service_instance_in_options_or_context(options, :ignore_parsing_errors => true) | 
| 44 | 
            -
                        else | 
| 40 | 
            +
                        if name.nil?
         | 
| 41 | 
            +
                          service_instance = service_instance_in_options_or_context(options, :ignore_parsing_errors => true)
         | 
| 42 | 
            +
                        else
         | 
| 45 43 | 
             
                          service_instance = name
         | 
| 46 44 | 
             
                        end
         | 
| 47 45 |  | 
| 48 | 
            -
                        args = { | 
| 46 | 
            +
                        args = {
         | 
| 49 47 | 
             
                          :service_instance => service_instance,
         | 
| 50 48 | 
             
                          :skip_prompt      => options[:skip_prompt],
         | 
| 51 49 | 
             
                          :directory_path   => directory_path,
         | 
| 52 50 | 
             
                          :purge            => purge,
         | 
| 53 | 
            -
                          :delete           => delete,
         | 
| 54 51 | 
             
                          :recursive        => recursive,
         | 
| 55 52 | 
             
                          :force            => force
         | 
| 56 53 | 
             
                        }
         | 
    
        data/lib/cli/command/token.rb
    CHANGED
    
    | @@ -56,6 +56,7 @@ module DTK::Client | |
| 56 56 | 
             
                    # Switch constructor args order: key, desc, opts={}
         | 
| 57 57 | 
             
                    :all          => Switch.new(:all, 'All'),
         | 
| 58 58 | 
             
                    :base         => Switch.new(:base, 'Create base service instance'),
         | 
| 59 | 
            +
                    :breakpoint       => Switch.new([:b, :breakpoint], 'Add breakpoint'),
         | 
| 59 60 | 
             
                    :delete       => Switch.new(:delete, 'Delete'),
         | 
| 60 61 | 
             
                    :force        => Switch.new([:f, :force], 'Force'),
         | 
| 61 62 | 
             
                    :purge        => Switch.new(:purge, 'Purge'),
         | 
    
        data/lib/cli/version.rb
    CHANGED
    
    
| @@ -34,7 +34,7 @@ module DTK::Client | |
| 34 34 | 
             
                  end
         | 
| 35 35 |  | 
| 36 36 | 
             
                  def clone_module
         | 
| 37 | 
            -
                    unless module_info = module_version_exists?(@module_ref, :type => :common_module, :remote_info =>  | 
| 37 | 
            +
                    unless module_info = module_version_exists?(@module_ref, :type => :common_module, :remote_info => false, :rsa_pub_key => SSHUtil.rsa_pub_key_content)
         | 
| 38 38 | 
             
                      raise Error::Usage, "DTK module '#{@module_ref.pretty_print}' does not exist on the DTK Server."
         | 
| 39 39 | 
             
                    end
         | 
| 40 40 |  | 
| @@ -92,8 +92,14 @@ module DTK::Client | |
| 92 92 | 
             
                      :rsa_pub_key => SSHUtil.rsa_pub_key_content,
         | 
| 93 93 | 
             
                      :version     => version||'master'
         | 
| 94 94 | 
             
                    )
         | 
| 95 | 
            -
             | 
| 96 | 
            -
                     | 
| 95 | 
            +
             | 
| 96 | 
            +
                    begin
         | 
| 97 | 
            +
                      remote_module_info = rest_get "#{BaseRoute}/remote_module_info", query_string_hash
         | 
| 98 | 
            +
                    rescue DTK::Client::Error::ServerNotOkResponse => e
         | 
| 99 | 
            +
                      # ignore if remote does not exist
         | 
| 100 | 
            +
                    end
         | 
| 101 | 
            +
             | 
| 102 | 
            +
                    if remote_module_info && remote_module_info.data(:service_info)
         | 
| 97 103 | 
             
                      !module_version_exists?(@module_ref, :type => :service_module)
         | 
| 98 104 | 
             
                    end
         | 
| 99 105 | 
             
                  end
         | 
| @@ -130,7 +130,7 @@ module DTK::Client; class Operation::Module | |
| 130 130 | 
             
                    are_there_warnings = RemoteDependency.check_permission_warnings(module_dependencies_response)
         | 
| 131 131 | 
             
                    are_there_warnings ||= RemoteDependency.print_dependency_warnings(module_dependencies_response, nil, :ignore_permission_warnings => true)
         | 
| 132 132 | 
             
                    if are_there_warnings
         | 
| 133 | 
            -
                      raise TerminateInstall unless Console.prompt_yes_no("Do you still want to proceed with install?", :add_options => true)
         | 
| 133 | 
            +
                      raise Install::TerminateInstall unless Console.prompt_yes_no("Do you still want to proceed with install?", :add_options => true)
         | 
| 134 134 | 
             
                    end
         | 
| 135 135 | 
             
                  end
         | 
| 136 136 |  | 
| @@ -19,38 +19,42 @@ module DTK::Client | |
| 19 19 | 
             
              class Operation::Module
         | 
| 20 20 | 
             
                class InstallFromCatalog < self
         | 
| 21 21 | 
             
                  attr_reader :version, :module_ref, :target_repo_dir
         | 
| 22 | 
            -
                  def initialize(catalog, module_ref, directory_path, version)
         | 
| 23 | 
            -
                    @catalog | 
| 24 | 
            -
                    @module_ref | 
| 25 | 
            -
                    @directory_path | 
| 26 | 
            -
                    @target_repo_dir | 
| 27 | 
            -
                    @version | 
| 22 | 
            +
                  def initialize(catalog, module_ref, directory_path, version, remote_module_info)
         | 
| 23 | 
            +
                    @catalog            = catalog
         | 
| 24 | 
            +
                    @module_ref         = module_ref
         | 
| 25 | 
            +
                    @directory_path     = directory_path
         | 
| 26 | 
            +
                    @target_repo_dir    = ClientModuleDir.create_module_dir_from_path(directory_path || OsUtil.current_dir)
         | 
| 27 | 
            +
                    @version            = version # if nil wil be dynamically updated along with version attribute of @module_ref
         | 
| 28 | 
            +
                    @remote_module_info = remote_module_info
         | 
| 28 29 | 
             
                  end
         | 
| 29 30 | 
             
                  private :initialize
         | 
| 30 31 |  | 
| 31 32 | 
             
                  def self.execute(args = Args.new)
         | 
| 32 33 | 
             
                    wrap_operation(args) do |args|
         | 
| 33 | 
            -
                      module_ref | 
| 34 | 
            -
                      version | 
| 35 | 
            -
                      directory_path | 
| 34 | 
            +
                      module_ref         = args.required(:module_ref)
         | 
| 35 | 
            +
                      version            = args[:version]
         | 
| 36 | 
            +
                      directory_path     = args[:directory_path]
         | 
| 37 | 
            +
                      remote_module_info = args[:remote_module_info]
         | 
| 36 38 |  | 
| 37 39 | 
             
                      # will create different classes for different catalog types when we add support for them
         | 
| 38 | 
            -
                      new('dtkn', module_ref, directory_path, version).install_from_catalog
         | 
| 40 | 
            +
                      new('dtkn', module_ref, directory_path, version, remote_module_info).install_from_catalog
         | 
| 39 41 | 
             
                    end
         | 
| 40 42 | 
             
                  end
         | 
| 41 43 |  | 
| 42 44 | 
             
                  def install_from_catalog
         | 
| 43 | 
            -
                     | 
| 44 | 
            -
                       | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 45 | 
            +
                    unless @remote_module_info
         | 
| 46 | 
            +
                      query_string_hash = QueryStringHash.new(
         | 
| 47 | 
            +
                        :module_name => @module_ref.module_name,
         | 
| 48 | 
            +
                        :namespace   => @module_ref.namespace,
         | 
| 49 | 
            +
                        :rsa_pub_key => SSHUtil.rsa_pub_key_content,
         | 
| 50 | 
            +
                        :version?    => @version
         | 
| 51 | 
            +
                      )
         | 
| 49 52 |  | 
| 50 | 
            -
             | 
| 53 | 
            +
                      @remote_module_info = rest_get "#{BaseRoute}/remote_module_info", query_string_hash
         | 
| 54 | 
            +
                    end
         | 
| 51 55 |  | 
| 52 56 | 
             
                    unless @version
         | 
| 53 | 
            -
                      @version = remote_module_info.required(:version)
         | 
| 57 | 
            +
                      @version = @remote_module_info.required(:version)
         | 
| 54 58 | 
             
                      @module_ref.version = @version
         | 
| 55 59 | 
             
                    end
         | 
| 56 60 |  | 
| @@ -60,7 +64,7 @@ module DTK::Client | |
| 60 64 |  | 
| 61 65 | 
             
                    create_repo_opts = { :repo_dir => @target_repo_dir, :commit_msg => "DTK client initialize" }
         | 
| 62 66 | 
             
                    Operation::ClientModuleDir::GitRepo.create_repo_with_empty_commit(create_repo_opts)
         | 
| 63 | 
            -
                    LoadSource.fetch_transform_and_merge(remote_module_info, self)
         | 
| 67 | 
            +
                    LoadSource.fetch_transform_and_merge(@remote_module_info, self)
         | 
| 64 68 |  | 
| 65 69 | 
             
                    {:target_repo_dir => @target_repo_dir}
         | 
| 66 70 | 
             
                  end
         | 
| @@ -45,6 +45,7 @@ module DTK::Client | |
| 45 45 | 
             
                      force               = args[:force]
         | 
| 46 46 | 
             
                      update_deps         = args[:update_deps]
         | 
| 47 47 | 
             
                      do_not_print        = args[:do_not_print]
         | 
| 48 | 
            +
                      allow_version       = args[:allow_version]
         | 
| 48 49 |  | 
| 49 50 | 
             
                      case update_deps
         | 
| 50 51 | 
             
                      when "prompt"
         | 
| @@ -59,7 +60,8 @@ module DTK::Client | |
| 59 60 | 
             
                        file_obj = base_dsl_file_obj.raise_error_if_no_content
         | 
| 60 61 | 
             
                      end
         | 
| 61 62 |  | 
| 62 | 
            -
                      new('dtkn', module_ref, directory_path, version, file_obj).pull_dtkn(:update_deps => update_deps, | 
| 63 | 
            +
                      new('dtkn', module_ref, directory_path, version, file_obj).pull_dtkn(:update_deps => update_deps,
         | 
| 64 | 
            +
                      :no_update_deps => no_update_deps, :force => force, :do_not_print => do_not_print, :allow_version => allow_version)
         | 
| 63 65 | 
             
                    end
         | 
| 64 66 | 
             
                  end
         | 
| 65 67 |  | 
| @@ -70,7 +72,8 @@ module DTK::Client | |
| 70 72 | 
             
                    end
         | 
| 71 73 |  | 
| 72 74 | 
             
                    if ref_version = @version || module_ref.version
         | 
| 73 | 
            -
                       | 
| 75 | 
            +
                      do_not_raise = opts[:allow_version] || ref_version.eql?('master')
         | 
| 76 | 
            +
                      raise Error::Usage, "You are not allowed to pull module version '#{ref_version}'!" unless do_not_raise
         | 
| 74 77 | 
             
                    end
         | 
| 75 78 |  | 
| 76 79 | 
             
                    error_msg = "To allow pull-dtkn to go through, invoke 'dtk push' to push the changes to server before invoking pull-dtkn again"
         | 
| @@ -20,8 +20,9 @@ module DTK::Client | |
| 20 20 | 
             
                class Push < self
         | 
| 21 21 | 
             
                  def self.execute(args = Args.new)
         | 
| 22 22 | 
             
                    wrap_operation(args) do |args|
         | 
| 23 | 
            -
                      module_ref | 
| 24 | 
            -
                      method | 
| 23 | 
            +
                      module_ref    = args.required(:module_ref)
         | 
| 24 | 
            +
                      method        = args[:method] || "pushed"
         | 
| 25 | 
            +
                      allow_version = args[:allow_version]
         | 
| 25 26 |  | 
| 26 27 | 
             
                      unless client_dir_path = module_ref.client_dir_path
         | 
| 27 28 | 
             
                        raise Error, "Not implemented yet; need to make sure module_ref.client_dir_path is set when client_dir_path given"
         | 
| @@ -31,6 +32,11 @@ module DTK::Client | |
| 31 32 | 
             
                        raise Error::Usage, "DTK module '#{module_ref.print_form}' does not exist."
         | 
| 32 33 | 
             
                      end
         | 
| 33 34 |  | 
| 35 | 
            +
                      if ref_version = module_ref.version
         | 
| 36 | 
            +
                        do_not_raise = allow_version || ref_version.eql?('master')
         | 
| 37 | 
            +
                        raise Error::Usage, "You are not allowed to push module version '#{ref_version}'!" unless do_not_raise
         | 
| 38 | 
            +
                      end
         | 
| 39 | 
            +
             | 
| 34 40 | 
             
                      branch    = module_info.required(:branch, :name)
         | 
| 35 41 | 
             
                      repo_url  = module_info.required(:repo, :url)
         | 
| 36 42 | 
             
                      repo_name = module_info.required(:repo, :name)
         | 
| @@ -26,7 +26,7 @@ module DTK::Client | |
| 26 26 | 
             
                    @module_ref        = module_ref
         | 
| 27 27 | 
             
                    @directory_path    = directory_path
         | 
| 28 28 | 
             
                    @target_repo_dir   = directory_path || base_dsl_file_obj.parent_dir
         | 
| 29 | 
            -
                    @version           = version || 'master'
         | 
| 29 | 
            +
                    @version           = version || module_ref.version || 'master'
         | 
| 30 30 | 
             
                    @base_dsl_file_obj = base_dsl_file_obj
         | 
| 31 31 |  | 
| 32 32 | 
             
                    @module_ref.version ||= @version
         | 
| @@ -24,6 +24,7 @@ module DTK::Client | |
| 24 24 | 
             
                      action           = args.required(:action)
         | 
| 25 25 | 
             
                      action_params    = args[:action_params]
         | 
| 26 26 | 
             
                      directory_path   = args[:directory_path]
         | 
| 27 | 
            +
                      breakpoint       = args[:breakpoint]
         | 
| 27 28 |  | 
| 28 29 | 
             
                      # parse params and return format { 'p_name1' => 'p_value1' , 'p_name2' => 'p_value2' }
         | 
| 29 30 | 
             
                      task_params = parse_params?(action_params)||{}
         | 
| @@ -32,7 +33,7 @@ module DTK::Client | |
| 32 33 | 
             
                      # will transform ec2::node[node_name]/action to node_name/action
         | 
| 33 34 | 
             
                      action_node, action_name = (action||"").split('/')
         | 
| 34 35 | 
             
                      if action_node && action_name
         | 
| 35 | 
            -
                        if action_node_match = action_node.match(/^ec2::node\[(.*)\]/)
         | 
| 36 | 
            +
                        if action_node_match = action_node.match(/^ec2::node\[(.*)\]/) || action_node.match(/^ec2::node_group\[(.*)\]/)
         | 
| 36 37 | 
             
                          matched_node = $1
         | 
| 37 38 | 
             
                          action = "#{matched_node}/#{action_name}"
         | 
| 38 39 | 
             
                        end
         | 
| @@ -50,6 +51,7 @@ module DTK::Client | |
| 50 51 | 
             
                      post_body = PostBody.new(
         | 
| 51 52 | 
             
                        :task_params? => task_params
         | 
| 52 53 | 
             
                      )
         | 
| 54 | 
            +
                      post_body.merge!(:breakpoint => breakpoint) if breakpoint
         | 
| 53 55 | 
             
                      encoded_action =  URI.encode_www_form_component("#{action}")
         | 
| 54 56 | 
             
                      response = rest_post("#{BaseRoute}/#{service_instance}/#{encoded_action}", post_body)
         | 
| 55 57 |  | 
| @@ -22,17 +22,17 @@ module DTK::Client | |
| 22 22 | 
             
                    wrap_operation(args) do |args|
         | 
| 23 23 | 
             
                      service_instance = args.required(:service_instance)
         | 
| 24 24 | 
             
                      links            = args[:links]
         | 
| 25 | 
            -
                      node             = args[:node]
         | 
| 26 | 
            -
                      component        = args[:component]
         | 
| 25 | 
            +
                      # node             = args[:node]
         | 
| 26 | 
            +
                      # component        = args[:component]
         | 
| 27 27 | 
             
                      all              = args[:all]
         | 
| 28 28 | 
             
                      format           = args[:format] || 'table'
         | 
| 29 29 | 
             
                      format.downcase!
         | 
| 30 30 |  | 
| 31 31 | 
             
                      query_string_hash = QueryStringHash.new(
         | 
| 32 32 | 
             
                        :links?            => links,
         | 
| 33 | 
            -
                        :node_id?          => node,
         | 
| 33 | 
            +
                        # :node_id?          => node,
         | 
| 34 34 | 
             
                        :all               => all,
         | 
| 35 | 
            -
                        :filter_component? => component,
         | 
| 35 | 
            +
                        # :filter_component? => component,
         | 
| 36 36 | 
             
                        :format            => format
         | 
| 37 37 | 
             
                      )
         | 
| 38 38 |  | 
| @@ -22,7 +22,6 @@ module DTK::Client | |
| 22 22 | 
             
                    wrap_operation(args) do |args|
         | 
| 23 23 | 
             
                      service_instance = args.required(:service_instance)
         | 
| 24 24 | 
             
                      recursive        = args.required(:recursive)
         | 
| 25 | 
            -
                      delete           = args.required(:delete)
         | 
| 26 25 | 
             
                      force            = args.required(:force)
         | 
| 27 26 | 
             
                      path             = args[:directory_path]
         | 
| 28 27 | 
             
                      node             = []
         | 
| @@ -39,20 +38,15 @@ module DTK::Client | |
| 39 38 | 
             
                      post_body = PostBody.new(
         | 
| 40 39 | 
             
                        :service_instance => service_instance,
         | 
| 41 40 | 
             
                        :recursive?  => recursive,
         | 
| 42 | 
            -
                        :delete      =>  | 
| 41 | 
            +
                        :delete      => true,
         | 
| 43 42 | 
             
                        :force       => force
         | 
| 44 43 | 
             
                      )
         | 
| 45 44 | 
             
                      response = rest_post("#{BaseRoute}/uninstall", post_body)
         | 
| 46 45 |  | 
| 47 46 | 
             
                      ClientModuleDir.rm_f(path) if args[:purge]
         | 
| 48 47 |  | 
| 49 | 
            -
                      if  | 
| 50 | 
            -
                         | 
| 51 | 
            -
                          OsUtil.print_info(message)
         | 
| 52 | 
            -
                        end
         | 
| 53 | 
            -
                      else
         | 
| 54 | 
            -
                        msg = "DTK service '#{service_instance}' has been uninstalled successfully."
         | 
| 55 | 
            -
                        OsUtil.print_info(msg)
         | 
| 48 | 
            +
                      if message = response.data(:message) || "DTK service '#{service_instance}' has been uninstalled successfully."
         | 
| 49 | 
            +
                        OsUtil.print_info(message)
         | 
| 56 50 | 
             
                      end
         | 
| 57 51 | 
             
                    end
         | 
| 58 52 | 
             
                  end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: dtk-client
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.11. | 
| 4 | 
            +
              version: 0.11.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Reactor8
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017- | 
| 11 | 
            +
            date: 2017-10-05 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: dtk-common-core
         |