(PDB-1068) Recognize prefix urls in import export#1206
Conversation
|
Test PASSed. |
|
@rbrw Now that @ajroetker PR has been merged, this needs a rebase |
1a40a44 to
e03a27d
Compare
|
Test FAILed. |
|
@pljenkinsro retest this please |
|
Rebased to master. |
|
Test PASSed. |
There was a problem hiding this comment.
I think exit-process should be something different from :type. We usually use type to indicate the type of error that occurred, rather than what do do about the error. So in this case maybe invalid-source is the error type? I also prefer the namespace keywords in these potentially global maps, so we know where it came from, i.e. ::invalid-source.
|
This is a good PR, I really like the throw/exit pattern by the way, I think it's better than the thunk passing that I did in the services ns. At first I wasn't sure about the base-url map stuff, but after reading through more of the change, I think it's an improvement over just a bare URL string. We have some utility functions built up around it and it allows us to give better, more specific error messages. |
e03a27d to
9567481
Compare
|
OK, thanks for all the suggestions. Hopefully the push below address the issues. It also adds some minor additional tests, and a hopefully better wrapper for import/export main. I've rebased the previous push as ticket/master/pdb-1068-recognize-prefix-urls-in-import-export-prev so that you should be able to get a pretty good sense of the changes via if you fetch both branches. The previous push itself is also still available as in case the "prev" rebase did something unexpected. Thanks |
|
Test FAILed. |
|
Error messages are much better with this patch, before: after: I'm looking into it further, not sure why there's a double slash there if a url-prefix isn't specified. |
To accomplish that, change all the relevant functions to accept a new "base-url" argument which is just a map that must contain :protocol, :host, :port, and optional :version and :prefix keys. If the :version isn't set, default it to :v4. When creating URL strings for client/get, Use a "base-url -> URL -> URI -> ASCII" trip to check for problems and perform escaping. Adjust the jetty utils to manage a *base-url* rather than just a *port*, so that tests can interact with the :prefix, etc.
To do so, add a main wrapper that allows us to throw a :utils/exit-process exception instead of calling System/exit directly. Have the wrapper handle other generally useful administrivia, i.e. calling shutdown-agents, flushing output, etc. Eventually we might want to extend this approach further, both within import/export, and elsewhere. Aside from making testing easier, it also allows any pending exception handlers to fire.
811e7bc to
0a24ac8
Compare
|
Test FAILed. |
|
The double slash was caused by not checking for empty? in base-url->str, and I've fixed the prn. This series should fix both issues, and the previous series should be available as https://github.com/rbrw/puppetdb/tree/ticket/master/pdb-1068-recognize-prefix-urls-in-import-export-v2 |
|
@pljenkinsro retest this please |
|
Test FAILed. |
There was a problem hiding this comment.
So I know in config files in PE when we got to the point of having to specify all these things, we decided to just use a single base-url item that the user specifies (e.g. http://localhost:8080/my_prefix) instead, parsing it into the map when we received it. Might make things cleaner!
|
@pljenkinsro retest this please |
|
The failures seem likely to be transient. |
|
Test FAILed. |
|
@pljenkinsro retest this please |
|
Test PASSed. |
…refix-urls-in-import-export (PDB-1068) Recognize prefix urls in import export
Note that there are 4 commits, which might or might not be easier to review individually, and I wondered about defaulting the base-url :protocol to "http". Right now it has to be specified every time.
(This series is based on the PDB-1070 PR and so may need to be rebased once that goes in.)