Coder Social home page Coder Social logo

nexus_cli's Introduction

Nexus CLI

Build Status

A CLI wrapper around Sonatype Nexus REST calls.

Requirements

  • Ruby

Installation

  1. Install the Gem - gem install nexus_cli
  2. Create a file in your user's home directory named .nexus_cli
  3. Give the file the following information:
url: 			"http://my-nexus-server/nexus/"
repository:		"my-repository-id"
username: 		"username"
password: 		"password"

You can also omit the username and password to create an anonymous session with the Nexus server. Keep in mind that an anonymous session may have different permissions than an authenticated one, depending on your Nexus server configuration.

Usage

There are a few calls that can be made. The most important are push_artifact and pull_artifact. Both calls will push or pull artifacts from Nexus using the Maven Co-ordinates syntax: groupId:artifactId:version (default extension is jar) or groupId:artifactId:extension:version or groupId:artifactId:extension:classifier:version

One can also search for artifacts and get back raw xml containing matches.

Listing of Available Commands

nexus-cli add_to_group_repository group_id repository_to_add_id                # Adds a repository with the given id into the group repository.
nexus-cli add_trusted_key --certificate=CERTIFICATE --description=DESCRIPTION  # Adds a new trusted key to the Smart Proxy configuration.
nexus-cli change_password user_id                                              # Changes the given user's passwords to a new one.
nexus-cli clear_artifact_custom_info coordinates                               # Clears the artifact custom metadata.
nexus-cli create_group_repository name                                         # Creates a new repository group with the given name.
nexus-cli create_repository name                                               # Creates a new Repository with the provided name.
nexus-cli create_user                                                          # Creates a new user
nexus-cli delete_group_repository group_id                                     # Deletes a group repository based on the given id.
nexus-cli delete_repository name                                               # Deletes a Repository with the provided name.
nexus-cli delete_trusted_key key_id                                            # Deletes a trusted key using the given key_id.
nexus-cli delete_user user_id                                                  # Deletes the user with the given id.
nexus-cli disable_artifact_publish repository_id                               # Sets a repository to disable the publishing of updates about its artifacts.
nexus-cli disable_artifact_subscribe repository_id                             # Sets a repository to stop subscribing to updates about artifacts.
nexus-cli disable_smart_proxy                                                  # Disables Smart Proxy on the server.
nexus-cli enable_artifact_publish repository_id                                # Sets a repository to enable the publishing of updates about its artifacts.
nexus-cli enable_artifact_subscribe repository_id                              # Sets a repository to subscribe to updates about artifacts.
nexus-cli enable_smart_proxy                                                   # Enables Smart Proxy on the server.
nexus-cli get_artifact_custom_info coordinates                                 # Gets and returns the custom metadata in XML format about a particular artifact.
nexus-cli get_artifact_info coordinates                                        # Gets and returns the metadata in XML format about a particular artifact.
nexus-cli get_global_settings                                                  # Prints out your Nexus' current setttings and saves them to a file.
nexus-cli get_group_repository group_id                                        # Gets information about the given group repository.
nexus-cli get_license_info                                                     # Returns the license information of the server.
nexus-cli get_logging_info                                                     # Gets the log4j Settings of the Nexus server.
nexus-cli get_nexus_configuration                                              # Prints out configuration from the .nexus_cli file that helps inform where artifacts will be uploaded.
nexus-cli get_nexus_status                                                     # Prints out information about the Nexus instance.
nexus-cli get_pub_sub repository_id                                            # Returns the publish/subscribe status of the given repository.
nexus-cli get_repository_info name                                             # Finds and returns information about the provided Repository.
nexus-cli get_smart_proxy_settings                                             # Returns the Smart Proxy settings of the server.
nexus-cli get_trusted_keys                                                     # Returns the trusted keys of the server.
nexus-cli get_users                                                            # Returns XML representing the users in Nexus.
nexus-cli help [COMMAND]                                                       # Describe available commands or one specific command
nexus-cli install_license license_file                                         # Installs a license file into the server.
nexus-cli pull_artifact coordinates                                            # Pulls an artifact from Nexus and places it on your machine.
nexus-cli push_artifact coordinates file                                       # Pushes an artifact from your machine onto the Nexus.
nexus-cli remove_from_group_repository group_id repository_to_remove_id        # Remove a repository with the given id from the group repository.
nexus-cli reset_global_settings                                                # Resets your Nexus global_settings to their out-of-the-box defaults.
nexus-cli search_artifacts_custom param1 param2 ...                            # Searches for artifacts using artifact metadata and returns the result as a list with items in XML format.
nexus-cli search_for_artifacts                                                 # Searches for all the versions of a particular artifact and prints it to the screen.
nexus-cli set_logger_level level                                               # Updates the log4j logging level to a new value.
nexus-cli transfer_artifact coordinates from_repository to_repository          # Transfers a given artifact from one repository to another.
nexus-cli update_artifact_custom_info coordinates param1 param2 ...            # Updates the artifact custom metadata with the given key-value pairs.
nexus-cli update_user user_id                                                  # Updates a user's details. Leave fields blank for them to remain their current values.
nexus-cli upload_global_settings                                               # Uploads a global_settings.json file to your Nexus to update its settings.

Each command can be prefaced with help to get more information about the command. For example - nexus-cli help get_users

There are also two global config options, --overrides which overrides the configruation in ~/.nexus_cli and --ssl-verify false which turns off SSL verification.

Pull Artifact Example

nexus-cli pull_artifact com.mycompany.artifacts:myartifact:tgz:1.0.0

Push Artifact Example

nexus-cli push_artifact com.mycompany.artifacts:myartifact:tgz:1.0.0 ~/path/to/file/to/push/myartifact.tgz

Search Example

nexus-cli search_for_artifacts com.mycompany.artifacts:myartifact

or more generic if you wish:

nexus-cli search_for_artifacts com.mycompany.artifacts

License and Author

Author:: Kyle Allan ([email protected])

Copyright:: 2013 Riot Games Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

nexus_cli's People

Contributors

brugidou avatar capoferro avatar crackmac avatar geardley avatar ivey avatar kallan357 avatar nuevoalex avatar pyro2927 avatar reset avatar rteabeault avatar shinjik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nexus_cli's Issues

overrides flags don't work on mac

Setting url and repository flags in --overrides produces this error message (~/.nexus_cli) does have correct credentials.

Your request was denied by the Nexus server due to a permissions error. You will need to administer the Nexus or use a different user/password in .nexus_cli.

Artifact search by custom metadata broke

The Nokogiri > REXML refactor of artifact search by custom metadata broke the feature.

custom_metadata_actions.rb#170

  • The function should return the artifacts array. It currently returns the REXML::Elements object.
  • The function should return String values and not REXML::Element objects. The array intersection function doesn't work with the REXML::Element objects.

Changing matched_artifact.text to matched_artifact.to_s and adding a return artifacts to the end of the function should do the trick.

Thanks!

Use custom_metadata endpoint for updating / adding custom tags

Use the POST endpoint of /index/custom_metadata/{repository}/{subject} to add custom tags to artifacts.

Subject is the base64 encoded version of the artifact data in "urn" format.

require "base64"
Base64.encode64("urn:maven/artifact#com.test:myprotest:1.0.0::tgz")

{ "data" : [ { "namespace" : "...", "key" : "...", "value" : "...", "readOnly" : false }, ... ] }

downcase breaks case sensitive repo requests

We use case sensitive repo names. The following code makes those somewhat problematic to use with this gem.

    attribute :repository,
      type: String,
      required: true,
      coerce: lambda { |m|
        m = m.is_a?(String) ? m.gsub(' ', '_').downcase : m
      }

and possibly:

    # Transforms a given [String] into a sanitized version by
    # replacing spaces with underscores and downcasing.
    # 
    # @param  unsanitized_string [String] the String to sanitize
    # 
    # @return [String] the sanitized String
    def sanitize_for_id(unsanitized_string)
      unsanitized_string.gsub(" ", "_").downcase
    end

The result is requests that look like:

/nexus/service/local/artifact/maven/resolve?g=com.company.project.product&a=ArtifactName&e=jar&v=1.0.15&r=repo-name

which should look like:

/nexus/service/local/artifact/maven/resolve?g=com.company.project.product&a=ArtifactName&e=jar&v=1.0.15&r=Repo-Name

Rate limit uploads

Is it possible to rate limit uploads? My upload on my connection cannot handle being maxed out. It causes other applications to disconnect.

overrides example

What's the correct way to use the --overrides option?

For example: The following works inside the .nexus_cli

url: "http://localhost:8081/nexus/"
username: "admin"
password: "admin123"

However none of the following examples work from the command line

nexus-cli get_users --overrides="username"=>"admin","url"=>"http://localhost:8081/nexus/","password"=>"admin123"

nexus-cli get_users --overrides="username"=>"admin","url"=>"http://localhost:8081/nexus/","password"=>"admin123"

nexus-cli get_users --overrides={"username"=>"admin","url"=>"http://localhost:8081/nexus/","password"=>"admin123"}

nexus-cli get_users --overrides={"username":"admin","url":"http://localhost:8081/nexus/","password":"admin123"}

nexus-cli get_users --overrides="username":"admin" --overrides="url":"http://localhost:8081/nexus/" --overrides="password":"admin123"

nexus-cli get_users --overrides="username"=>"admin" --overrides="url"=>"http://localhost:8081/nexus/" --overrides="password"=>"admin123"

The closest commands are:

nexus-cli get_users --overrides="username":"admin" --overrides="url":"http://localhost:8081/nexus/"
The server responded with a 401 status code which is unexpected. Please submit a bug.

and

nexus-cli get_users --overrides="username":"admin","url":"http://localhost:8081/nexus/"
/var/lib/gems/1.9.1/gems/nexus_cli-4.1.0/lib/nexus_cli/connection.rb:20:in join': can't convert nil into String (TypeError) from /var/lib/gems/1.9.1/gems/nexus_cli-4.1.0/lib/nexus_cli/connection.rb:20:innexus_url'
from /var/lib/gems/1.9.1/gems/nexus_cli-4.1.0/lib/nexus_cli/connection.rb:28:in status' from /var/lib/gems/1.9.1/gems/nexus_cli-4.1.0/lib/nexus_cli/remote_factory.rb:26:inrunning_nexus_pro?'
from /var/lib/gems/1.9.1/gems/nexus_cli-4.1.0/lib/nexus_cli/remote_factory.rb:20:in create' from /var/lib/gems/1.9.1/gems/nexus_cli-4.1.0/lib/nexus_cli/tasks.rb:445:innexus_remote'
from /var/lib/gems/1.9.1/gems/nexus_cli-4.1.0/lib/nexus_cli/tasks.rb:160:in get_users' from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:27:inrun'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in invoke_command' from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor.rb:359:indispatch'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/base.rb:440:in start' from /var/lib/gems/1.9.1/gems/nexus_cli-4.1.0/bin/nexus-cli:6:in<top (required)>'
from /usr/local/bin/nexus-cli:23:in load' from /usr/local/bin/nexus-cli:23:in

'

What is the correct way to pass in an override?

couldn't find HOME environment -- expanding `~'

I'm using nexus_cli with the RiotGames Nexus cookbook. When I run a chef-client run manually it completes without errors, but when it's run from the daemonized chef-client (on a rhel 6 system), the run fails when trying to retrieve the config because it has no $HOME set.

This happens looking up the DEFAULT config file at "~/.nexus_cli"

Would it be a good to have a fall back if there is no $HOME set?

Generated at 2013-06-20 13:52:02 -0500
ArgumentError: nexus_user[admin](nexus::default line 184) had an error: ArgumentError: couldn't find HOME environment -- expanding ~' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nexus_cli-3.0.0/lib/nexus_cli/configuration.rb:14:inexpand_path'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nexus_cli-3.0.0/lib/nexus_cli/configuration.rb:14:in path' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nexus_cli-3.0.0/lib/nexus_cli/configuration.rb:21:inparse'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nexus_cli-3.0.0/lib/nexus_cli/remote_factory.rb:11:in `create'

Output file name and path

Is it possible to specify the download path and artifact name for the snapshot you download ?

Example:

Current behavior:

jdyer@dyer:~/Dropbox/Projects/chef/tropo(master○) » nexus-cli pull_artifact com.voxeo.tropo:tropo-servlet:12.1-SNAPSHOT:war

Artifact has been retrived and can be found at path: /Users/jdyer/Dropbox/Projects/chef/tropo/tropo-servlet-12.1-20130314.090027-12.war

My ideal behavior:

jdyer@dyer:~/Dropbox/Projects/chef/tropo(master○) » nexus-cli pull_artifact com.voxeo.tropo:tropo-servlet:12.1-SNAPSHOT:war --path temp --name tropo-12.1-SNAPSHOT.war

Artifact has been retrived and can be found at path: /Users/jdyer/Dropbox/Projects/chef/tropo/temp/tropo-servlet-12.1-SNAPSHOT.war

Gem does not follow 302 responses

When the nexus server responses with a 302 request, the server does not follow the download link, it just downloads the HTML leaving you with a useless HTML page.

Add support for LDAP

Need to support configuring and getting information about the LDAP end points.

nexus-cli making extra anonymous request before sending credentialed request

Below you can see a usual nexus-cli behavior from a web-server log perspective.

Note the second request returns a 307 redirect, leading to the third request, which is sent without the configured credentials resulting in a 401 if anonymous access is disabled.

Expected behavior: Just go ahead and send the artifact request with basic authentication the first time. No need to wait for a "challenge"

When configured with credentials, I think we are assuming basic authentication in the case of maven repos.

10.10.10.10 - deployment [24/Mar/2014:23:06:02 +0000] "GET /nexus/service/local/artifact/maven/resolve?g=com.example&a=my-package&e=tgz&v=4.4.4&r=foo1 HTTP/1.1" 200 651 "-" "-"

10.10.10.10 - deployment [24/Mar/2014:23:06:03 +0000] "GET /nexus/service/local/artifact/maven/redirect?g=com.example&a=my-package&e=tgz&v=4.4.4&r=foo1 HTTP/1.1" 307 292 "-" "-"

10.10.10.10 - - [24/Mar/2014:23:06:03 +0000] "GET /nexus/service/local/repositories/foo1/content/com/example/my-package/4.4.4/my-package-4.4.4.tgz HTTP/1.1" 401 0 "-" "-"

10.10.10.10 - deployment [24/Mar/2014:23:06:03 +0000] "GET /nexus/service/local/repositories/foo1/content/com/example/my-package/4.4.4/my-package-4.4.4.tgz HTTP/1.1" 200 1757065 "-" "-"

Updating Maven metadata

Sorry if this is a dumb question but when I use nexus-cli to upload an artifact why is the maven metadata not updated?

nexus_cli finding artefacts but not pulling them

nexus-cli search_for_artifacts nl.kabisa.myapp:myapp:

<search-results>
  <totalCount>80</totalCount>
  <from>-1</from>
  <count>-1</count>
  <tooManyResults>false</tooManyResults>
  <data>
    <artifact>
      <resourceURI>**snip**</resourceURI>
      <groupId>nl.kabisa.myapp</groupId>
      <artifactId>myapp</artifactId>
      <version>1.2.4</version>
      <packaging>pom</packaging>
      <extension>tar.gz</extension>
      <repoId>releases</repoId>
      <contextId>Releases</contextId>
      <pomLink>**snip**</pomLink>
      <artifactLink></artifactLink>
    </artifact>

    # ...
  </data>
</search-results>

here's the path in Nexus:

/nl/kabisa/myapp/myapp/1.2.4/myapp-1.2.4.tar.gz

However, pulling it results in the same error all the time:

The artifact you requested information for could not be found. Please ensure it exists inside the Nexus.

nexus-cli pull_artifact nl.kabisa.myapp:myapp:1.2.4
nexus-cli pull_artifact nl.kabisa.myapp:myapp:1.2.4:tgz
nexus-cli pull_artifact nl.kabisa.myapp:myapp:1.2.4:gz
nexus-cli pull_artifact nl.kabisa.myapp:myapp:1.2.4:tar.gz
nexus-cli pull_artifact nl.kabisa.myapp:myapp:LATEST:tgz
nexus-cli pull_artifact nl.kabisa.myapp:myapp:latest:tgz

--ssl-verify seems not to work

I tried the pre-built executable in https://s3.eu-west-2.amazonaws.com/nexus-cli/1.0.0-beta/linux/nexus-cli but when trying the global option --ssl-verify false it does not worked. Seems that options has no effect on that release.

Then I tried to install it, but it has some kind of issue with dependencies.
Any help is very welcome.

$ sudo apt-get install -y ruby
...
$ sudo gem install nexus-cli
Fetching: thor-0.20.0.gem (100%)
Fetching: httpclient-2.8.3.gem (100%)
Fetching: extlib-0.9.16.gem (100%)
Fetching: json-2.1.0.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing nexus_cli:
ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require'
from extconf.rb:1:in `

'

Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-2.1.0 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-2.1.0/ext/json/ext/generator/gem_make.out

Rewrite to be a better API

This might be a large task, but we are missing a few key things:

  • adequate testing
  • a consistent style
  • some randomness between sending / receiving XML or JSON.

I was sorta thinking this might be an interesting place to do some metaprogramming (similar to Ridley) and maybe some experimentation with Celluloid (maybe we don't need to worry about concurrency, thought)

support lucene search

Often, we need to get_latest_version so we call get_artifact_info and we do get the latest version - chronologically. But, what if I want the latest version on a branch and another branch has a newer version. The result returns the latest, but not lexically. Is there currently a way to do that? I don't see one, but it looks like the lucene search can do this if one passes a branch.* wildcard like this:

hxxps://your.nexus.here/nexus/service/local/lucene/search?g=com.mycompany&a=myartifact&repositoryId=releases&v=4.6.*

I think, to support this, I can just add a new artifact_task method like this ?

def search_artifacts_lucene(coordinates)
  artifact = Artifact.new(coordinates)

  query = {:g => artifact.group_id, :a => artifact.artifact_id, :e => artifact.extension, :v => artifact.version,
           :r => configuration['repository']}
  query.merge!({:c => artifact.classifier}) unless artifact.classifier.nil?
  response = nexus.get(nexus_url("service/local/artifact/lucene/search"), query)
  puts response.inspect
  case response.status
    when 200
      return response.content
    else
      raise UnexpectedStatusCodeException.new(response.status)
  end
end

Thanks.

nexus-cli get_global_settings fails with ruby 1.8

$ nexus-cli get_global_settings
/usr/lib/ruby/gems/1.8/gems/jsonpath-0.5.3/lib/jsonpath/enumerable.rb:106: warning: regexp has invalid interval
/usr/lib/ruby/gems/1.8/gems/jsonpath-0.5.3/lib/jsonpath/enumerable.rb:106: warning: regexp has }' without escape /usr/lib/ruby/gems/1.8/gems/nexus_cli-3.0.0/lib/nexus_cli/mixins/global_settings_actions.rb:13:inget_global_settings': undefined method exists?' for Dir:Class (NoMethodError) from /usr/lib/ruby/gems/1.8/gems/nexus_cli-3.0.0/lib/nexus_cli/tasks.rb:104:inget_global_settings'
from /usr/lib/ruby/gems/1.8/gems/thor-0.18.1/lib/thor/command.rb:27:in __send__' from /usr/lib/ruby/gems/1.8/gems/thor-0.18.1/lib/thor/command.rb:27:inrun'
from /usr/lib/ruby/gems/1.8/gems/thor-0.18.1/lib/thor/invocation.rb:120:in invoke_command' from /usr/lib/ruby/gems/1.8/gems/thor-0.18.1/lib/thor.rb:363:indispatch'
from /usr/lib/ruby/gems/1.8/gems/thor-0.18.1/lib/thor/base.rb:439:in start' from /usr/lib/ruby/gems/1.8/gems/nexus_cli-3.0.0/bin/nexus-cli:6 from /usr/bin/nexus-cli:19:inload'
from /usr/bin/nexus-cli:19

$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

$ ls -la ~/.nexus
total 8
drwxrwxr-x 2 vagrant vagrant 4096 Jul 11 18:00 .
drwx------. 5 vagrant vagrant 4096 Jul 11 18:01 ..

Unable to upload RPM artifact using nexus cli

This is the error log


sudo /opt/ruby/bin/nexus-cli push_artifact devcloud:unrar:0.0.1:rpm unrar-4.0.7-1.el6.rf.x86_64.rpm --overrides url:<NEXUS_URL>:cfg-mgmt-chef-cookbook-archives-pre username:
/opt/ruby/lib/ruby/gems/2.2.0/gems/nexus_cli-4.2.0/lib/nexus_cli/configuration.rb:30: warning: found = in conditional, should be ==
/opt/ruby/lib/ruby/gems/2.2.0/gems/nexus_cli-4.2.0/lib/nexus_cli/configuration.rb:58: warning: found = in conditional, should be ==
/opt/ruby/lib/ruby/gems/2.2.0/gems/nexus_cli-4.2.0/lib/nexus_cli/configuration.rb:98: warning: mismatched indentations at 'end' with 'def' at 92
/opt/ruby/lib/ruby/gems/2.2.0/gems/nexus_cli-4.2.0/lib/nexus_cli/configuration.rb:94: warning: assigned but unused variable - config
/opt/ruby/lib/ruby/gems/2.2.0/gems/nexus_cli-4.2.0/lib/nexus_cli/configuration.rb:99: warning: mismatched indentations at 'end' with 'class' at 8
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/blank.rb:12: warning: method redefined; discarding old blank?
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/object/blank.rb:15: warning: previous definition of blank? was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/blank.rb:28: warning: method redefined; discarding old blank?
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/object/blank.rb:118: warning: previous definition of blank? was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/blank.rb:42: warning: method redefined; discarding old blank?
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/object/blank.rb:48: warning: previous definition of blank? was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/blank.rb:56: warning: method redefined; discarding old blank?
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/object/blank.rb:68: warning: previous definition of blank? was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/blank.rb:70: warning: method redefined; discarding old blank?
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/object/blank.rb:58: warning: previous definition of blank? was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/blank.rb:86: warning: method redefined; discarding old blank?
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/object/blank.rb:102: warning: previous definition of blank? was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/object.rb:138: warning: method redefined; discarding old try_dup
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/try_dup.rb:5: warning: previous definition of try_dup was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/object.rb:163: warning: method redefined; discarding old in?
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/object/inclusion.rb:13: warning: previous definition of in? was here
/opt/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54: warning: loading in progress, circular require considered harmful - /opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/mash.rb
from /opt/ruby/bin/nexus-cli:23:in <main>' from /opt/ruby/bin/nexus-cli:23:inload'
from /opt/ruby/lib/ruby/gems/2.2.0/gems/nexus_cli-4.2.0/bin/nexus-cli:8:in <top (required)>' from /root/.gem/ruby/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:instart'
from /root/.gem/ruby/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in dispatch' from /root/.gem/ruby/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:ininvoke_command'
from /root/.gem/ruby/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in run' from /opt/ruby/lib/ruby/gems/2.2.0/gems/nexus_cli-4.2.0/lib/nexus_cli/tasks.rb:43:inpush_artifact'
from /opt/ruby/lib/ruby/gems/2.2.0/gems/nexus_cli-4.2.0/lib/nexus_cli/tasks.rb:497:in nexus_remote' from /opt/ruby/lib/ruby/gems/2.2.0/gems/nexus_cli-4.2.0/lib/nexus_cli/remote_factory.rb:18:increate'
from /opt/ruby/lib/ruby/gems/2.2.0/gems/nexus_cli-4.2.0/lib/nexus_cli/configuration.rb:1:in <top (required)>' from /opt/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire'
from /opt/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require' from /opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib.rb:8:in<top (required)>'
from /opt/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require' from /opt/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire'
from /opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/array.rb:1:in <top (required)>' from /opt/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire'
from /opt/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require' from /opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/mash.rb:1:in<top (required)>'
from /opt/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require' from /opt/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire'
from /opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/hash.rb:6:in <top (required)>' from /opt/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire'
from /opt/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/hash.rb:84: warning: method redefined; discarding old from_xml
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/hash/conversions.rb:97: warning: previous definition of from_xml was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/hash.rb:184: warning: method redefined; discarding old except
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/hash/except.rb:14: warning: previous definition of except was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/symbol.rb:3: warning: method redefined; discarding old try_dup
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/try_dup.rb:41: warning: previous definition of try_dup was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/boolean.rb:2: warning: method redefined; discarding old try_dup
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/try_dup.rb:11: warning: previous definition of try_dup was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/boolean.rb:8: warning: method redefined; discarding old try_dup
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/try_dup.rb:17: warning: previous definition of try_dup was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/inflection.rb:437: warning: method redefined; discarding old singularize
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/string/inflections.rb:41: warning: previous definition of singularize was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/inflection.rb:441: warning: method redefined; discarding old pluralize
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/string/inflections.rb:25: warning: previous definition of pluralize was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/module.rb:14: warning: method redefined; discarding old try_dup
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/try_dup.rb:23: warning: previous definition of try_dup was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/nil.rb:2: warning: method redefined; discarding old try_dup
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/try_dup.rb:29: warning: previous definition of try_dup was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/numeric.rb:2: warning: method redefined; discarding old try_dup
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/try_dup.rb:35: warning: previous definition of try_dup was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/chozo-0.6.1/lib/chozo/core_ext/hash/keys.rb:34: warning: method redefined; discarding old stringify_keys
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/hash/keys.rb:6: warning: previous definition of stringify_keys was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/chozo-0.6.1/lib/chozo/core_ext/hash/keys.rb:40: warning: method redefined; discarding old stringify_keys!
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/hash/keys.rb:12: warning: previous definition of stringify_keys! was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/chozo-0.6.1/lib/chozo/core_ext/hash/keys.rb:70: warning: method redefined; discarding old assert_valid_keys
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/hash/keys.rb:48: warning: previous definition of assert_valid_keys was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/chozo-0.6.1/lib/chozo/hashie_ext/hash.rb:5: warning: method redefined; discarding old to_hash
/opt/ruby/lib/ruby/gems/2.2.0/gems/hashie-3.4.3/lib/hashie/hash.rb:18: warning: previous definition of to_hash was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/class/attribute_accessors.rb:32: warning: method redefined; discarding old cattr_reader
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/class.rb:40: warning: previous definition of cattr_reader was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/class/attribute_accessors.rb:92: warning: method redefined; discarding old cattr_writer
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/class.rb:66: warning: previous definition of cattr_writer was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/class/attribute_accessors.rb:164: warning: method redefined; discarding old cattr_accessor
/opt/ruby/lib/ruby/gems/2.2.0/gems/extlib-0.9.16/lib/extlib/class.rb:96: warning: previous definition of cattr_accessor was here
/opt/ruby/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.1/lib/active_support/core_ext/load_error.rb:9: warning: method redefined; discarding old path
/opt/ruby/lib/ruby/gems/2.2.0/gems/chozo-0.6.1/lib/chozo/varia_model.rb:71: warning: assigned but unused variable - errors
Please enter a password:
/opt/ruby/lib/ruby/gems/2.2.0/gems/nexus_cli-4.2.0/lib/nexus_cli/mixins/artifact_actions.rb:30: warning: assigned but unused variable - artifact_file
/opt/ruby/lib/ruby/gems/2.2.0/gems/nexus_cli-4.2.0/lib/nexus_cli/mixins/global_settings_actions.rb:15: warning: assigned but unused variable - artifact_file
/opt/ruby/lib/ruby/gems/2.2.0/gems/nexus_cli-4.2.0/lib/nexus_cli/mixins/role_actions.rb:106: warning: mismatched indentations at 'end' with 'module' at 4
The server responded with a 500 status code which is unexpected. Please submit a bug.

'require' depends on files in github

When I was working on separating some of the n3 metadata logic from the nexus_pro_remote.rb file, I was running into require LoadErrors. After looking through the gemspec file, it seemed like I needed to add my new ruby file to github first before I could require it. The reason I am uncomfortable doing this is that I didn't want to commit code I did not test yet. Perhaps this is just a learning experience for a Ruby noob but it was unintuitive to me.

gemspec

  s.files         = `git ls-files`.split("\n")
...
  s.require_paths = ["lib"]

Provide support to reset HTTPClient's CA store path to the system defaults

I'm having trouble verifying my nexus server cert using the default HTTPClient CA certs (bundled with HTTPClient), however using the default system CA store it works just fine:

nahi/httpclient#89

I suspect the bundle does not include on of the more recent (2009) root certs, the root cert for my certificate is:

Subject: C=US, ST=Arizona, L=Scottsdale, O=GoDaddy.com, Inc., CN=Go Daddy Root Certificate Authority - G2

which is a newer SHA2 certificate. This would be preferable to setting ssl_verify = false which is what I currently have to do.

Thanks!

ps. filing an issue with HTTPClient too to update their bundled certs if needed

Extlib gem breaks further usage of Arrays, passed as splat argument to the method with keyword arguments in Ruby 2.3

I am using Chef nexus cookbook, which manages Nexus configuration and is using nexus-cli gem under the curtains.Everything works well on Chef 11 with Ruby 1.9.3

However when running cookbook and gem on Chef 12 with Ruby 2.3, the previously working functionality gets broken due to incorrect Array argument expand when it is passed to the method via splat ( *) parameter.

The problem is coming from the fact, that extlib gem usage adds to_hash method to the Array class here, which results in incorrect keyword argument expand on Ruby 2.3 - more info about keyword arguments

Here is an example from PRY:

[1] pry(main)> def test_method(*args, **opts) puts "Args are: #{args}"; puts "Opts are: #{opts}" end
=> :test_method
[2] pry(main)> test_method('key',['value'])
Args are: ["key", ["value"]]
Opts are: {}
=> nil
[3] pry(main)> require 'extlib'
=> true
[4] pry(main)> test_method('key',['value'])
Args are: ["key", {"value"=>nil}]
Opts are: {}
=> nil

As such, this behavior breaks functionality of Chef, for example, for group management operations which is calling shell_out_compact! method:

# call method, which is using keyword arguments:
def manage_group
  shell_out_compact!("groupmod", set_options)
  modify_group_members
end

# definitions of the shell_out method
def shell_out_compact!(*args, **options)
  if options.empty?
    shell_out!(*clean_array(*args))
  else
    shell_out!(*clean_array(*args), **options)
  end
end

So question here - is the usage of 'extlib' gem still required for nexus_cli when running it on Ruby 2.3. Can nexus_cli gem be refactored not to use it at least for Ruby 2.3+

nexus-cli should be able to prompt for password , if not supplied through config or from override

In the current scenario we have 2 ways to authenticate to server , either it should be supplied in plain text through config file , or user supply it through overrides options. if we doesn't supply it either way it raise an exception.

In both of these cases we are passing the password in plain text , As per our requirement we need to address this security gap and would prompt the password and mask it so it can be passed through secure channel .

As a proposed solution I believe that we can include this password prompt change in Configuration Class file which would have a logic for both the cases , overrides as well as for the config file.
This would prevent supplying password in the plain text for authentication.

Also one more change that would be needed in remote_factory to supply the correct override for pro_remote and oss_remote , so updated overrides Hash needs to be supplied for password to prompt only once.

att_reader: overrides

@overrides = overrides.merge!(configuration)

Github

rest-client large file upload/download

There is an issue where rest-client throws a NoMemoryError when downloading or uploading large files.

I submitted a pull request to change the net:http response to use request.body_stream instead of request.body to handle larger input in the request body.

https://github.com/archiloque/rest-client/pull/136

For downloads, the response needs to be downloaded in chunks. I couldn't figure out how to patch this in rest-client but I implemented this with Net::HTTP in my pull request #33.

Nexus itself is case-sensitive in respect to REST calls that look for the "latest" version

If I pass any combination to Thor with a version of 'latest' it needs to get all-capped so Nexus can interpret it correctly.

nexus-cli info com.foo.test:server:latest:tgz
The artifact you requested information for could not be found. Please ensure it exists inside the Nexus.

nexus-cli info com.foo.test:server:LATEST:tgz
<artifact-resolution>...</artifact-resolution>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.