Commit Graph

148 Commits

Author SHA1 Message Date
Alexander Reelsen e8c1e7f9d8 Watcher: Dont hide exceptions during watch execution
When a painless exception is raised in the script condition, it was not bubbled up due to
catching exceptions on during execution. This removes the different catching of exceptions
and allows the watch record construct to contain an exception that is also serialized correctly
so that it can be stored in the watch history but also returned in the execute watch API.

This also updates the watch history template, so that exceptions are not indexed, but logged.

Relates elastic/elasticsearch#2587

Original commit: elastic/x-pack-elasticsearch@4dffb672bf
2016-07-05 09:33:44 +02:00
Jason Tedor 1cd53c41e2 Do not catch throwable
Today throughout the codebase, catch throwable is used with reckless
abandon. This is dangerous because the throwable could be a fatal
virtual machine error resulting from an internal error in the JVM, or an
out of memory error or a stack overflow error that leaves the virtual
machine in an unstable and unpredictable state. This commit removes
catch throwable from the codebase and removes the temptation to use it
by modifying listener APIs to receive instances of Exception instead of
the top-level Throwable.

Relates elastic/elasticsearch#2694

Original commit: elastic/x-pack-elasticsearch@7ecdd7d978
2016-07-04 08:41:08 -04:00
Tanguy Leroux 17684f1e76 Fix order of modifiers
Original commit: elastic/x-pack-elasticsearch@1f970e78ba
2016-07-01 16:54:53 +02:00
Simon Willnauer 158a6b5588 Cleanup BytesRefrence interface (elastic/elasticsearch#2670)
This is a followup of elastic/elasticsearchelastic/elasticsearch#19196

Original commit: elastic/x-pack-elasticsearch@1d0398e89a
2016-07-01 16:09:53 +02:00
Lee Hinman 8c54887ab8 Merge remote-tracking branch 'dakrone/migrate-tool-master'
Original commit: elastic/x-pack-elasticsearch@ce82529d4b
2016-06-30 09:53:52 -06:00
Ryan Ernst b513f2bb6b Merge branch 'master' into script_service_deps
Original commit: elastic/x-pack-elasticsearch@d4269e190d
2016-06-29 23:35:29 -07:00
Lee Hinman 24d7472cea Fix compilation for missing client
Original commit: elastic/x-pack-elasticsearch@586c5d0716
2016-06-29 09:37:47 -06:00
Lee Hinman db39da77c5 Merge remote-tracking branch 'origin/master' into migrate-tool-master
Original commit: elastic/x-pack-elasticsearch@eaa4b2923f
2016-06-29 09:30:07 -06:00
Lee Hinman ca1d92409f Move setup into a @Before method
Original commit: elastic/x-pack-elasticsearch@21b8cb5be3
2016-06-29 09:29:46 -06:00
Tanguy Leroux a06f4a02fd Rename Marvel packages and directories to Monitoring
related to elastic/elasticsearch#2383

Original commit: elastic/x-pack-elasticsearch@7f4001a031
2016-06-29 09:10:25 +02:00
Ryan Ernst 2d0055de35 Make script service a cluster state listener
Original commit: elastic/x-pack-elasticsearch@dc763f3d66
2016-06-28 14:06:53 -07:00
Lee Hinman a289fbd168 Add a tool to migrate users/roles from file to native realm
This adds the `bin/shield/migrate` tool that allows migrating users and
roles from the files to the native (API-based) store.

It looks like this:

```
λ bin/shield/migrate native -U http://localhost:9200 -u test_user -p changeme -n lee,foo -r role1,role2,role3,role4,foo
starting migration of users and roles...
importing users from [/home/hinmanm/scratch/elasticsearch-2.4.0-SNAPSHOT/config/shield/users]...
found existing users: [test_user, joe3, joe2]
migrating user [lee]
{"user":{"created":true}}
no user [foo] found, skipping
importing roles from [/home/hinmanm/scratch/elasticsearch-2.4.0-SNAPSHOT/config/shield/roles.yml]...
found existing roles: [marvel_user, role_query_fields, admin_role, role3, admin, remote_marvel_agent, power_user, role_new_format_name_array, role_run_as, logstash, role_fields, role_run_as1, role_new_format, kibana4_server, user, transport_client, role1.ab, role_query]
migrating role [role1]
{"role":{"created":true}}
migrating role [role2]
{"role":{"created":true}}
role [role3] already exists, skipping
migrating role [role4]
failed to migrate role [role4] with body: {"indices":[{"names":["idx2"]},{"names":["idx2"]},{"names":["idx1"]}]}
java.io.IOException: {"error":{"root_cause":[{"type":"parse_exception","reason":"failed to parse indices privileges for role [role4]. missing required [privileges] field"}],"type":"parse_exception","reason":"failed to parse indices privileges for role [role4]. missing required [privileges] field"},"status":400}
  at org.elasticsearch.shield.authc.esusers.tool.ESNativeRealmMigrateTool$MigrateUserOrRoles.postURL(ESNativeRealmMigrateTool.java:206)
  at org.elasticsearch.shield.authc.esusers.tool.ESNativeRealmMigrateTool$MigrateUserOrRoles.importRoles(ESNativeRealmMigrateTool.java:389)
  at org.elasticsearch.shield.authc.esusers.tool.ESNativeRealmMigrateTool$MigrateUserOrRoles.execute(ESNativeRealmMigrateTool.java:171)
  at org.elasticsearch.common.cli.CliTool.execute(CliTool.java:153)
  at org.elasticsearch.shield.authc.esusers.tool.ESNativeRealmMigrateTool.main(ESNativeRealmMigrateTool.java:91)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:9200/_shield/role/role4
  at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1840)
  at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
  at org.elasticsearch.shield.authc.esusers.tool.ESNativeRealmMigrateTool$MigrateUserOrRoles.postURL(ESNativeRealmMigrateTool.java:192)
  ... 4 more

no role [foo] found, skipping
users and roles imported.
```

Original commit: elastic/x-pack-elasticsearch@3ce47c0ffd
2016-06-27 14:20:45 -06:00
Tanguy Leroux 6ed9f50457 Fix SearchInputIT.testSearchInlineTemplate
The search type is overridden from default to query_and_fetch by the search action if the number of shards to request is equal to 1

Original commit: elastic/x-pack-elasticsearch@a9552c697c
2016-06-24 09:19:59 +02:00
Tanguy Leroux a20fb42b70 Fix SearchInputIT.testSearchIndexedTemplate
Original commit: elastic/x-pack-elasticsearch@4011a7bc9b
2016-06-23 12:33:49 +02:00
Tanguy Leroux 77a641b0fc Mute SecurityCachePermissionIT as it was before
Original commit: elastic/x-pack-elasticsearch@89c40f7bc0
2016-06-23 10:26:45 +02:00
Yannick Welsch b3ba1be659 Fix checkstyle line length limit
Original commit: elastic/x-pack-elasticsearch@717ab001d1
2016-06-23 10:01:02 +02:00
Tanguy Leroux 99ade96091 Watcher: Remove usage of SearchRequest's template support
Template support is going to be removed from the Search API to its own Search Template API in the lang-mustache module (see elastic/elasticsearch#17906, elastic/elasticsearch#18765). This commit changes Watcher's SearchInput and SearchTransform classes so that it now uses a WatcherSearchTemplateRequest that contains both the search request and the template. Search request and template are rendered using WatcherSearchTemplateRequestService before being executed.

Original commit: elastic/x-pack-elasticsearch@bfa16ab80f
2016-06-23 09:31:47 +02:00
Alexander Reelsen 5883efc976 Watcher: Remove support for _timestamp field in index action (elastic/elasticsearch#2575)
The watch index action was using the _timestamp field by default.
This functionality now needs to be configured explicitely for a special
field that is part of that document which is going to be indexed.

Relates elastic/elasticsearchelastic/elasticsearch#18980

Original commit: elastic/x-pack-elasticsearch@dfa4cf2296
2016-06-22 14:31:27 +02:00
javanna a030239c9e Merge branch 'master' into feature/http_client
Original commit: elastic/x-pack-elasticsearch@6437c6572d
2016-06-21 16:22:25 +02:00
jaymode c024dbfc49 security: remove use of shield in files and directory names
This commit removes as much of the use of shield as possible in the source code.

See elastic/elasticsearch#2383

Original commit: elastic/x-pack-elasticsearch@00009cc06e
2016-06-20 10:26:10 -04:00
javanna 966fff2009 Merge branch 'master' into feature/http_client
Original commit: elastic/x-pack-elasticsearch@9c8cfc915f
2016-06-17 13:50:36 +02:00
Simon Willnauer 36ad326483 Simplify ScriptModule and script registration elastic/elasticsearchelastic/elasticsearch#18903 (elastic/elasticsearch#2535)
follow up PR for elastic/elasticsearchelastic/elasticsearch#18903

Original commit: elastic/x-pack-elasticsearch@d6ab3ab141
2016-06-16 09:35:16 +02:00
javanna 82a19cda0e Merge branch 'master' into feature/http_client
Original commit: elastic/x-pack-elasticsearch@f8d810f0e8
2016-06-15 11:49:34 +02:00
Jim Ferenczi ce8ffab7f2 Add support for a policy file (x-pack-extension-security.policy) in an x-pack extension
Fix elastic/elasticsearch#2094

Original commit: elastic/x-pack-elasticsearch@bc017064d0
2016-06-14 10:20:54 +02:00
javanna c4ea0ae34d Merge branch 'master' into feature/http_client
Original commit: elastic/x-pack-elasticsearch@f11da04658
2016-06-09 17:44:06 +02:00
javanna 8bf2d93fac rename ElasticsearchResponse and ElasticsearchResponseException to Response and ResponseException
Original commit: elastic/x-pack-elasticsearch@edfd24f003
2016-06-09 16:55:39 +02:00
Jason Tedor 576a543a28 Register watcher thread pool
This commit register the watcher thread pool in the thread pool module
in core, and also makes the necessary changes to reflect a refactoring
that took place in core.

Relates elastic/elasticsearch#2397

Original commit: elastic/x-pack-elasticsearch@be298a7578
2016-06-06 22:09:58 -04:00
javanna a45b260244 [TEST] lower to 5s the wait for the Thread.sleep
Original commit: elastic/x-pack-elasticsearch@6efeb937cd
2016-06-04 01:10:47 +02:00
javanna db27d0ab20 rename ElasticsearchResponse#getFirstHeader to getHeader
Original commit: elastic/x-pack-elasticsearch@8ca2f6d6dd
2016-06-03 18:28:45 +02:00
javanna e240ca8043 [TEST] adapt to "create standard RestClient at first request and reuse it"
A RestClient instance is now created whenever EsIntegTestCase#getRestClient is invoked for the first time. It is then kept until the cluster is cleared (depending on the cluster scope of the test).

Renamed other two restClient methods to createRestClient, as that instance needs to be closed and managed in the tests.

Original commit: elastic/x-pack-elasticsearch@3a9d6f6e90
2016-06-03 18:09:05 +02:00
javanna ad9a64e854 [TEST] add a lot of forgotten try with resources to wrap ElasticsearchResponses
Original commit: elastic/x-pack-elasticsearch@e4634ea599
2016-06-03 16:42:06 +02:00
javanna 4e2766df11 replace some more usage of HttpClient with RestClient
Original commit: elastic/x-pack-elasticsearch@a3cb53b7a0
2016-06-03 16:13:52 +02:00
javanna e882fb3a18 Replace rest test client with low level RestClient
We still have a wrapper called RestTestClient that is very specific to Rest tests, as well as RestTestResponse etc. but all the low level bits around http connections etc. are now handled by RestClient.

Original commit: elastic/x-pack-elasticsearch@304487ecc5
2016-06-03 16:13:52 +02:00
javanna f58f347fe1 Replace HttpRequestBuilder usages with official RestClient
Original commit: elastic/x-pack-elasticsearch@7428498b47
2016-06-03 16:13:52 +02:00
Areek Zillur e996b78b04 Revert "move trigger package to top-level x-pack"
This reverts commit elastic/x-pack@bb0add9416.

Original commit: elastic/x-pack-elasticsearch@fc20c8c307
2016-06-01 21:30:08 -04:00
Areek Zillur 6ff8124640 Merge pull request elastic/elasticsearch#2388 from areek/extract_scheduler_engine_to_xpack
[refactor] extract trigger package and scheduler engine to top-level x-pack directory

Original commit: elastic/x-pack-elasticsearch@0a89cf2ca3
2016-06-01 15:27:24 -04:00
jaymode 4083bae777 test: set debug log level on the external cluster
Original commit: elastic/x-pack-elasticsearch@e23afb5fbc
2016-06-01 14:35:24 -04:00
Areek Zillur a7aa18aa17 move trigger package to top-level x-pack
Original commit: elastic/x-pack-elasticsearch@4f955a0c4a
2016-06-01 14:31:22 -04:00
jaymode fbeda210ae test: add logging to randomly failing IndexAuditIT
Original commit: elastic/x-pack-elasticsearch@3abd1ec0b5
2016-05-31 12:22:26 -04:00
Boaz Leskes 16d7f0c999 Introduce dedicated master nodes in testing infrastructure (elastic/elasticsearch#2314)
This is a companion commit to elastic/elasticsearchelastic/elasticsearch#18514, fixing issues introduced by adding dedicated master nodes to the test infra

Original commit: elastic/x-pack-elasticsearch@8c0571f2de
2016-05-27 08:45:54 +02:00
Robert Muir 21b2494c5b ScriptException -> GeneralScriptException (https://github.com/elastic/elasticsearch/pull/18600)
Original commit: elastic/x-pack-elasticsearch@0536fe9222
2016-05-26 17:51:46 -04:00
Tanguy Leroux b25c401b3c Add integration test for Delete-By-Query and Security
Closes elastic/elasticsearch#2287

Original commit: elastic/x-pack-elasticsearch@4bbb2a6f73
2016-05-25 09:39:23 +02:00
Adrien Grand 6860944f07 Use Java's Base64 instead of elasticsearch's. elastic/elasticsearch#2282
Original commit: elastic/x-pack-elasticsearch@c2e748d732
2016-05-23 11:25:31 +02:00
jaymode d552574016 test: set logger level differently after removal of support for es.* system properties
Original commit: elastic/x-pack-elasticsearch@fcaa9bbcff
2016-05-20 08:11:26 -04:00
Tanguy Leroux 5161b540a9 Move unneeded log info messages to debug
closes  elastic/elasticsearch#2228, elastic/elasticsearch#2227

Original commit: elastic/x-pack-elasticsearch@558751c424
2016-05-19 17:28:20 +02:00
Chris Earle 87c085d857 Better approach to skipping license check for subprojects
Original commit: elastic/x-pack-elasticsearch@8624ab08cc
2016-05-19 02:41:03 -04:00
Chris Earle 93ca4db1ce Remove duped plugin application from Gradle script.
Original commit: elastic/x-pack-elasticsearch@6745b39c82
2016-05-19 02:20:55 -04:00
Chris Earle c94a326f1d Split monitoring smoke tests into separate smoke tests
There is a race condition between the smoke tests that get run because of the teardown conditions of
REST tests. By splitting them, we can avoid the unrealistic scenario/race condition.

Original commit: elastic/x-pack-elasticsearch@f95ae0e595
2016-05-19 02:08:33 -04:00
Lee Hinman 91f2e94ac7 Fix scripting engines for singular type
Original commit: elastic/x-pack-elasticsearch@ed014cefc3
2016-05-13 09:29:37 -06:00
Robert Muir 3a2cfabc4d use painless syntax improvements in watcher tests and docs
Original commit: elastic/x-pack-elasticsearch@27ef31efac
2016-05-11 21:24:43 -04:00