Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java exception if : is missing in the yaml file #320

Closed
jeffzhu503 opened this issue Jul 14, 2020 · 2 comments · Fixed by artipie/management-api#45
Closed

Java exception if : is missing in the yaml file #320

jeffzhu503 opened this issue Jul 14, 2020 · 2 comments · Fixed by artipie/management-api#45
Assignees

Comments

@jeffzhu503
Copy link
Collaborator

I am updating YAML config of your repository in central.artipie as the following. I did not add ":" after the account name
repo:
type: file
storage: default
permissions:
jeffzhu503
- upload
- download
I hit the exception which shall be handled gracefully with the yaml file formatting error.

java.util.concurrent.CompletionException: com.amihaiemil.eoyaml.exceptions.YamlIndentationException: Indentation of line 6 [- upload] is greater than the one of line 5 [jeffzhu503]. It should be less or equal.
java.util.concurrent.CompletionException: com.amihaiemil.eoyaml.exceptions.YamlIndentationException: Indentation of line 6 [- upload] is greater than the one of line 5 [jeffzhu503]. It should be less or equal.
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(Unknown Source)
at io.reactivex.internal.observers.ConsumerSingleObserver.onError(ConsumerSingleObserver.java:46)
at io.reactivex.internal.operators.single.SingleFlatMap$SingleFlatMapCallback$FlatMapSingleObserver.onError(SingleFlatMap.java:116)
at io.reactivex.internal.operators.completable.CompletableToSingle$ToSingle.onError(CompletableToSingle.java:74)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onError(SingleFlatMapCompletable.java:97)
at io.reactivex.internal.operators.single.SingleFlatMap$SingleFlatMapCallback$FlatMapSingleObserver.onError(SingleFlatMap.java:116)
at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onError(SingleMap.java:69)
at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:60)
at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:64)
at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:64)
at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:64)
at io.reactivex.internal.operators.single.SingleFlatMap$SingleFlatMapCallback$FlatMapSingleObserver.onSuccess(SingleFlatMap.java:111)
at io.reactivex.internal.operators.flowable.FlowableReduceSeedSingle$ReduceSeedObserver.onComplete(FlowableReduceSeedSingle.java:110)
at wtf.g4s8.rio.file.ReadSubscriberState.onComplete(ReadSubscriberState.java:76)
at wtf.g4s8.rio.file.ReadRequest$Next.process(ReadRequest.java:127)
at wtf.g4s8.rio.file.ReadTaskQueue.run(ReadTaskQueue.java:93)
at wtf.g4s8.rio.file.CloseChanOnError.run(CloseChanOnError.java:25)
at wtf.g4s8.rio.file.ErrorOnException.run(ErrorOnException.java:33)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: com.amihaiemil.eoyaml.exceptions.YamlIndentationException: Indentation of line 6 [- upload] is greater than the one of line 5 [jeffzhu503]. It should be less or equal.
at com.amihaiemil.eoyaml.WellIndented.iterator(WellIndented.java:150)
at com.amihaiemil.eoyaml.SameIndentationLevel.iterator(SameIndentationLevel.java:74)
at com.amihaiemil.eoyaml.ReadYamlMapping.valueOfStringKey(ReadYamlMapping.java:236)
at com.amihaiemil.eoyaml.ReadYamlMapping.value(ReadYamlMapping.java:180)
at com.amihaiemil.eoyaml.YamlMapping.yamlMapping(YamlMapping.java:89)
at com.amihaiemil.eoyaml.YamlMapping.yamlMapping(YamlMapping.java:77)
at com.artipie.api.ApiRepoUpdateSlice.lambda$response$3(ApiRepoUpdateSlice.java:117)
at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:57)
... 13 more

@github-actions
Copy link

github-actions bot commented Aug 4, 2021

Issue is stale, CC: @g4s8

@g4s8
Copy link
Member

g4s8 commented Aug 5, 2021

Let's return a human-readable error in case if yaml is not valid

g4s8 pushed a commit to artipie/management-api that referenced this issue Aug 18, 2021
Handle errors in `ApiRepoUpdateSlice` (#45)

Closes: artipie/artipie#320
g4s8 added a commit to artipie/management-api that referenced this issue Dec 22, 2021
* Add absent repos

* cicd(release): added release config for #38

* Fixed parameters and storage settings format in `ApiRepoUpdateSlice`

Closes #39 - fixed 2 problems in ApiRepoUpdateSlice:
 1) parameters separator was expected to be ; instead of &
 2) storage settings were always expected to be yaml, but there also can be string for default value

PR: #40

* Repo config should be url decoded

Closes #39 - Body with repo configs should be url-decoded.

PR: #41

* Improved updating storage settings functionality (#43)

Closes #42 - simplified and fixed updating storage scenario in ApiRepoUpdateSlice.

On dashboard we always work with whole yaml repo settings, so there is no need to update section by section, we can simply rewrite the whole file after checking that required fields (type and storage) are present in the new version.

* fix: added repository configuration descriptions

Added description for several repositories.

Issue: artipie/artipie#317
PR: #44

* fix: handle errors in `ApiRepoUpdateSlice` (#45)

Handle errors in `ApiRepoUpdateSlice` (#45)

Closes: artipie/artipie#320

* feat(conda): added conda repository to dashboard (#46)

Added anaconda repository option to dashboard and configuration description.

Ticket: artipie/artipie#317

* doc: verbose link name

Clarified API reference link name.

Closes: #47

* fix: add rq line to get users in `FromRqLine` (#48)

Part of artipie/artipie#965
Added rq line to get users in FromRqLine, corresponding test and updated http and asto.

* feat: added slice for repo delete (#49)

Add slice to delete a repo. Added disabled test for this slice as it is necessary to implement delete operation in FakeConfigFile class.

Ticket: artipie/artipie#321

* feat: add slice for routing `POST` requests (#51)

Added slice ApiRepoPostRtSlice for routing post requests by parsing body content. This class will be used in artipie module. Test will be added in next PR.

Ticket: artipie/artipie#321

* deps: bumped ppom and other deps (#53)

 * Bumped ppom from 0.5.1 to 1.1.0
 * Bumped asto from v1.9.0 to v1.10.0
 * Bumped http-client from 0.3.2 to 0.3.6
 * Bumped vert-server from 0.4 to 0.5

* refactor: extract class for body parsing (#52)

Extract class for parsing body content for receiving some content.

Close: #50

* test: enable test for delete and add for postRt (#55)

Enable and a bit extend test for ApiRepoDeleteSlice and add test for ApiRepoPostRtSlice.

Ref: artipie/artipie#321

* refactor: use storages instead of settings storage

Co-authored-by: Kirill <g4s8.public@gmail.com>
Co-authored-by: Alena <olena.gerasimova@gmail.com>
g4s8 added a commit to artipie/management-api that referenced this issue Dec 27, 2021
* Add absent repos

* cicd(release): added release config for #38

* Fixed parameters and storage settings format in `ApiRepoUpdateSlice`

Closes #39 - fixed 2 problems in ApiRepoUpdateSlice:
 1) parameters separator was expected to be ; instead of &
 2) storage settings were always expected to be yaml, but there also can be string for default value

PR: #40

* Repo config should be url decoded

Closes #39 - Body with repo configs should be url-decoded.

PR: #41

* Improved updating storage settings functionality (#43)

Closes #42 - simplified and fixed updating storage scenario in ApiRepoUpdateSlice.

On dashboard we always work with whole yaml repo settings, so there is no need to update section by section, we can simply rewrite the whole file after checking that required fields (type and storage) are present in the new version.

* fix: added repository configuration descriptions

Added description for several repositories.

Issue: artipie/artipie#317
PR: #44

* fix: handle errors in `ApiRepoUpdateSlice` (#45)

Handle errors in `ApiRepoUpdateSlice` (#45)

Closes: artipie/artipie#320

* feat(conda): added conda repository to dashboard (#46)

Added anaconda repository option to dashboard and configuration description.

Ticket: artipie/artipie#317

* doc: verbose link name

Clarified API reference link name.

Closes: #47

* fix: add rq line to get users in `FromRqLine` (#48)

Part of artipie/artipie#965
Added rq line to get users in FromRqLine, corresponding test and updated http and asto.

* feat: added slice for repo delete (#49)

Add slice to delete a repo. Added disabled test for this slice as it is necessary to implement delete operation in FakeConfigFile class.

Ticket: artipie/artipie#321

* feat: add slice for routing `POST` requests (#51)

Added slice ApiRepoPostRtSlice for routing post requests by parsing body content. This class will be used in artipie module. Test will be added in next PR.

Ticket: artipie/artipie#321

* deps: bumped ppom and other deps (#53)

 * Bumped ppom from 0.5.1 to 1.1.0
 * Bumped asto from v1.9.0 to v1.10.0
 * Bumped http-client from 0.3.2 to 0.3.6
 * Bumped vert-server from 0.4 to 0.5

* refactor: extract class for body parsing (#52)

Extract class for parsing body content for receiving some content.

Close: #50

* test: enable test for delete and add for postRt (#55)

Enable and a bit extend test for ApiRepoDeleteSlice and add test for ApiRepoPostRtSlice.

Ref: artipie/artipie#321

* fix: delete from items from substorage

Co-authored-by: Kirill <g4s8.public@gmail.com>
Co-authored-by: Alena <olena.gerasimova@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants