Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
8ebb6428
Commit
8ebb6428
authored
1 year ago
by
Georgy Moshkin
Committed by
Yaroslav Dynnikov
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: picodata expel add --user --password-file & --auth-method parameters
parent
dca4eaa0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!895
fix: wrong pico_service password + picodata expel --user
Pipeline
#35246
failed
1 year ago
Stage: test
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cli/args.rs
+26
-4
26 additions, 4 deletions
src/cli/args.rs
src/cli/expel.rs
+29
-21
29 additions, 21 deletions
src/cli/expel.rs
test/conftest.py
+3
-0
3 additions, 0 deletions
test/conftest.py
with
58 additions
and
25 deletions
src/cli/args.rs
+
26
−
4
View file @
8ebb6428
...
...
@@ -315,12 +315,34 @@ pub struct Expel {
pub
instance_id
:
InstanceId
,
#[clap(
long
=
"peer"
,
value_name
=
"[HOST][:PORT]"
,
default_value
=
"localhost:3301"
short
=
'u'
,
long
=
"user"
,
value_name
=
"USER"
,
default_value
=
DEFAULT_USERNAME,
env
=
"PICODATA_USER"
)]
/// The username to connect with. Ignored if provided in `ADDRESS`.
pub
user
:
String
,
#[clap(
short
=
'a'
,
long
=
"auth-type"
,
value_name
=
"METHOD"
,
default_value
=
AuthMethod::ChapSha1
.
as_str(),
)]
/// Address of any instance from the cluster.
/// The preferred authentication method.
pub
auth_method
:
AuthMethod
,
#[clap(long
=
"peer"
,
value_name
=
"[USER@][HOST][:PORT]"
)]
/// Address of any picodata instance of the given cluster. It will be used
/// to redirect the request to the current raft-leader to execute the actual
/// request.
pub
peer_address
:
Address
,
#[clap(long,
env
=
"PICODATA_PASSWORD_FILE"
)]
/// Path to a plain-text file with a password.
/// If this option isn't provided, the password is prompted from the terminal.
pub
password_file
:
Option
<
String
>
,
}
impl
Expel
{
...
...
This diff is collapsed.
Click to expand it.
src/cli/expel.rs
+
29
−
21
View file @
8ebb6428
use
crate
::{
rpc
,
tarantool_main
,
tlog
};
use
crate
::
cli
::
args
;
use
crate
::
cli
::
connect
::
determine_credentials_and_connect
;
use
crate
::
rpc
::
expel
::
Request
as
ExpelRequest
;
use
crate
::
rpc
::
RequestArgs
;
use
crate
::
tarantool_main
;
use
crate
::
tlog
;
use
crate
::
traft
::
error
::
Error
;
use
tarantool
::
fiber
;
use
tarantool
::
network
::
client
::
AsClient
;
use
super
::
args
;
pub
async
fn
tt_expel
(
args
:
args
::
Expel
)
->
Result
<
(),
Error
>
{
let
(
client
,
_
)
=
determine_credentials_and_connect
(
&
args
.peer_address
,
Some
(
&
args
.user
),
args
.password_file
.as_deref
(),
args
.auth_method
,
)
?
;
pub
async
fn
tt_expel
(
args
:
args
::
Expel
)
{
let
req
=
rpc
::
expel
::
Request
{
let
req
=
ExpelRequest
{
cluster_id
:
args
.cluster_id
,
instance_id
:
args
.instance_id
,
instance_id
:
args
.instance_id
.clone
()
,
};
let
res
=
rpc
::
network_call
(
&
format!
(
"{}:{}"
,
args
.peer_address.host
,
args
.peer_address.port
),
&
rpc
::
expel
::
redirect
::
Request
(
req
),
)
.await
;
match
res
{
Ok
(
_
)
=>
{
tlog!
(
Info
,
"Success expel call"
);
std
::
process
::
exit
(
0
);
}
Err
(
e
)
=>
{
tlog!
(
Error
,
"Failed to expel instance: {e}"
);
std
::
process
::
exit
(
-
1
);
}
}
fiber
::
block_on
(
client
.call
(
ExpelRequest
::
PROC_NAME
,
&
req
))
.map_err
(|
e
|
Error
::
other
(
format!
(
"Failed to expel instance: {e}"
)))
?
;
tlog!
(
Info
,
"Instance {} successfully expelled"
,
args
.instance_id
);
Ok
(())
}
pub
fn
main
(
args
:
args
::
Expel
)
->
!
{
...
...
@@ -30,7 +34,11 @@ pub fn main(args: args::Expel) -> ! {
callback_data
:
(
args
,),
callback_data_type
:
(
args
::
Expel
,),
callback_body
:
{
::
tarantool
::
fiber
::
block_on
(
tt_expel
(
args
))
if
let
Err
(
e
)
=
::
tarantool
::
fiber
::
block_on
(
tt_expel
(
args
))
{
tlog!
(
Critical
,
"{e}"
);
std
::
process
::
exit
(
1
);
}
std
::
process
::
exit
(
0
);
}
);
std
::
process
::
exit
(
rc
);
...
...
This diff is collapsed.
Click to expand it.
test/conftest.py
+
3
−
0
View file @
8ebb6428
...
...
@@ -1382,6 +1382,7 @@ class Cluster:
def
expel
(
self
,
target
:
Instance
,
peer
:
Instance
|
None
=
None
):
peer
=
peer
if
peer
else
target
assert
self
.
service_password_file
,
"
cannot expel without pico_service password
"
# fmt: off
command
=
[
...
...
@@ -1389,6 +1390,8 @@ class Cluster:
"
--peer
"
,
peer
.
listen
,
"
--cluster-id
"
,
target
.
cluster_id
,
"
--instance-id
"
,
target
.
instance_id
,
"
--user
"
,
"
pico_service
"
,
"
--password-file
"
,
self
.
service_password_file
,
]
# fmt: on
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment