Commit graph

3659 commits

Author SHA1 Message Date
Joao Duarte
5e792b1de0 fix a few issues with proxy handling when installing plugins
* allow installing a plugin using proxy without having to use the `--no-verify` flag
* allow the use of proxies that have basic authentication
* add tests for proxy handling in plugin manager

Fixes #8435
2017-10-05 11:50:34 +00:00
Colin Surprenant
746c3d163b fixes for Windows platform tests/specs
use rm_rf to delete dir and shutdown pipeline after run

avoid the use of rescue nil, bad practice

do not mock close as it prevents closing the file an prevents removing it on Windows

cleanup temporary files and relax file name check for Windows

fix paths handling for Windows

flag the read file string as UTF-8 which is what we expect

fix Windows issues

ignore load_average on windows

windows safe URI

cleanup and fix file handling for windows

wait for pipeline shutdown to complete

revert to original puts

cleanups

use environment for windows platform check

fix hash path

wait for pipeline thread to complete after shutdown
2017-09-20 15:31:17 -04:00
Colin Surprenant
3759527f4d force UTF-8 encoding for gem file reading 2017-08-25 12:51:49 -04:00
Jake Landis
f539669e10 Revert "always use JARS_SKIP when installing or updating plugins"
This reverts commit 628207e96c.

Fixes #8070
2017-08-24 23:46:58 +00:00
Joao Duarte
628207e96c always use JARS_SKIP when installing or updating plugins
Fixes #8058
2017-08-24 08:23:55 +00:00
Christoph Wurm
beb371e79f Properly catch connection refused error when installing plugin.
Fixes #7447
2017-06-14 12:52:06 +00:00
Pier-Hugues Pellerin
1913966578 refactor extract into 2 methods
Fixes #7065
2017-05-11 12:54:44 +00:00
Pier-Hugues Pellerin
17c2f37b25 Check for empty string when configuring proxies
On some Linux system like debian, the `HTTP_PROXY` are set to an empty
string and was causing the plugin manager to raise an exception. We now
strip the string and check if it is empty before trying to configure the
proxies.

Fixes: #7045

Fixes #7065
2017-05-11 12:54:44 +00:00
Armin Braun
f407c98de5 bundler.rb fixes for @pr review
Fixes #6985
2017-05-02 13:23:35 +00:00
Armin Braun
22af03a26a Allow copying a release template for Gemfile.jruby-1.9.lock.release
Fixes #6985
2017-05-02 13:23:35 +00:00
Armin Braun
b72b167161 ignore .Gemfile.jruby-1.9.lock, .lock and Gemfile
Fixes #6985
2017-05-02 13:23:35 +00:00
Josh Soref
df57e410cc Spelling fixes (#6806)
Spelling fixes across the board.
2017-04-04 12:07:16 -07:00
Pier-Hugues Pellerin
058cfc9312 Allow Logstash to accept a PROXY configuration
Logstash's plugin manager will now follow proxy configuration from the environment.
If you configure `http_proxy` and `https_proxy`, the manager will now use theses information for all the ruby http
connection and will also pass that information down to maven.

Fixes: #6619, #6528

Fixes #6825
2017-03-31 14:20:39 -04:00
Pier-Hugues Pellerin
2e05338554 Make sure prepare_offline_pack command only accept a filename
This PR changes the behavior of the command when you were specify a directory
instead of a filename, if the directory exists it would have deleted the
directory and the files in it.

The new flow and validation is now safer, if you specify a directory
Logstash will tell you to specify a complete filename.

If the ZIP extension is missing, the command line will ask you to make
sure you target a right filename.

If the output file already exist it will *not* delete it but instead
will return a warning message, you can force a delete by using the
`--overwrite` option.

Fixes: #6862

Fixes #6861
2017-03-31 11:05:17 -04:00
Pier-Hugues Pellerin
7a3226e9f2 Do not try to reach the artifact server when no plugins is given
This PR fix an annoyance when running the `bin/logstash-plugin install
--no-verify` without any plugins, the command was making an unnecessary
call to the artifacts web server.

Fixes #6826
2017-03-26 20:44:07 -04:00
Tal Levy
1a02498e93 migrate core-queue-jruby into logstash-core (#6782)
Conflicts:
	logstash-core-queue-jruby/lib/logstash-core-queue-jruby/version.rb
	versions.yml
2017-03-02 10:13:31 -08:00
Tal Levy
7c75b59814 migrate logstash-core-event-java to logstash-core (#6760)
Conflicts:
	logstash-core-event-java/lib/logstash-core-event-java/version.rb
	versions.yml
2017-03-01 15:37:41 -08:00
Jordan Sissel
ae450f9b66 Open file in binary mode.
Fixes #6640
2017-02-06 00:03:00 -05:00
Pier-Hugues Pellerin
7615e5bb51 Ignore NIL/EMPTY values for LOGSTASH_PACK_URL environment variable
Fixes #6611
2017-02-02 09:15:42 -05:00
Pier-Hugues Pellerin
2e908a0663 Allow to run the bin/logstash-plugin install <pack> outside of the Logstash directory
Fixes: #6599

Fixes #6602
2017-01-31 13:15:41 -05:00
Pier-Hugues Pellerin
1b812af23c Add bin/logstash-plugin prepare-offline-pack command
This new command replace the old workflow of `pack`, `unpack` and the `install --local`, and wrap all the logic into one uniform way of installing plugins.
The work is based on the flow developed for installing an x-pack inside Logstash, when you call prepare-offline-pack, the specified plugins and their dependencies will be packaged in a zip.
And this zip can be installed with the same flow as the pack.

Definition:

Source Logstash: Where you run the prepare-offline-pack.
Target Logstash: Where you install the offline package.

PROS:
- If you install a .gem in the source logstash, the .gem and his dependencies will be bundled.
- The install flow doesn't need to have access to the internet.
- Nothing special need to be setup in the target logstash environment.

CONS:
- The is one minor drawback, the plugins need to have their JARS bundled with them for this flow to work, this is currently the case for all the official plugins.
- The source Logstash need to have access to the internet when you install plugins before packaging them.

Usage examples:
bin/logstash-plugin prepare-offline-pack logstash-input-beats
bin/logstash-plugin prepare-offline-pack logstash-filter-jdbc logstash-input-beats
bin/logstash-plugin prepare-offline-pack logstash-filter-*
bin/logstash-plugin prepare-offline-pack logstash-filter-* logstash-input-beats

How to install:
bin/logstash-plugin install file:///tmp/logstash-offline-plugins-XXXX.zip

Fixes #6404
2017-01-03 13:59:51 -05:00
Pier-Hugues Pellerin
c749d16bd4 Make it work with update too
Fixes #6410
2016-12-16 10:27:33 -05:00
Pier-Hugues Pellerin
14ff5f98a3 Turn off any jar-dependencies lookup when running install command with --local
Fixes: #6386

Fixes #6410
2016-12-16 10:27:33 -05:00
Pier-Hugues Pellerin
0b881c78a6 Explicitely require LogStash::Bundler.setup! make the plugin install process to require internet access
Fixes: #6386

Fixes #6388
2016-12-13 09:43:57 -05:00
Pier-Hugues Pellerin
f42807518f Do not clean unused gems after updating gems
The are a difference between the gems installed and the available spec
loaded in memory making bundler remove the gem that we have just
updated.

Fixes: #6339

Fixes #6340
2016-12-01 18:57:07 -05:00
Pier-Hugues Pellerin
fe8c438b24 Logstash-docgen tool v2
**Motivation**: We have decided to rewrite the documentation generator to add more features
to our documentation and to fix some outstanding bugs.

This PR addresses the following problem:
- Hard to add new features to the code base.
- The code was tied with Logstash.
- No easy way to publish the doc for a single plugin
- The plugin author was not able to test their documentation changes
- The reported errors were hard to understand.
- No easy way to automate it.
- the minimal requirement on base classes.

Fixes #5720
2016-11-30 19:57:40 -05:00
Pier-Hugues Pellerin
4f5f3490aa Relax the acceptance test expectation to match only the exception message
Fixes: #6310

Fixes #6325
2016-11-29 14:24:37 -05:00
Pier-Hugues Pellerin
00e225a849 Feature: A way to install/remove a plugin pack
A pack in this context is a *bundle* of plugins that can be distributed outside of rubygems; it is similar to what ES and kibana are doing, and
the user interface is modeled after them. See https://www.elastic.co/downloads/x-pack

**Do not mix it with the `bin/logstash-plugin pack/unpack` command.**

- it contains one or more plugins that need to be installed
- it is self-contains with the gems and the needed jars
- it is distributed as a zip file
- the file structure needs to follow some rules.

- As a reserved name name on elastic.co download http server
    - `bin/plugin install logstash-mypack` will check on the download server if a pack for the current specific logstash version exist and it will be downloaded, if it doesn't exist we fallback on rubygems.
    - The file on the server will follow this convention `logstash-mypack-{LOGSTASH_VERSION}.zip`

- As a fully qualified url
    - `bin/plugin install http://test.abc/logstash-mypack.zip`, if it exists it will be downloaded and installed if it does not we raise an error.

- As a local file
    - `bin/plugin install file:///tmp/logstash-mypack.zip`, if it exists it will be installed

Fixes #6168
2016-11-17 14:00:02 -05:00
Pier-Hugues Pellerin
ab89a90a4c This PR changes two things:
- Allow plugins author to decide how their plugins are structured
- Allow a new kind of plugin that allow plugins author to add hooks into logstash core.

Fixes #6109
2016-11-11 09:43:44 -05:00
Guillaume Le Floch
1a0fcfd211 remove duplicate list subcommand
When running `./logstash-plugin --help`, there was twice time the list sub command

Fixes #6205
2016-11-07 17:59:38 -05:00
Colin Surprenant
ab05082a89 merge feature/java_persistence into 5.x 2016-10-31 17:03:40 -04:00
Suyog Rao
9c5e558c5a Deprecate uninstall for Plugin Manager
Adds remove and deprecates uninstall

Fixes #6041

Fixes #6042
2016-10-13 10:12:23 -04:00
Pier-Hugues Pellerin
7abf285bfa Silence require_jar warning
Fixes #5836
2016-08-26 14:43:12 -04:00
Andrew Cholakian
f35c416893 Add new Codec#encode_sync, Codec#multi_encode and Output#multi_receive_encoded methods.
These methods allow outputs to receive their events pre-encoded for them
by the pipeline. This is mostly useful in the context of `#shared` outputs, for whom
encoding a discrete batch in a threadsafe way is not necessarily straightforward.

It would be advised for codecs to prefer `#multi_encode` as the main way of operating
as the standard `#encode` method is not threadsafe.

Fixes #5770
2016-08-22 14:08:04 -04:00
Suyog Rao
47545d6859 Remove use of map
Fixes #5740
2016-08-08 16:33:02 -04:00
Suyog Rao
53bd15e1f4 Fix warning when no local plugins are found
Fixes #5740
2016-08-08 16:33:02 -04:00
Suyog Rao
6437ce9931 Remove validate warning because its useless
Fixes #5686

Fixes #5729
2016-08-04 17:31:37 -04:00
Joao Duarte
fa0eeb579f add single command release task and other release support tooling
Purpose:

* manage releases through a minimum number of rake tasks
* simplify building of snapshot builds
* create staged artifacts, candidates for releases, that required no changes to become releases
* this means the snapshot release process will not involve publishing gems, therefore:
* the gem artifacts should only be published to rubygems as a final artifact, at the time of GA

Changes:

* release artifacts no longer depend on gems of core components
* all core components are used locally AS-IS to minimize code changes between snapshot, RC and GA
* `versions.yml` describes the versions of all logstash parts and package
  * `rake version:set[version]` manage the yaml file and push the changes to the gemspecs/version.rb files
  * `rake version:set_plugin_api[version]` manage the yaml file and push the changes to the gemspecs/version.rb files
  * `rake artifact:all` generates SNAPSHOT artifacts: tar.gz, zip, rpm, deb
  * `RELEASE=1 rake artifact:all` creates release candidate artifacts + 4 gems: logstash-core, logstash-core-event, logstash-core-event-java and logstash-core-plugin-api

implements #5416 and #5414

Fixes #5460
2016-06-21 12:29:18 +01:00
Pere Urbon-Bayes
76c901cceb wrap usage of Gems.versions withing a patch that forces UTF-8 encoding
locate the patch to his own location

rename patches directory

Fixes #5486
2016-06-15 06:45:44 -04:00
Pere Urbon-Bayes
d249bd1705 add codec as a new kind of templates in the plugin generator
Fixes #5421
2016-06-01 16:15:37 +00:00
Pere Urbon-Bayes
f5cc745be7 add more control on valid arguments for codecs in the generator command
Fixes #5419
2016-06-01 16:06:19 +00:00
Aaron Mildenstein
6c886845e6 Update packaging to use /usr/share/logstash
Update after-install scripts

Use /usr/lib/logstash instead of /opt/logstash

More revisions.

Using `/usr/share/logstash` instead of `/usr/lib/logstash`

Track these new files

More work in progress.

Proper arg parsing obtained

WIP: Use jvm.options like ES

Remove facter dependency

Due to an update from @jordansissel on pleaserun, facter is no longer necessary

Revert Gemfile to proper version

Latest work in progress.

I added a simple test to logstash.lib.sh to catch empty strings in java options.

Added `startup.options`, and touched up `jvm.options`

Edited the package scripts to make things play nice with new paths.

Tweaked `system-install` to allow users to provide their own `startup.options` file.

Patch up merge failure

Changes to work with the new logstash.yml

Add fpm dependency (build fails without it)

Fix missing gems in Gemfile

Don't know how these got lost

Use /etc/logstash for configuration in packages

Update the instructions/documentation for...

...startup.options

Merging proposed changes

Remove mustache and clamp

They're covered by pleaserun anyway

Prune config dir from /usr/share/logstash...

...but only when using RPM/DEB packages
2016-05-25 11:43:48 -06:00
Philippe Weber
be9bac9ec5 fix config_name for generated input plugin
Fixes #5355
2016-05-24 22:00:38 +00:00
Philippe Weber
4f96f235e2 use new event api in generator filter template
Fixes #5355
2016-05-24 22:00:38 +00:00
Philippe Weber
dafe75d89e display correct path of created files
Fixes #5355
2016-05-24 22:00:38 +00:00
Philippe Weber
e2b5c873e6 make plugin name parameter required
Fixes #5355
2016-05-24 22:00:38 +00:00
Philippe Weber
464bdcabb5 fix to allow direct execution of 'bundle install'
Fixes #5355
2016-05-24 22:00:38 +00:00
Pere Urbon-Bayes
6c92fa9f58 Add a new command that generate a plugin skeleton that can be used to create a new plugin
Fixes #4190
2016-05-24 16:14:46 +00:00
Joao Duarte
3a6b1dafaa introduce yaml settings file and cli long switches
* by default lives in LOGSTASH_HOME/config/logstash.yml
* location can be changed by $LS_SETTINGS_DIR or --path.settings
* overrides defaults of LogStash::Environment, BUT
* CLI flags override the yaml file
* several breaking changes to cli flag names (see config/logstash.yml)
* setting values are now type checked (see Setting and Settings classes)

Fixes #5313
2016-05-19 19:20:37 +01:00
Jordan Sissel
682194b0c2 Include ci/reporter so bin/rpsec works for me.
Fixes #4820
2016-05-09 19:53:18 +00:00