Revision 6a016df9 scripts/gnt-cluster
b/scripts/gnt-cluster | ||
---|---|---|
162 | 162 |
@return: the desired exit code |
163 | 163 |
|
164 | 164 |
""" |
165 |
name = args[0] |
|
165 |
cl = GetClient() |
|
166 |
|
|
167 |
(cluster_name, ) = cl.QueryConfigValues(["cluster_name"]) |
|
168 |
|
|
169 |
new_name = args[0] |
|
166 | 170 |
if not opts.force: |
167 |
usertext = ("This will rename the cluster to '%s'. If you are connected" |
|
168 |
" over the network to the cluster name, the operation is very" |
|
169 |
" dangerous as the IP address will be removed from the node" |
|
170 |
" and the change may not go through. Continue?") % name |
|
171 |
usertext = ("This will rename the cluster from '%s' to '%s'. If you are" |
|
172 |
" connected over the network to the cluster name, the" |
|
173 |
" operation is very dangerous as the IP address will be" |
|
174 |
" removed from the node and the change may not go through." |
|
175 |
" Continue?") % (cluster_name, new_name) |
|
171 | 176 |
if not AskUser(usertext): |
172 | 177 |
return 1 |
173 | 178 |
|
174 |
op = opcodes.OpRenameCluster(name=name) |
|
175 |
SubmitOpCode(op, opts=opts) |
|
179 |
op = opcodes.OpRenameCluster(name=new_name) |
|
180 |
result = SubmitOpCode(op, opts=opts, cl=cl) |
|
181 |
|
|
182 |
ToStdout("Cluster renamed from '%s' to '%s'", cluster_name, result) |
|
183 |
|
|
176 | 184 |
return 0 |
177 | 185 |
|
178 | 186 |
|
Also available in: Unified diff