Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
7835038
migrate activitylog from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
0053f3b
migrate antivirus from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
81e6b3e
migrate app-provider from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
eb6d2dc
migrate app-registry from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
4bcc4b9
migrate audit from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
78168a3
migrate auth-app from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
8dc3877
migrate auth-basic from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
af4c0b8
migrate auth-bearer from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
e14a5c6
migrate auth-machine from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
eb8a19a
migrate auth-service from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
f4526d4
migrate clientlog from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
e611485
migrate collaboration from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
e2964e2
migrate eventhistory from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
947a768
migrate frontend from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
57013e8
migrate gateway from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
8d6f7a8
migrate graph from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
07956c9
migrate groups from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
c8d0217
migrate idm from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
d322c0d
migrate idp from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
bd2f697
migrate invitations from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
2b411eb
migrate nats from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
5080aea
migrate notifications from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
f43909d
migrate ocdav from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
6804237
migrate ocm from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
4488958
migrate ocs from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
131178e
migrate policies from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
b76d4fc
migrate postprocessing from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
882dede
migrate proxy from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
e7a5788
migrate search from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
eebced5
migrate settings from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
378aba3
migrate sharing from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
1024830
migrate sse from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
3967e06
migrate storage-publiclink from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
5c9f0ab
migrate storage-shares from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
e398ce3
migrate storage-system from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
5869f8c
migrate storage-users from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
7e1ab4f
migrate thumbnails from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
5f43acc
migrate userlog from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
63a0b10
migrate users from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
f139531
migrate web from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
ee5ff08
migrate webdav from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
1e38489
migrate webfinger from urfave/cli to spf13/cobra
dragonchaser Dec 2, 2025
35900f8
migrate posix cli commands from urfave/cli to spf13/cobra
dragonchaser Dec 3, 2025
1e97049
migrate oc init command from urfave/cli to spf13/cobra
dragonchaser Dec 3, 2025
56324ca
migrate decomposedfs cli command from urfave/cli to spf13/cobra
dragonchaser Dec 3, 2025
3cb0029
migrate backup cli command from urfave/cli to spf13/cobra
dragonchaser Dec 3, 2025
83bbcfb
migrate benchmark cli command from urfave/cli to spf13/cobra
dragonchaser Dec 3, 2025
dfa2577
migrate list cli command from urfave/cli to spf13/cobra
dragonchaser Dec 3, 2025
4794deb
migrate revisions cli command from urfave/cli to spf13/cobra
dragonchaser Dec 3, 2025
3f73faa
migrate shares cli command from urfave/cli to spf13/cobra
dragonchaser Dec 3, 2025
7c2eb19
migrate services.go from urfave/cli to spf13/cobra
dragonchaser Dec 3, 2025
d890544
migrate oc root cli command from urfave/cli to spf13/cobra
dragonchaser Dec 3, 2025
6d054c5
migrate trash cli command from urfave/cli to spf13/cobra
dragonchaser Dec 3, 2025
7be33b0
refactor interims DefaultAppCobra to DefaultApp
dragonchaser Dec 3, 2025
67981d8
refactor version cli command from urfave/cli to spf13/cobra
dragonchaser Dec 3, 2025
07c160f
refactor oc runtime server from urfave/cli to spf13/cobra
dragonchaser Dec 3, 2025
a8545bf
add go test with race
dragonchaser Dec 3, 2025
0372869
refactor remaining code from urfave/cli
dragonchaser Dec 4, 2025
75bcc54
vendor
dragonchaser Dec 4, 2025
a9b1bea
override RunE function of root subcommands to ensure that help is sho…
dragonchaser Dec 8, 2025
0fa3a2a
prevent overwrite of RunE
dragonchaser Dec 8, 2025
879de39
fix: list service child commands the service is called without arguments
fschade Dec 11, 2025
9904e5b
enhancement(cli): group commands by topic
fschade Dec 11, 2025
5824d8d
fix(cli): hydrate shared configurations such as commons before runnin…
fschade Dec 12, 2025
efb7e73
fix(cli): fix varius cmds
fschade Dec 12, 2025
9360175
fix storage-users uploads sessions flags
butonic Dec 12, 2025
9a59792
fix storage-users trash-bin flags
butonic Dec 12, 2025
f66600d
fix notifications send-email flags
butonic Dec 12, 2025
2c8c334
fix postprocessing restart flags
butonic Dec 12, 2025
6e75e41
fix search index flags
butonic Dec 12, 2025
f7681b3
fix opencloud backup flags
butonic Dec 12, 2025
94a49aa
fix opencloud benchmark flags
butonic Dec 12, 2025
35b3e51
fix opencloud decomposedfs flags
butonic Dec 12, 2025
6204c6b
fix opencloud init flags
butonic Dec 12, 2025
eebccf7
fix opencloud trash flags
butonic Dec 12, 2025
8564fa4
fix opencloud version flags
butonic Dec 12, 2025
032c218
replace .Value.String() with .GetString(...)
butonic Dec 12, 2025
d0e5101
replace more .Value.String() occurences
butonic Dec 12, 2025
61707ab
double check required args
butonic Dec 12, 2025
3a2a388
ignore some viper errors
butonic Dec 12, 2025
9dd03b6
small fixes
butonic Dec 12, 2025
f465a2b
fix: flaky integration tests
fschade Dec 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ go-mod-tidy:
test:
@go test -v -tags '$(TAGS)' -coverprofile coverage.out ./...

.PHONY: test-with-race
test-with-race:
@go test -race -v -tags '$(TAGS)' -coverprofile coverage.out ./...

.PHONY: go-coverage
go-coverage:
@if [ ! -f coverage.out ]; then $(MAKE) test &>/dev/null; fi;
Expand Down
10 changes: 8 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ require (
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af
github.com/spf13/afero v1.15.0
github.com/spf13/cobra v1.10.1
github.com/spf13/pflag v1.0.10
github.com/spf13/viper v1.21.0
github.com/stretchr/testify v1.11.1
github.com/test-go/testify v1.1.4
github.com/testcontainers/testcontainers-go v0.40.0
Expand All @@ -88,7 +90,6 @@ require (
github.com/tidwall/sjson v1.2.5
github.com/tus/tusd/v2 v2.8.0
github.com/unrolled/secure v1.16.0
github.com/urfave/cli/v2 v2.27.7
github.com/vmihailenco/msgpack/v5 v5.4.1
github.com/xhit/go-simple-mail/v2 v2.16.0
go-micro.dev/v4 v4.11.0
Expand Down Expand Up @@ -319,6 +320,7 @@ require (
github.com/pablodz/inotifywaitgo v0.0.9 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/philhofer/fwd v1.2.0 // indirect
github.com/pierrec/lz4/v4 v4.1.15 // indirect
github.com/pjbgf/sha1cd v0.3.2 // indirect
Expand All @@ -335,6 +337,7 @@ require (
github.com/russellhaering/goxmldsig v1.5.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/samber/lo v1.51.0 // indirect
github.com/samber/slog-common v0.19.0 // indirect
github.com/samber/slog-zerolog/v2 v2.9.0 // indirect
Expand All @@ -350,10 +353,12 @@ require (
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c // indirect
github.com/shurcooL/vfsgen v0.0.0-20230704071429-0000e147ea92 // indirect
github.com/skeema/knownhosts v1.3.0 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spacewander/go-suffix-tree v0.0.0-20191010040751-0865e368c784 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/studio-b12/gowebdav v0.9.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tchap/go-patricia/v2 v2.3.3 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
Expand All @@ -362,6 +367,7 @@ require (
github.com/tklauser/numcpus v0.8.0 // indirect
github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208 // indirect
github.com/trustelem/zxcvbn v1.0.1 // indirect
github.com/urfave/cli/v2 v2.27.5 // indirect
github.com/valyala/fastjson v1.6.4 // indirect
github.com/vektah/gqlparser/v2 v2.5.30 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
Expand Down
18 changes: 16 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,8 @@ github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/foxcpp/go-mockdns v1.1.0 h1:jI0rD8M0wuYAxL7r/ynTrCQQq0BVqfB99Vgk7DlmewI=
github.com/foxcpp/go-mockdns v1.1.0/go.mod h1:IhLeSFGed3mJIAXPH2aiRQB+kqz7oqu8ld2qVbOu7Wk=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
Expand Down Expand Up @@ -988,6 +990,8 @@ github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2D
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5 h1:Ii+DKncOVM8Cu1Hc+ETb5K+23HdAMvESYE3ZJ5b5cMI=
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5/go.mod h1:iIss55rKnNBTvrwdmkUpLnDpZoAHvWaiq5+iMmen4AE=
github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM=
Expand Down Expand Up @@ -1093,6 +1097,8 @@ github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd h1:CmH9+J6ZSsIjUK
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sacloud/libsacloud v1.36.2/go.mod h1:P7YAOVmnIn3DKHqCZcUKYUXmSwGBm3yS7IBEjKVSrjg=
github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc=
github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik=
github.com/samber/lo v1.51.0 h1:kysRYLbHy/MB7kQZf5DSN50JHmMsNEdeY24VzJFu7wI=
github.com/samber/lo v1.51.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
github.com/samber/slog-common v0.19.0 h1:fNcZb8B2uOLooeYwFpAlKjkQTUafdjfqKcwcC89G9YI=
Expand Down Expand Up @@ -1142,6 +1148,8 @@ github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:s
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/smartystreets/gunit v1.0.4/go.mod h1:EH5qMBab2UclzXUcpR8b93eHsIlp9u+pDQIRp5DZNzQ=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=
github.com/spacewander/go-suffix-tree v0.0.0-20191010040751-0865e368c784 h1:0jjO3HdJfOn6gYHD/ZNZh0LLMxEAqkYX7xoDPQReEgs=
github.com/spacewander/go-suffix-tree v0.0.0-20191010040751-0865e368c784/go.mod h1:ff/5myEGgtsAwf26goQCO905GrEm5ugEZSd6OWTsrhM=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
Expand All @@ -1151,6 +1159,8 @@ github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI=
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
Expand All @@ -1163,6 +1173,8 @@ github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
Expand All @@ -1184,6 +1196,8 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/stvp/go-udp-testing v0.0.0-20201019212854-469649b16807/go.mod h1:7jxmlfBCDBXRzr0eAQJ48XC1hBu1np4CS5+cHEYfwpc=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/tchap/go-patricia/v2 v2.3.3 h1:xfNEsODumaEcCcY3gI0hYPZ/PcpVv5ju6RMAhgwZDDc=
github.com/tchap/go-patricia/v2 v2.3.3/go.mod h1:VZRHKAb53DLaG+nA9EaYYiaEx6YztwDlLElMsnSHD4k=
github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE=
Expand Down Expand Up @@ -1225,8 +1239,8 @@ github.com/tus/tusd/v2 v2.8.0/go.mod h1:3/zEOVQQIwmJhvNam8phV4x/UQt68ZmZiTzeuJUN
github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g=
github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
github.com/urfave/cli/v2 v2.27.7 h1:bH59vdhbjLv3LAvIu6gd0usJHgoTTPhCFib8qqOwXYU=
github.com/urfave/cli/v2 v2.27.7/go.mod h1:CyNAG/xg+iAOg0N4MPGZqVmv2rCoP267496AOXUZjA4=
github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w=
github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ=
github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
Expand Down
68 changes: 24 additions & 44 deletions opencloud/pkg/command/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,69 +4,43 @@ import (
"errors"
"fmt"

"github.com/spf13/cobra"

"github.com/opencloud-eu/opencloud/opencloud/pkg/backup"
"github.com/opencloud-eu/opencloud/opencloud/pkg/register"
"github.com/opencloud-eu/opencloud/pkg/config"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/config/parser"
decomposedbs "github.com/opencloud-eu/reva/v2/pkg/storage/fs/decomposed/blobstore"
decomposeds3bs "github.com/opencloud-eu/reva/v2/pkg/storage/fs/decomposeds3/blobstore"
"github.com/urfave/cli/v2"
)

// BackupCommand is the entrypoint for the backup command
func BackupCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "backup",
Usage: "OpenCloud backup functionality",
Subcommands: []*cli.Command{
ConsistencyCommand(cfg),
},
Before: func(c *cli.Context) error {
func BackupCommand(cfg *config.Config) *cobra.Command {
bckCmd := &cobra.Command{
Use: "backup",
Short: "OpenCloud backup functionality",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
return configlog.ReturnError(parser.ParseConfig(cfg, true))
},
Action: func(_ *cli.Context) error {
fmt.Println("Read the docs")
return nil
},
}
bckCmd.AddCommand(ConsistencyCommand(cfg))
return bckCmd
}

// ConsistencyCommand is the entrypoint for the consistency Command
func ConsistencyCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "consistency",
Usage: "check backup consistency",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "basepath",
Aliases: []string{"p"},
Usage: "the basepath of the decomposedfs (e.g. /var/tmp/opencloud/storage/users)",
Required: true,
},
&cli.StringFlag{
Name: "blobstore",
Aliases: []string{"b"},
Usage: "the blobstore type. Can be (none, decomposed, decomposeds3). Default decomposed",
Value: "decomposed",
},
&cli.BoolFlag{
Name: "fail",
Usage: "exit with non-zero status if consistency check fails",
},
},
Action: func(c *cli.Context) error {
basePath := c.String("basepath")
if basePath == "" {
fmt.Println("basepath is required")
return cli.ShowCommandHelp(c, "consistency")
}

func ConsistencyCommand(cfg *config.Config) *cobra.Command {
consCmd := &cobra.Command{
Use: "consistency",
Short: "check backup consistency",
RunE: func(cmd *cobra.Command, args []string) error {
var (
bs backup.ListBlobstore
err error
)
switch c.String("blobstore") {
basePath, _ := cmd.Flags().GetString("basepath")
blobstoreFlag, _ := cmd.Flags().GetString("blobstore")
switch blobstoreFlag {
case "decomposeds3":
bs, err = decomposeds3bs.New(
cfg.StorageUsers.Drivers.DecomposedS3.Endpoint,
Expand All @@ -87,14 +61,20 @@ func ConsistencyCommand(cfg *config.Config) *cli.Command {
fmt.Println(err)
return err
}
if err := backup.CheckProviderConsistency(basePath, bs, c.Bool("fail")); err != nil {
fail, _ := cmd.Flags().GetBool("fail")
if err := backup.CheckProviderConsistency(basePath, bs, fail); err != nil {
fmt.Println(err)
return err
}

return nil
},
}
consCmd.Flags().StringP("basepath", "p", "", "the basepath of the decomposedfs (e.g. /var/tmp/opencloud/storage/users)")
_ = consCmd.MarkFlagRequired("basepath")
consCmd.Flags().StringP("blobstore", "b", "decomposed", "the blobstore type. Can be (none, decomposed, decomposeds3). Default decomposed")
consCmd.Flags().Bool("fail", false, "exit with non-zero status if consistency check fails")
return consCmd
}

func init() {
Expand Down
Loading