mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
Compare commits
204 Commits
4abe94ca0b
...
v3.10.0-rc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea4bf2f79b | ||
|
|
07743d7457 | ||
|
|
006b5f1a9d | ||
|
|
429d43d8a6 | ||
|
|
51123c531a | ||
|
|
796f3ecf6d | ||
|
|
78fe9fbe08 | ||
|
|
cd4ae93455 | ||
|
|
94e52c7d85 | ||
|
|
0914791bba | ||
|
|
aea2ea174c | ||
|
|
0ed048a2df | ||
|
|
27128949b5 | ||
|
|
93ed1c408c | ||
|
|
866063a7ed | ||
|
|
9a24dd5191 | ||
|
|
80332a6e23 | ||
|
|
3948f6915d | ||
|
|
ae78af3a3e | ||
|
|
b1ba088ba6 | ||
|
|
af2f2ab6a0 | ||
|
|
05d7823d3f | ||
|
|
fb89651888 | ||
|
|
5e78857c9c | ||
|
|
0a0ec6ba5a | ||
|
|
0fac7dfebe | ||
|
|
e8e125c4b7 | ||
|
|
b8f12b7541 | ||
|
|
75d7f518a7 | ||
|
|
89dee93ff3 | ||
|
|
b63858e555 | ||
|
|
ea5054eb5b | ||
|
|
19da84ad05 | ||
|
|
74160bfce8 | ||
|
|
c6265114d8 | ||
|
|
701db10083 | ||
|
|
51762b856e | ||
|
|
d36f6200ed | ||
|
|
2db88dada9 | ||
|
|
dc6ba455f5 | ||
|
|
946a9fe064 | ||
|
|
d8ce42f34c | ||
|
|
6eee398d0b | ||
|
|
c82571930d | ||
|
|
0ec59d847f | ||
|
|
15dd695506 | ||
|
|
285399afb3 | ||
|
|
5822275000 | ||
|
|
db530f7e42 | ||
|
|
5cb759276d | ||
|
|
b6cdd0fd9e | ||
|
|
676c385b94 | ||
|
|
4173c51796 | ||
|
|
e5b0dad51e | ||
|
|
15865f8d54 | ||
|
|
0dde5e7d61 | ||
|
|
84d18a0610 | ||
|
|
a333e39197 | ||
|
|
abd3ce39a4 | ||
|
|
8034d2bc2e | ||
|
|
9316432c65 | ||
|
|
edd4695dbd | ||
|
|
e11a1a83b3 | ||
|
|
0708093356 | ||
|
|
d6b7050991 | ||
|
|
0404b5195a | ||
|
|
9d2697c69a | ||
|
|
90c540354c | ||
|
|
0f66e4bc78 | ||
|
|
355b65a631 | ||
|
|
954b7c2803 | ||
|
|
4e87d4004d | ||
|
|
18be93628a | ||
|
|
12c02e2b25 | ||
|
|
3900a91bfc | ||
|
|
1e77fc5617 | ||
|
|
f08bedbd31 | ||
|
|
05eec11c90 | ||
|
|
6a4d0a8624 | ||
|
|
98c1b5e7db | ||
|
|
89e05503fd | ||
|
|
edee04fcc7 | ||
|
|
732db665d1 | ||
|
|
7577705b60 | ||
|
|
af7c4f5e23 | ||
|
|
08b43deb3b | ||
|
|
e4f6722621 | ||
|
|
c6e2f99691 | ||
|
|
e16d51a773 | ||
|
|
5d22a4584d | ||
|
|
9e98750429 | ||
|
|
d92ad0b358 | ||
|
|
edc700ccb3 | ||
|
|
1aa3f63b6c | ||
|
|
85670ce5f6 | ||
|
|
5918d17f7b | ||
|
|
8dc56273b4 | ||
|
|
00cd582502 | ||
|
|
bad38b83b9 | ||
|
|
b5291d3b2a | ||
|
|
a801882077 | ||
|
|
db3363a356 | ||
|
|
d33903571a | ||
|
|
517647dda3 | ||
|
|
ae0de28ae1 | ||
|
|
89dfa83dda | ||
|
|
fbd34228fe | ||
|
|
06d294b441 | ||
|
|
8f81e74900 | ||
|
|
33f51662ea | ||
|
|
2b1daa4362 | ||
|
|
ad99d8657a | ||
|
|
ddcc5fa3d0 | ||
|
|
448b788f54 | ||
|
|
38e7b60e06 | ||
|
|
ae78a0bb6c | ||
|
|
1ce4462ed1 | ||
|
|
2b550a8532 | ||
|
|
6ffa3de191 | ||
|
|
edf0b00020 | ||
|
|
019145df89 | ||
|
|
60bea8872a | ||
|
|
53fc76a72f | ||
|
|
321fb8208e | ||
|
|
17f646d742 | ||
|
|
9c767d97ef | ||
|
|
fe80cc2f45 | ||
|
|
89efac5644 | ||
|
|
36cfd67119 | ||
|
|
e780547c13 | ||
|
|
b3420191dc | ||
|
|
d417aee230 | ||
|
|
5888dc6f88 | ||
|
|
5d8b9f86bd | ||
|
|
ff9fbbb2ce | ||
|
|
965bab1588 | ||
|
|
9d3f29a0d7 | ||
|
|
43a885c172 | ||
|
|
4b39ae2386 | ||
|
|
0da3d8b8eb | ||
|
|
b9565408e1 | ||
|
|
29d6490ff8 | ||
|
|
50f6e6d687 | ||
|
|
2551bc9e2c | ||
|
|
1cf4c3441f | ||
|
|
94b7cdcc2b | ||
|
|
65295e5bec | ||
|
|
c17edd7829 | ||
|
|
7d26409efc | ||
|
|
10e9692ab8 | ||
|
|
392118a7ba | ||
|
|
fbe892a424 | ||
|
|
9d1996e544 | ||
|
|
5d18eded05 | ||
|
|
335fe5d7aa | ||
|
|
be5ff80381 | ||
|
|
5dfe1ae004 | ||
|
|
79e348688a | ||
|
|
5323898ee1 | ||
|
|
8d5ceb0b73 | ||
|
|
5c15d23c5e | ||
|
|
24d369a7d2 | ||
|
|
dbd5e03406 | ||
|
|
37966f32e1 | ||
|
|
8bd34fda3d | ||
|
|
55f7404d36 | ||
|
|
13e2749eb0 | ||
|
|
4f9e08d988 | ||
|
|
bcbcbdf867 | ||
|
|
c241dec916 | ||
|
|
0d16a97748 | ||
|
|
5fe3ffbf94 | ||
|
|
4c5ed8b537 | ||
|
|
7794cedd1c | ||
|
|
600dc0bb9e | ||
|
|
fccccb3c79 | ||
|
|
ad2a12eb31 | ||
|
|
7fa8c24fb1 | ||
|
|
553c987069 | ||
|
|
750818041f | ||
|
|
c774bd2ca3 | ||
|
|
37196c0f3d | ||
|
|
58201ccf85 | ||
|
|
eb6322cd4f | ||
|
|
803f3648fb | ||
|
|
16430d8ef7 | ||
|
|
f72b903533 | ||
|
|
94e3dbad41 | ||
|
|
e10434ff77 | ||
|
|
1365007ed1 | ||
|
|
5f48c736f8 | ||
|
|
2026943c36 | ||
|
|
18d341ea15 | ||
|
|
f8ddb4a211 | ||
|
|
f8e596fdd6 | ||
|
|
7d4ca95df4 | ||
|
|
40eb0075ec | ||
|
|
59a1b03d97 | ||
|
|
06470f23e7 | ||
|
|
c2812f4a5e | ||
|
|
aae19e7563 | ||
|
|
1cfb56b087 | ||
|
|
774b14fbbe | ||
|
|
0c2b5a48aa |
6
Makefile
6
Makefile
@@ -282,12 +282,12 @@ dep:
|
||||
@echo "$$depDeprecated"
|
||||
@$(MAKE) mod
|
||||
|
||||
RELEASE_BRANCH:=master
|
||||
RELEASE_BRANCH:=release/3.10
|
||||
GOPROXY ?= direct
|
||||
|
||||
mod:
|
||||
GOPROXY=$(GOPROXY) go get -d yunion.io/x/cloudmux@$(RELEASE_BRANCH)
|
||||
GOPROXY=$(GOPROXY) go get -d $(patsubst %,%@master,$(shell GO111MODULE=on go mod edit -print | sed -n -e 's|.*\(yunion.io/x/[a-z].*\) v.*|\1|p' | grep -v '/cloudmux$$'))
|
||||
GOPROXY=$(GOPROXY) GONOSUMDB=yunion.io/x go get -d yunion.io/x/cloudmux@$(RELEASE_BRANCH)
|
||||
GOPROXY=$(GOPROXY) GONOSUMDB=yunion.io/x go get -d $(patsubst %,%@master,$(shell GO111MODULE=on go mod edit -print | sed -n -e 's|.*\(yunion.io/x/[a-z].*\) v.*|\1|p' | grep -v '/cloudmux$$'))
|
||||
go mod tidy
|
||||
go mod vendor -v
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/baremetal-base:v0.3.8
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/baremetal-base:v0.3.9
|
||||
|
||||
MAINTAINER "Zexi Li <lizexi@yunionyun.com>"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#FROM --platform=linux/amd64 registry.cn-beijing.aliyuncs.com/yunionio/centos-build:1.1-4 as build
|
||||
#RUN yum install -y https://iso.yunion.cn/vm-images/baremetal-pxerom-1.1.0-21092209.x86_64.rpm
|
||||
#RUN yum install -y http://192.168.23.50:8083/baremetal-pxerom-1.1.0-21092209.x86_64.rpm
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/yunionos:v0.1.6 as yunionos
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/yunionos:v0.1.7 as yunionos
|
||||
|
||||
FROM centos:8 as grub-stage
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ WEBCONSOLE_BASE_VERSION = v0.2-1
|
||||
webconsole-base:
|
||||
$(DOCKER_BUILDX)/webconsole-base:$(WEBCONSOLE_BASE_VERSION) -f ./Dockerfile.webconsole-base .
|
||||
|
||||
BAREMETAL_BASE_VERSION = v0.3.8
|
||||
BAREMETAL_BASE_VERSION = v0.3.9
|
||||
|
||||
baremetal-base:
|
||||
$(DOCKER_BUILDX)/baremetal-base:$(BAREMETAL_BASE_VERSION) -f ./Dockerfile.baremetal-base .
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- $d := .resource_details -}}
|
||||
数据库 {{$d.ip}} 的主从同步不一致,请及时检查。
|
||||
|
||||
{{ range $status := $d.status }}
|
||||
数据库 {{$status.ip}} 状态:
|
||||
{{- if not $status.operator_error }}
|
||||
- Slave_IO_Running: {{$status.slave_io_running}}
|
||||
- Slave_SQL_Running: {{$status.slave_sql_running}}
|
||||
{{- if $status.last_error }}
|
||||
- Last_Error: {{$status.last_error}}
|
||||
{{- end -}}
|
||||
{{- if $status.last_io_error }}
|
||||
- Last_IO_Error: {{$status.last_io_error}}
|
||||
{{- end }}
|
||||
{{else}}
|
||||
- Operator_Error: {{$status.operator_error}}
|
||||
{{- end}}
|
||||
{{end}}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
{{ $d.service_name }}服务的网络拓扑信息同步不一致,请及时检查。
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
{{ $d.account }}:您的密码有效期将过,请及时登录平台更新密码。
|
||||
@@ -0,0 +1,8 @@
|
||||
{{- $d := .resource_details -}}
|
||||
服务: {{ $d.service_name }} 异常。
|
||||
方法: {{ $d.method }}
|
||||
路径: {{ $d.path }}
|
||||
{{- if $d.body }}
|
||||
请求: {{ $d.body -}}
|
||||
{{ end }}
|
||||
错误: {{ $d.error }}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
云账号{{ $d.name }}状态异常,请及时检查。
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
服务{{ d.service_name}} worker阻塞半小时,请及时检查。
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- $d := .resource_details -}}
|
||||
The primary and secondary synchronization of the database ({{ $d.ip }}) is inconsistent, please check in time.
|
||||
|
||||
{{ range $status := $d.status }}
|
||||
Database {{$status.ip}} status:
|
||||
{{- if not $status.operator_error }}
|
||||
- Slave_IO_Running: {{$status.slave_io_running}}
|
||||
- Slave_SQL_Running: {{$status.slave_sql_running}}
|
||||
{{- if $status.last_error }}
|
||||
- Last_Error: {{$status.last_error}}
|
||||
{{- end -}}
|
||||
{{- if $status.last_io_error }}
|
||||
- Last_IO_Error: {{$status.last_io_error}}
|
||||
{{- end }}
|
||||
{{else}}
|
||||
- Operator_Error: {{$status.operator_error}}
|
||||
{{- end}}
|
||||
{{end}}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
{{ $d.service_name }}: The network topology information of the service is inconsistent, please check in time.
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
{{ $d.account }}:Your password is valid and will expire soon. Please log in to the platform in time to update your password.
|
||||
@@ -0,0 +1,8 @@
|
||||
{{- $d := .resource_details -}}
|
||||
Service: {{ $d.service_name }} abnormal
|
||||
Method: {{ $d.method }}
|
||||
Path: {{ $d.path }}
|
||||
{{- if $d.body }}
|
||||
Body: {{ $d.body -}}
|
||||
{{ end }}
|
||||
Error: {{ $d.error }}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
The account {{ $d.name }} status is abnormal. Please check in time.
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
The service: {{ d.service_name}} worker has been block 30 minutes.Please verify the service in time.
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
数据库 {{$d.ip}} 的主从同步不一致,请及时检查。
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
{{ $d.service_name }}服务的网络拓扑信息同步不一致,请及时检查。
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
{{ $d.account }}:您的密码有效期将过,请及时登录平台更新密码。
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
服务{{ $d.service_name }}异常
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
云账号{{ $d.name}}状态异常,请及时检查。
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
服务{{ d.service_name}} worker阻塞半小时,请及时检查。
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
The primary and secondary synchronization of the database ({{ $d.ip }}) is inconsistent, please check in time.
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
{{ $d.service_name }}: The network topology information of the service is inconsistent, please check in time.
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
{{ $d.account }}:Your password is valid and will expire soon. Please log in to the platform in time to update your password.
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
Server {{ $d.service_name }} abnormal
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
The account {{ $d.name }} has been locked due to abnormal login. Please verify the situation. If you need to unlock the user, please go to the user list to enable the user.
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
The service: {{ d.service_name}} worker has been block 30 minutes.Please verify the service in time.
|
||||
@@ -33,13 +33,13 @@ import (
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/httputils"
|
||||
"yunion.io/x/pkg/util/version"
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/promputils"
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/util/httputils"
|
||||
)
|
||||
|
||||
type BaseOptions struct {
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
package ansible
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
package cloudevent
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
package cloudid
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
package cloudnet
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -16,9 +16,9 @@ package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -42,7 +42,7 @@ func init() {
|
||||
if len(args.Network) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Network), "network_id")
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
var err error
|
||||
if len(args.Host) > 0 {
|
||||
result, err = modules.Baremetalnetworks.ListDescendent(s, args.Host, params)
|
||||
|
||||
@@ -16,9 +16,9 @@ package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -38,7 +38,7 @@ func init() {
|
||||
|
||||
}
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
var err error
|
||||
if len(args.Host) > 0 {
|
||||
result, err = modules.Baremetalstorages.ListDescendent(s, args.Host, params)
|
||||
|
||||
@@ -21,10 +21,10 @@ import (
|
||||
|
||||
"yunion.io/x/cloudmux/pkg/multicloud/objectstore"
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -142,7 +142,7 @@ func init() {
|
||||
return err
|
||||
}
|
||||
|
||||
listResult := modulebase.ListResult{}
|
||||
listResult := printutils.ListResult{}
|
||||
err = result.Unmarshal(&listResult)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -39,6 +39,7 @@ func init() {
|
||||
cmd.CreateWithKeyword("create-huawei", &options.SHuaweiCloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyword("create-hcso", &options.SHCSOAccountCreateOptions{})
|
||||
cmd.CreateWithKeyword("create-hcs", &options.SHCSAccountCreateOptions{})
|
||||
cmd.CreateWithKeyword("create-hcsop", &options.SHcsOpCloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyword("create-ucloud", &options.SUcloudCloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyword("create-zstack", &options.SZStackCloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyword("create-s3", &options.SS3CloudAccountCreateOptions{})
|
||||
@@ -64,7 +65,7 @@ func init() {
|
||||
cmd.UpdateWithKeyword("update-openstack", &options.SOpenStackCloudAccountUpdateOptions{})
|
||||
cmd.UpdateWithKeyword("update-huawei", &options.SHuaweiCloudAccountUpdateOptions{})
|
||||
cmd.UpdateWithKeyword("update-hcso", &options.SHCSOAccountUpdateOptions{})
|
||||
cmd.UpdateWithKeyword("update-hcs", &options.SHCSOAccountUpdateOptions{})
|
||||
cmd.UpdateWithKeyword("update-hcs", &options.SHCSAccountUpdateOptions{})
|
||||
cmd.UpdateWithKeyword("update-ucloud", &options.SUcloudCloudAccountUpdateOptions{})
|
||||
cmd.UpdateWithKeyword("update-zstack", &options.SZStackCloudAccountUpdateOptions{})
|
||||
cmd.UpdateWithKeyword("update-s3", &options.SS3CloudAccountUpdateOptions{})
|
||||
|
||||
@@ -16,9 +16,9 @@ package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -40,7 +40,7 @@ func init() {
|
||||
|
||||
}
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
var err error
|
||||
if len(args.Manager) > 0 {
|
||||
result, err = modules.CloudproviderregionManager.ListDescendent(s, args.Manager, params)
|
||||
|
||||
@@ -18,10 +18,10 @@ import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -104,7 +104,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
listResult := modulebase.ListResult{}
|
||||
listResult := printutils.ListResult{}
|
||||
listResult.Data, err = results.GetArray()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -122,7 +122,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
listResult := modulebase.ListResult{}
|
||||
listResult := printutils.ListResult{}
|
||||
listResult.Data, err = results.GetArray()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -140,7 +140,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
listResult := modulebase.ListResult{}
|
||||
listResult := printutils.ListResult{}
|
||||
listResult.Data, err = results.GetArray()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options/compute"
|
||||
@@ -55,7 +56,7 @@ func init() {
|
||||
return err
|
||||
}
|
||||
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
if len(opts.DBInstance) > 0 {
|
||||
result, err = modules.DBInstanceNetworks.ListDescendent(s, opts.DBInstance, params)
|
||||
} else if len(opts.Network) > 0 {
|
||||
|
||||
@@ -29,13 +29,13 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/httputils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
compute_options "yunion.io/x/onecloud/pkg/mcclient/options/compute"
|
||||
"yunion.io/x/onecloud/pkg/util/httputils"
|
||||
"yunion.io/x/onecloud/pkg/util/sparsefile"
|
||||
)
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -39,7 +39,7 @@ func init() {
|
||||
|
||||
}
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
var err error
|
||||
if len(args.Host) > 0 {
|
||||
result, err = modules.Hostcachedimages.ListDescendent(s, args.Host, params)
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/httputils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
@@ -29,7 +30,6 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options/compute"
|
||||
"yunion.io/x/onecloud/pkg/util/fileutils2"
|
||||
"yunion.io/x/onecloud/pkg/util/httputils"
|
||||
"yunion.io/x/onecloud/pkg/util/ssh"
|
||||
)
|
||||
|
||||
@@ -174,6 +174,8 @@ func init() {
|
||||
IpmiIpAddr string `help:"IPMI ip_addr"`
|
||||
|
||||
Sn string `help:"serial number"`
|
||||
|
||||
Hostname string `help:"update host name"`
|
||||
}
|
||||
R(&HostUpdateOptions{}, "host-update", "Update information of a host", func(s *mcclient.ClientSession, args *HostUpdateOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
|
||||
@@ -16,9 +16,9 @@ package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -39,7 +39,7 @@ func init() {
|
||||
|
||||
}
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
var err error
|
||||
// if len(args.Storage) > 0 {
|
||||
// params.Add(jsonutils.NewString(args.Storage), "storage")
|
||||
|
||||
@@ -16,9 +16,9 @@ package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -39,7 +39,7 @@ func init() {
|
||||
|
||||
}
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
var err error
|
||||
if len(args.Host) > 0 {
|
||||
result, err = modules.Hostwires.ListDescendent(s, args.Host, params)
|
||||
|
||||
@@ -16,9 +16,9 @@ package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
baseoptions "yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/compute"
|
||||
@@ -53,7 +53,7 @@ func init() {
|
||||
}
|
||||
printObject(jd)
|
||||
}
|
||||
printLbAclList := func(list *modulebase.ListResult, columns []string) {
|
||||
printLbAclList := func(list *printutils.ListResult, columns []string) {
|
||||
data := list.Data
|
||||
for _, jsonObj := range data {
|
||||
jd := jsonObj.(*jsonutils.JSONDict)
|
||||
|
||||
@@ -16,9 +16,9 @@ package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/compute"
|
||||
)
|
||||
@@ -52,7 +52,7 @@ func init() {
|
||||
}
|
||||
printObject(jd)
|
||||
}
|
||||
printLbAclList := func(list *modulebase.ListResult, columns []string) {
|
||||
printLbAclList := func(list *printutils.ListResult, columns []string) {
|
||||
data := list.Data
|
||||
for _, jsonObj := range data {
|
||||
jd := jsonObj.(*jsonutils.JSONDict)
|
||||
|
||||
@@ -18,9 +18,9 @@ import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/compute"
|
||||
)
|
||||
@@ -34,7 +34,7 @@ func printLbBackendStatus(backendStatus jsonutils.JSONObject) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
listResult := &modulebase.ListResult{
|
||||
listResult := &printutils.ListResult{
|
||||
Data: objList,
|
||||
}
|
||||
columns := []string{
|
||||
|
||||
@@ -16,9 +16,9 @@ package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -43,7 +43,7 @@ func init() {
|
||||
if len(args.Ip) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Ip), "ip_addr")
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
var err error
|
||||
if len(args.Loadbalancer) > 0 {
|
||||
result, err = modules.Loadbalancernetworks.ListDescendent(s, args.Loadbalancer, params)
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
@@ -55,7 +57,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
listResult := modulebase.ListResult{}
|
||||
listResult := printutils.ListResult{}
|
||||
err = result.Unmarshal(&listResult)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
33
cmd/climc/shell/compute/network_ip_mac.go
Normal file
33
cmd/climc/shell/compute/network_ip_mac.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
cmd := shell.NewResourceCmd(&modules.NetworkIpMacs)
|
||||
cmd.List(&options.NetworkIpMacListOptions{})
|
||||
cmd.Update(&options.NetworkIpMacUpdateOptions{})
|
||||
cmd.Show(&options.NetworkIpMacIdOptions{})
|
||||
cmd.Delete(&options.NetworkIpMacIdOptions{})
|
||||
cmd.Create(&options.NetworkIpMacCreateOptions{})
|
||||
type NetworkIpMacBatchCreateOptions struct {
|
||||
NETWORK string `help:"network id" json:"network_id"`
|
||||
IpMac map[string]string `help:"ip mac map" json:"ip_mac"`
|
||||
}
|
||||
R(&NetworkIpMacBatchCreateOptions{},
|
||||
"network-ip-mac-batch-create",
|
||||
"Network ip mac bind batch create",
|
||||
func(s *mcclient.ClientSession, args *NetworkIpMacBatchCreateOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
_, err := modules.NetworkIpMacs.PerformClassAction(s, "batch-create", params)
|
||||
return err
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -16,9 +16,9 @@ package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
)
|
||||
|
||||
@@ -30,7 +30,7 @@ func init() {
|
||||
}
|
||||
R(&NetworkinterfaceNetworkListOptions{}, "networkinterface-network-list", "List server network pairs", func(s *mcclient.ClientSession, args *NetworkinterfaceNetworkListOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
var err error
|
||||
if len(args.Networkinterface) > 0 {
|
||||
result, err = modules.Networkinterfacenetworks.ListDescendent(s, args.Networkinterface, params)
|
||||
|
||||
@@ -18,11 +18,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -226,7 +226,7 @@ func init() {
|
||||
fmt.Println("no result")
|
||||
return nil
|
||||
}
|
||||
listResult := modulebase.ListResult{Data: addrList}
|
||||
listResult := printutils.ListResult{Data: addrList}
|
||||
printList(&listResult, nil)
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -17,6 +17,8 @@ package compute
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
@@ -54,7 +56,7 @@ func (h *schedtagModelHelper) list(slave modulebase.Manager, kw string) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
if len(args.Schedtag) > 0 {
|
||||
result, err = mod.ListDescendent(s, args.Schedtag, params)
|
||||
} else {
|
||||
|
||||
@@ -18,9 +18,9 @@ import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -45,7 +45,7 @@ func init() {
|
||||
if args.Index >= 0 {
|
||||
params.Add(jsonutils.NewInt(args.Index), "index")
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
var err error
|
||||
if len(args.Server) > 0 {
|
||||
result, err = modules.Serverdisks.ListDescendent(s, args.Server, params)
|
||||
|
||||
@@ -19,12 +19,12 @@ import (
|
||||
"strconv"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
"yunion.io/x/pkg/util/regutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/cmdline"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -53,7 +53,7 @@ func init() {
|
||||
if len(args.Ip) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Ip), "ip_addr")
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
var err error
|
||||
if len(args.Server) > 0 {
|
||||
result, err = modules.Servernetworks.ListDescendent(s, args.Server, params)
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/apis/compute"
|
||||
@@ -55,7 +56,8 @@ func init() {
|
||||
cmd.BatchPerform("sync", new(options.ServerIdsOptions))
|
||||
cmd.Perform("switch-to-backup", new(options.ServerSwitchToBackupOptions))
|
||||
cmd.BatchPerform("reconcile-backup", new(options.ServerIdsOptions))
|
||||
cmd.BatchPerform("create-backup", new(options.ServerIdsOptions))
|
||||
cmd.Perform("create-backup", new(options.ServerCreateBackupOptions))
|
||||
cmd.BatchPerform("start-backup", new(options.ServerIdsOptions))
|
||||
cmd.Perform("delete-backup", new(options.ServerDeleteBackupOptions))
|
||||
cmd.BatchPerform("stop", new(options.ServerStopOptions))
|
||||
cmd.BatchPerform("suspend", new(options.ServerIdsOptions))
|
||||
@@ -161,7 +163,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
listResult := modulebase.ListResult{}
|
||||
listResult := printutils.ListResult{}
|
||||
listResult.Data = tasks
|
||||
printList(&listResult, nil)
|
||||
return nil
|
||||
@@ -620,7 +622,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
listResult := modulebase.ListResult{}
|
||||
listResult := printutils.ListResult{}
|
||||
listResult.Data, _ = result.GetArray()
|
||||
printList(&listResult, nil)
|
||||
return nil
|
||||
|
||||
@@ -16,9 +16,9 @@ package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -39,7 +39,7 @@ func init() {
|
||||
|
||||
}
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
var err error
|
||||
if len(args.Server) > 0 {
|
||||
result, err = modules.Serversecgroups.ListDescendent(s, args.Server, params)
|
||||
|
||||
@@ -18,9 +18,9 @@ import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -130,7 +130,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
data := &modulebase.ListResult{Data: hosts, Total: len(hosts)}
|
||||
data := &printutils.ListResult{Data: hosts, Total: len(hosts)}
|
||||
printList(data, []string{"ID", "Name", "Mem", "CPU", "Storage_Info"})
|
||||
return nil
|
||||
})
|
||||
@@ -168,7 +168,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
data := &modulebase.ListResult{Data: devs, Total: len(devs)}
|
||||
data := &printutils.ListResult{Data: devs, Total: len(devs)}
|
||||
printList(data, []string{"ID", "Addr", "Dev_Type", "Model", "Vendor_Device_Id"})
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -16,9 +16,9 @@ package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -39,7 +39,7 @@ func init() {
|
||||
|
||||
}
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
var err error
|
||||
if len(args.Storagecache) > 0 {
|
||||
result, err = modules.Storagecachedimages.ListDescendent(s, args.Storagecache, params)
|
||||
|
||||
@@ -16,9 +16,9 @@ package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -36,7 +36,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
if len(args.Region) > 0 {
|
||||
result, err = modules.Zones.ListInContext(s, params, &modules.Cloudregions, args.Region)
|
||||
} else {
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
package devtool
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -19,9 +19,9 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/ansible"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/devtool"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
@@ -55,7 +55,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
result, err = modules.DevToolCronjobs.List(s, params)
|
||||
printList(result, modules.DevToolCronjobs.GetColumns(s))
|
||||
return nil
|
||||
|
||||
@@ -17,9 +17,9 @@ package devtool
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/devtool"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -48,7 +48,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
result, err = modules.DevToolTemplates.List(s, params)
|
||||
printList(result, modules.DevToolTemplates.GetColumns(s))
|
||||
return nil
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
package etcd
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/etcd"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
package events
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -20,11 +20,11 @@ import (
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
type ResourceCmd struct {
|
||||
@@ -142,7 +142,7 @@ func (cmd ResourceCmd) List(args IListOpt) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
contextId := args.GetContextId()
|
||||
if cmd.contextManager != nil && len(contextId) > 0 {
|
||||
result, err = man.(modulebase.Manager).ListInContext(s, params, cmd.contextManager.(modulebase.Manager), contextId)
|
||||
@@ -242,7 +242,7 @@ func (cmd ResourceCmd) GetProperty(args IPropertyOpt) {
|
||||
}
|
||||
if _, ok := ret.(*jsonutils.JSONArray); ok {
|
||||
data, _ := ret.GetArray()
|
||||
PrintList(&modulebase.ListResult{
|
||||
PrintList(&printutils.ListResult{
|
||||
Data: data,
|
||||
}, nil)
|
||||
} else {
|
||||
@@ -634,7 +634,7 @@ func (cmd JointCmd) List(args IJointListOpt) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
if len(args.GetMasterOpt()) > 0 {
|
||||
result, err = man.ListDescendent(s, args.GetMasterOpt(), params)
|
||||
} else if len(args.GetSlaveOpt()) > 0 {
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
package identity
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -18,9 +18,9 @@ import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/identity"
|
||||
)
|
||||
|
||||
@@ -65,7 +65,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result := modulebase.ListResult{}
|
||||
result := printutils.ListResult{}
|
||||
result.Data = make([]jsonutils.JSONObject, len(secrets))
|
||||
for i := range secrets {
|
||||
result.Data[i] = secrets[i].Marshal()
|
||||
|
||||
@@ -19,9 +19,9 @@ import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/identity"
|
||||
)
|
||||
|
||||
@@ -207,7 +207,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result := modulebase.ListResult{}
|
||||
result := printutils.ListResult{}
|
||||
result.Data = make([]jsonutils.JSONObject, len(secrets))
|
||||
for i := range secrets {
|
||||
result.Data[i] = jsonutils.Marshal(secrets[i])
|
||||
@@ -294,7 +294,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result := modulebase.ListResult{}
|
||||
result := printutils.ListResult{}
|
||||
result.Data = make([]jsonutils.JSONObject, len(secrets))
|
||||
for i := range secrets {
|
||||
result.Data[i] = jsonutils.Marshal(secrets[i])
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/shellutils"
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/identity"
|
||||
"yunion.io/x/onecloud/pkg/httperrors"
|
||||
@@ -26,7 +27,6 @@ import (
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/identity"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
"yunion.io/x/onecloud/pkg/util/fileutils2"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -23,6 +23,8 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/util/rbacscope"
|
||||
"yunion.io/x/pkg/util/shellutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
api "yunion.io/x/onecloud/pkg/apis/identity"
|
||||
@@ -35,7 +37,6 @@ import (
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/identity"
|
||||
"yunion.io/x/onecloud/pkg/util/fileutils2"
|
||||
"yunion.io/x/onecloud/pkg/util/rbacutils"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
"yunion.io/x/onecloud/pkg/util/tagutils"
|
||||
)
|
||||
|
||||
@@ -402,7 +403,7 @@ func init() {
|
||||
}
|
||||
R(&PolicyAdminCapableOptions{}, "policy-admin-capable", "Check admin capable", func(s *mcclient.ClientSession, args *PolicyAdminCapableOptions) error {
|
||||
auth.InitFromClientSession(s)
|
||||
policy.EnableGlobalRbac(15*time.Second, false)
|
||||
policy.EnableGlobalRbac(15*time.Second, false, 1)
|
||||
|
||||
var token mcclient.TokenCredential
|
||||
if len(args.User) > 0 {
|
||||
@@ -420,12 +421,12 @@ func init() {
|
||||
|
||||
fmt.Println("Token", token)
|
||||
|
||||
for _, scope := range []rbacutils.TRbacScope{
|
||||
rbacutils.ScopeSystem,
|
||||
rbacutils.ScopeDomain,
|
||||
rbacutils.ScopeProject,
|
||||
rbacutils.ScopeUser,
|
||||
rbacutils.ScopeNone,
|
||||
for _, scope := range []rbacscope.TRbacScope{
|
||||
rbacscope.ScopeSystem,
|
||||
rbacscope.ScopeDomain,
|
||||
rbacscope.ScopeProject,
|
||||
rbacscope.ScopeUser,
|
||||
rbacscope.ScopeNone,
|
||||
} {
|
||||
fmt.Printf("%s: ", scope)
|
||||
capable := policy.PolicyManager.IsScopeCapable(token, scope)
|
||||
@@ -456,7 +457,7 @@ func init() {
|
||||
rbacutils.ShowMatchRuleDebug = true
|
||||
}
|
||||
auth.InitFromClientSession(s)
|
||||
policy.EnableGlobalRbac(15*time.Second, false)
|
||||
policy.EnableGlobalRbac(15*time.Second, false, 1)
|
||||
if args.Debug {
|
||||
consts.EnableRbacDebug()
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@ import (
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/shellutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/identity"
|
||||
"yunion.io/x/onecloud/pkg/util/fileutils2"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
package image
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -23,10 +23,10 @@ import (
|
||||
"github.com/cheggaaa/pb/v3"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/identity"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/image"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
@@ -412,7 +412,7 @@ func init() {
|
||||
continue
|
||||
}
|
||||
arrays, _ := result.(*jsonutils.JSONArray).GetArray()
|
||||
listResult := modulebase.ListResult{Data: arrays}
|
||||
listResult := printutils.ListResult{Data: arrays}
|
||||
printList(&listResult, []string{})
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -23,12 +23,12 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/shellutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
|
||||
o "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
)
|
||||
|
||||
func initKubeCluster() {
|
||||
|
||||
@@ -18,12 +18,12 @@ import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
|
||||
o "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -23,9 +23,9 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
|
||||
)
|
||||
|
||||
@@ -56,7 +56,7 @@ func getPrinterRowValues(printer k8s.ListPrinter, obj jsonutils.JSONObject, cols
|
||||
return ret
|
||||
}
|
||||
|
||||
func ListerTable(res *modulebase.ListResult, printer k8s.ListPrinter, s *mcclient.ClientSession) *uitable.Table {
|
||||
func ListerTable(res *printutils.ListResult, printer k8s.ListPrinter, s *mcclient.ClientSession) *uitable.Table {
|
||||
min := func(x, y int) int {
|
||||
if x < y {
|
||||
return x
|
||||
@@ -78,7 +78,7 @@ func ListerTable(res *modulebase.ListResult, printer k8s.ListPrinter, s *mcclien
|
||||
return table
|
||||
}
|
||||
|
||||
func PrintListResultTable(res *modulebase.ListResult, printer k8s.ListPrinter, s *mcclient.ClientSession) {
|
||||
func PrintListResultTable(res *printutils.ListResult, printer k8s.ListPrinter, s *mcclient.ClientSession) {
|
||||
fmt.Println(ListerTable(res, printer, s))
|
||||
|
||||
table := uitable.New()
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
package misc
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -47,6 +47,7 @@ func init() {
|
||||
"apsara",
|
||||
"cloudpods",
|
||||
"hcso",
|
||||
"hcsop",
|
||||
"hcs",
|
||||
"nutanix",
|
||||
"s3",
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"yunion.io/x/cloudmux/pkg/cloudprovider"
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
@@ -67,7 +68,7 @@ func init() {
|
||||
return err
|
||||
}
|
||||
data, _ := body.GetArray("workers")
|
||||
printList(&modulebase.ListResult{Data: data}, nil)
|
||||
printList(&printutils.ListResult{Data: data}, nil)
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
32
cmd/climc/shell/misc/vpcagent.go
Normal file
32
cmd/climc/shell/misc/vpcagent.go
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package misc
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/vpcagent"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type VpcAgentSyncOptions struct {
|
||||
}
|
||||
R(&VpcAgentSyncOptions{}, "vpcagent-sync", "Invoke sync of vpcagent", func(s *mcclient.ClientSession, args *VpcAgentSyncOptions) error {
|
||||
err := vpcagent.VpcAgent.DoSync(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -15,9 +15,10 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
monitorapi "yunion.io/x/onecloud/pkg/apis/monitor"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/monitor"
|
||||
)
|
||||
@@ -34,7 +35,7 @@ func initAlertNotification() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
if len(args.Alert) > 0 {
|
||||
result, err = monitor.Alertnotification.ListDescendent(s, args.Alert, params)
|
||||
} else if len(args.Notification) > 0 {
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
package notifyv2
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
package quota
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -19,13 +19,13 @@ import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
apis "yunion.io/x/onecloud/pkg/apis/scheduledtask"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/scheduledtask"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
package scheduler
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -21,10 +21,9 @@ import (
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
"yunion.io/x/onecloud/pkg/util/excelutils"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -41,7 +40,7 @@ func OutputFormat(s string) {
|
||||
outputFormat = s
|
||||
}
|
||||
|
||||
func PrintList(list *modulebase.ListResult, columns []string) {
|
||||
func PrintList(list *printutils.ListResult, columns []string) {
|
||||
switch outputFormat {
|
||||
case OUTPUT_FORMAT_TABLE:
|
||||
printutils.PrintJSONList(list, columns)
|
||||
@@ -103,11 +102,11 @@ func printObjectRecursiveEx(obj jsonutils.JSONObject, cb printutils.PrintJSONObj
|
||||
printutils.PrintJSONObjectRecursiveEx(obj, cb)
|
||||
}
|
||||
|
||||
func printBatchResults(results []modulebase.SubmitResult, columns []string) {
|
||||
func printBatchResults(results []printutils.SubmitResult, columns []string) {
|
||||
printutils.PrintJSONBatchResults(results, columns)
|
||||
}
|
||||
|
||||
func ExportList(list *modulebase.ListResult, file string, exportKeys string, exportTexts string, columns []string) {
|
||||
func ExportList(list *printutils.ListResult, file string, exportKeys string, exportTexts string, columns []string) {
|
||||
var keys []string
|
||||
var texts []string
|
||||
if len(exportKeys) > 0 {
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
package yunionconf
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -16,13 +16,13 @@ package yunionconf
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
"yunion.io/x/pkg/util/shellutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/identity"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/yunionconf"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -44,7 +44,7 @@ func init() {
|
||||
params.Add(jsonutils.NewString(args.Name), "name")
|
||||
}
|
||||
|
||||
var result *modulebase.ListResult
|
||||
var result *printutils.ListResult
|
||||
if len(args.NamespaceId) > 0 {
|
||||
params.Add(jsonutils.NewString(args.NamespaceId), "namespace_id")
|
||||
params.Add(jsonutils.NewString("system"), "scope")
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "yunion.io/x/cloudmux/pkg/multicloud/loader"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudevent/service"
|
||||
_ "yunion.io/x/onecloud/pkg/mcclient/cloudpods/provider"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "yunion.io/x/cloudmux/pkg/multicloud/loader"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/service"
|
||||
_ "yunion.io/x/onecloud/pkg/mcclient/cloudpods/provider"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
153
cmd/cloudpodscli/main.go
Normal file
153
cmd/cloudpodscli/main.go
Normal file
@@ -0,0 +1,153 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/cloudmux/pkg/cloudprovider"
|
||||
"yunion.io/x/pkg/util/shellutils"
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient/cloudpods"
|
||||
_ "yunion.io/x/onecloud/pkg/mcclient/cloudpods/shell"
|
||||
)
|
||||
|
||||
type BaseOptions struct {
|
||||
Debug bool `help:"debug mode"`
|
||||
AuthURL string `help:"Auth URL" default:"$CLOUDPODS_AUTH_URL" metavar:"CLOUDPODS_AUTH_URL"`
|
||||
AccessKey string `help:"AccessKey" default:"$CLOUDPODS_ACCESS_KEY" metavar:"CLOUDPODS_ACCESS_KEY"`
|
||||
AccessSecret string `help:"AccessSecret" default:"$CLOUDPODS_ACCESS_SECRET" metavar:"CLOUDPODS_ACCESS_SECRET"`
|
||||
RegionId string `help:"RegionId" default:"$CLOUDPODS_REGION_ID|default" metavar:"CLOUDPODS_REGION_ID"`
|
||||
SUBCOMMAND string `help:"cloudpodscli subcommand" subcommand:"true"`
|
||||
}
|
||||
|
||||
func getSubcommandParser() (*structarg.ArgumentParser, error) {
|
||||
parse, err := structarg.NewArgumentParserWithHelp(&BaseOptions{},
|
||||
"cloudpodscli",
|
||||
"Command-line interface to cloudpods API.",
|
||||
`See "cloudpodscli COMMAND --help" for help on a specific command.`)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
subcmd := parse.GetSubcommand()
|
||||
if subcmd == nil {
|
||||
return nil, fmt.Errorf("No subcommand argument.")
|
||||
}
|
||||
for _, v := range shellutils.CommandTable {
|
||||
_, err = subcmd.AddSubParserWithHelp(v.Options, v.Command, v.Desc, v.Callback)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return parse, nil
|
||||
}
|
||||
|
||||
func showErrorAndExit(e error) {
|
||||
fmt.Fprintf(os.Stderr, "%s", e)
|
||||
fmt.Fprintln(os.Stderr)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func newClient(options *BaseOptions) (*cloudpods.SRegion, error) {
|
||||
if len(options.AuthURL) == 0 {
|
||||
return nil, fmt.Errorf("Missing AuthURL")
|
||||
}
|
||||
|
||||
if len(options.AccessKey) == 0 {
|
||||
return nil, fmt.Errorf("Missing access key")
|
||||
}
|
||||
|
||||
if len(options.AccessSecret) == 0 {
|
||||
return nil, fmt.Errorf("Missing access secret")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cli, err := cloudpods.NewCloudpodsClient(
|
||||
cloudpods.NewCloudpodsClientConfig(
|
||||
options.AuthURL,
|
||||
options.AccessKey,
|
||||
options.AccessSecret,
|
||||
).Debug(options.Debug).
|
||||
CloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
region, err := cli.GetRegion(options.RegionId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return region, nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
parser, err := getSubcommandParser()
|
||||
if err != nil {
|
||||
showErrorAndExit(err)
|
||||
}
|
||||
err = parser.ParseArgs(os.Args[1:], false)
|
||||
options := parser.Options().(*BaseOptions)
|
||||
|
||||
if parser.IsHelpSet() {
|
||||
fmt.Print(parser.HelpString())
|
||||
return
|
||||
}
|
||||
subcmd := parser.GetSubcommand()
|
||||
subparser := subcmd.GetSubParser()
|
||||
if err != nil || subparser == nil {
|
||||
if subparser != nil {
|
||||
fmt.Print(subparser.Usage())
|
||||
} else {
|
||||
fmt.Print(parser.Usage())
|
||||
}
|
||||
showErrorAndExit(err)
|
||||
return
|
||||
}
|
||||
suboptions := subparser.Options()
|
||||
if subparser.IsHelpSet() {
|
||||
fmt.Print(subparser.HelpString())
|
||||
return
|
||||
}
|
||||
var region *cloudpods.SRegion
|
||||
region, err = newClient(options)
|
||||
if err != nil {
|
||||
showErrorAndExit(err)
|
||||
}
|
||||
err = subcmd.Invoke(region, suboptions)
|
||||
if err != nil {
|
||||
showErrorAndExit(err)
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,10 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"yunion.io/x/pkg/util/shellutils"
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
_ "yunion.io/x/onecloud/cmd/cryptool/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
)
|
||||
|
||||
type BaseOptions struct {
|
||||
|
||||
@@ -17,9 +17,8 @@ package shell
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/pkg/util/shellutils"
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -35,4 +34,18 @@ func init() {
|
||||
fmt.Println(text)
|
||||
return nil
|
||||
})
|
||||
|
||||
type EncryptSecretOptions struct {
|
||||
KEY string `help:"secret key"`
|
||||
SECRET string `help:"secret to enscrypt"`
|
||||
}
|
||||
shellutils.R(&EncryptSecretOptions{}, "encrypt", "Encrypt", func(args *EncryptSecretOptions) error {
|
||||
text, err := utils.EncryptAESBase64(args.KEY, args.SECRET)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(text)
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -17,11 +17,11 @@ package shell
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/pkg/util/shellutils"
|
||||
"yunion.io/x/pkg/util/timeutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/keystone/tokens"
|
||||
"yunion.io/x/onecloud/pkg/util/fernetool"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
"yunion.io/x/pkg/util/shellutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/util/zeroclean"
|
||||
)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user