Commit graph

33 commits

Author SHA1 Message Date
guyben
08290e6b87 Fix the tool that was broken in []
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219629901
2018-11-02 14:39:36 -04:00
guyben
b48061b792 Refactor AppEngineConnection
AppEngineConnection can now connect to all services and not just the tools.

The default is still the tools.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218734983
2018-10-29 15:34:12 -04:00
guyben
c89cb6a3f3 Automated g4 rollback of changelist 212879670.
*** Reason for rollback ***

Automated tools sometimes don't have default credentials, and can't set them up. We should redo this CL once we figure out the credential thing.

*** Original change description ***

Add metrics for the command used in the registry CLI tool

Puts the metric in <project>/tools/commands_called

It counts the use of the tool, with the following labels:
- environment
- tool (nomulus/gtech)
- command called (class name)
- success true/false
- from the shell true/false

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=214048616
2018-10-03 11:50:47 -04:00
weiminyu
1f80f58336 Let RegistryTool proceed if MetricWriter is unavailable
This may happen with automated runs off Google Cloud.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213462175
2018-09-20 11:19:36 -04:00
guyben
414b2e4db1 Add metrics for the command used in the registry CLI tool
Puts the metric in <project>/tools/commands_called

It counts the use of the tool, with the following labels:
- environment
- tool (nomulus/gtech)
- command called (class name)
- success true/false
- from the shell true/false

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212879670
2018-09-14 11:58:11 -04:00
mmuller
8a2388f5b6 Rename RemoteApiCommand to CommandWithRemoteApi
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=211521742
2018-09-08 00:12:31 -04:00
mmuller
e43349592d Allow AppEngineConnection to target services other than "tools"
This change required several things:
- Separating out the interfaces that merely do HTTP calls to the backend from those
  that require the remote API (only load the remote API for the latter).  Only the
  tools service provides the remote api endpoint.
- Removing the XSRF token as an authentication mechanism (with OAUTH, we no longer
  need this, and trying to provide it requires initialization of the datastore
  code which requires the remote API)

I can't think of a compelling unit test for this beyond what already exists.
Tested:
  Verified that:
  - nomulus tool commands (e.g. "list_tlds") work against the tools service as they
    currently do
  - The "curl" command hits endpoints on "tools" by default.
  - We can use --server to specify endpoints on the default service.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=211510454
2018-09-08 00:10:06 -04:00
guyben
3dfd141e0f Fix the shell to allow multiple mutation of the same entity
Because of the objectify cache, after the first "read, change, write" of the
first mutation - the second mutation would "read" the original value, which
would then fail to be written with the error "Entity changed since init()".

This was specifically seen in the "UpdateRegistrarCommand", but likely affected
other commands as well.

Clearing the cache before each command solves this issue.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192328213
2018-04-10 17:08:45 -04:00
guyben
013558c814 Make it VERY clear when nomulus shell is on PROD
We don't want people to accidentally run commands on prod thinking they were on
Alpha / Sandbox.

To do that - we add 2 safeguards:

1) when on prod, the shell has a strong RED "PRODUCTION" in the commandline, while on alpha/sandbox it's green.

2) if a prod shell is idle for > 1h, it exits. So don't accidentally use a prod shell from a long time ago.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191931731
2018-04-10 16:51:42 -04:00
guyben
3338b91c84 Remove the "shell" command from the completions, and allow empty lines
Even though you couldn't run a "shell" inside a "shell", the completion still
assumed you could :(

On the way - fixing error on empty lines: when you just press "enter", the shell should ignore it rather than try to run it as a command (and getting an error, obviously)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191605029
2018-04-10 16:32:12 -04:00
guyben
cfd83ad4dc Add "libreadlines"-like behavior to the shell command
Using the jline open-source library.

We save the history between invocations to ~/.nomulus_history

We add some simple completions:
- first argument completes to command name
- all other arguments complete to the command parameters, or filename

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191501023
2018-04-10 16:22:30 -04:00
mmuller
3dff2ba4c7 Inline calls to get command from jcommander
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191338771
2018-04-10 16:08:10 -04:00
mmuller
18290911a0 Fix multiple invocations of the "shell" command
JCommander doesn't seem to reset objects when it populates them with data from
an argument list during command processing, so recreate the command objects
every time we do a run().

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191332392
2018-04-02 16:55:15 -04:00
mmuller
f1c29633fb Add a "shell" pseudo-command to nomulus tool
Add the "shell" command which lets you run multiple other command in a single
session, sparing you the initialization costs for all but the first of them.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188712815
2018-03-19 18:22:01 -04:00
mcilwain
51326a1a5c Remove unnecessary return in void function
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173415021
2017-11-07 16:58:26 -05:00
mcilwain
ec5c9e4474 Use getDeclaredConstructor() so exception checking isn't bypassed
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173412751
2017-11-07 16:55:28 -05:00
mmuller
b6f3d60e0f Refactor command running around auth exceptions
Refactor command and component code in RegistryCli so that we can handle a
LoginRequiredException from whereever we are likely to ever get one.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149329171
2017-03-07 13:59:40 -05:00
mmuller
5614760d53 Implement login/logout commands
Refactor the auth code into its own dagger module, add tests and use the new interfaces to implement the login and logout commands.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149108266
2017-03-07 13:45:11 -05:00
mcilwain
cdadb54acd Refer to Datastore everywhere correctly by its capitalized form
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147479683
2017-02-17 12:12:12 -05:00
cgoldfeder
468f1fb0f8 Fix two Gauava 20 deprecations across the tools package
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146162927
2017-02-02 16:54:28 -05:00
mmuller
ecbe2662ac Convert request factory components into a module
Move all of the code to create the request factories into
RequestFactoryModule.  Also add the --force_http_connection flag to allow us
to force the use of HTTP connections instead of HTTPOverRPC for our internal
connections.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146116640
2017-02-02 16:35:36 -05:00
mmuller
b70f57b7c7 Update copyright year on all license headers
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146111211
2017-02-02 16:27:22 -05:00
mmuller
270734fd9b Convert AppEngineConnection to use HttpTransport
Make AppEngineConnection use HttpTransport through HttpRequestFactory and
create factory factories for localhost and HTTPOverRPC.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143680257
2017-01-09 11:59:04 -05:00
mcilwain
1627bd4975 Revert Guava 20 features until we get the build working properly
*** Original change description ***

Remove deprecated methods with Guava 20 release

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137945126
2016-11-02 15:19:34 -04:00
jianglai
82b0bff9b5 Remove deprecated methods with Guava 20 release
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137849843
2016-11-02 15:19:34 -04:00
ctingue
1b7cee61a5 Enable command name autocomplete for nomulus tool
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137299749
2016-11-02 15:19:34 -04:00
nickfelt
afa4d66601 Remove final on @ParametersDelegate field
Compile-time constant inlining may interfere with JCommander's processing if a field is made final - @ParametersDelegate fields are particularly misleading.  Remove the one instance of that and add warning comments elsewhere.  See

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136469351
2016-10-18 10:37:33 -04:00
shikhman
f76bc70f91 Preserve test logs and test summary output for Kokoro CI runs
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135494972
2016-10-14 16:57:43 -04:00
mcilwain
071de78a6d Remove last stray mention of gTech
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135101061
2016-10-05 11:58:23 -04:00
mcilwain
3b02d77ceb Rename 'registry_tool' to 'nomulus'
This changes everything with external visibility beyond the codebase
(i.e. the name of the compiled binary and the documentation that refers
to it). It does not change a lot of things internal to the codebase,
i.e. the "RegistryTool" class didn't change its name. We can rename that
in a subsequent CL if we want to.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135022087
2016-10-04 09:59:54 -04:00
mcilwain
aa2f283f7c Convert entire project to strict lexicographical import sort ordering
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127234970
2016-07-13 15:59:53 -04:00
Michael Muller
c458c05801 Rename Java packages to use the .google TLD
The dark lord Gosling designed the Java package naming system so that
ownership flows from the DNS system. Since we own the domain name
registry.google, it seems only appropriate that we should use
google.registry as our package name.
2016-05-13 20:04:42 -04:00
Justine Tunney
5012893c1d mv com/google/domain/registry google/registry
This change renames directories in preparation for the great package
rename. The repository is now in a broken state because the code
itself hasn't been updated. However this should ensure that git
correctly preserves history for each file.
2016-05-13 18:55:08 -04:00
Renamed from java/com/google/domain/registry/tools/RegistryCli.java (Browse further)