Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Martin Dinov
POD
Commits
e0cc08e6
Commit
e0cc08e6
authored
1 year ago
by
Szymon Zimnowoda
Browse files
Options
Download
Plain Diff
Merge branch 'sz/fix_pipeline' into 'dev'
fixing pipeline See merge request
!437
parents
535ebb80
a2e30ae3
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
.gitlab-ci.yml
+1
-1
.gitlab-ci.yml
Cargo.toml
+1
-1
Cargo.toml
libpod/src/file_api.rs
+1
-1
libpod/src/file_api.rs
libpod/src/graphql.rs
+2
-2
libpod/src/graphql.rs
libpod/src/plugin_run.rs
+3
-3
libpod/src/plugin_run.rs
libpod/src/user_account.rs
+11
-6
libpod/src/user_account.rs
libpod/src/v5/database_api/item.rs
+2
-2
libpod/src/v5/database_api/item.rs
libpod/src/v5/database_api/search.rs
+2
-2
libpod/src/v5/database_api/search.rs
with
23 additions
and
18 deletions
+23
-18
.gitlab-ci.yml
+
1
-
1
View file @
e0cc08e6
image
:
rust:
latest
image
:
rust:
1.71.1
variables
:
CARGO_HOME
:
$CI_PROJECT_DIR/cargo
...
...
This diff is collapsed.
Click to expand it.
Cargo.toml
+
1
-
1
View file @
e0cc08e6
...
...
@@ -23,4 +23,4 @@ tracing = "0.1.36"
tracing-subscriber
=
{
version
=
"0.3.15"
}
uuid
=
{
version
=
"1.3.3"
,
features
=
[
"fast-rng"
,
"v4"
,
"serde"
]
}
futures
=
"0.3.24"
validator
=
{
version
=
"0.16.0"
,
features
=
["derive"]
}
\ No newline at end of file
validator
=
{
version
=
"0.16.0"
,
features
=
["derive"]
}
This diff is collapsed.
Click to expand it.
libpod/src/file_api.rs
+
1
-
1
View file @
e0cc08e6
...
...
@@ -186,7 +186,7 @@ async fn find_key_and_nonce_by_sha256(tx: &AsyncTx, sha256: &str) -> Result<(Vec
.await
?
;
let
Some
(
search_item
)
=
search_res
.pop_front
()
else
{
return
Err
(
any_error!
{
return
Err
(
any_error!
{
StatusCode
::
NOT_FOUND
,
"Item with sha256={sha256} not found"
,
});
...
...
This diff is collapsed.
Click to expand it.
libpod/src/graphql.rs
+
2
-
2
View file @
e0cc08e6
...
...
@@ -233,13 +233,13 @@ async fn resolve_target_node_names(
EdgeDirection
::
In
=>
schema
.get_in_edges_for_node
(
node_name
),
};
let
Some
(
edges
)
=
edges
else
{
let
Some
(
edges
)
=
edges
else
{
return
Err
(
bad_request!
(
"Node {node_name} have no edges defined in {direction:?} direction"
));
};
let
Some
(
edge_targets
)
=
edges
.get
(
edge_name
)
else
{
let
Some
(
edge_targets
)
=
edges
.get
(
edge_name
)
else
{
return
Err
(
bad_request!
(
"Node {node_name} have no edge {edge_name} defined in {direction:?} direction"
));
...
...
This diff is collapsed.
Click to expand it.
libpod/src/plugin_run.rs
+
3
-
3
View file @
e0cc08e6
...
...
@@ -843,8 +843,8 @@ async fn check_kubernetes_limits(
/// Look for containers for given unique_id, kill them if any exist.
/// Currently it's used for mitigating rate limiting twitter api has.
async
fn
k8s_enforce_unique_instance
(
plugin
:
&
PluginRunItem
)
->
Result
<
()
>
{
let
Some
(
ref
unique_id
)
=
plugin
.unique_id
else
{
return
Ok
(())
let
Some
(
ref
unique_id
)
=
plugin
.unique_id
else
{
return
Ok
(())
;
};
info!
(
...
...
@@ -871,7 +871,7 @@ async fn k8s_enforce_unique_instance(plugin: &PluginRunItem) -> Result<()> {
/// Currently it's used for mitigating rate limiting twitter api has.
async
fn
docker_enforce_unique_instance
(
plugin
:
&
PluginRunItem
)
->
Result
<
()
>
{
let
Some
(
ref
unique_id
)
=
plugin
.unique_id
else
{
return
Ok
(())
return
Ok
(())
;
};
info!
(
...
...
This diff is collapsed.
Click to expand it.
libpod/src/user_account.rs
+
11
-
6
View file @
e0cc08e6
...
...
@@ -145,8 +145,8 @@ pub async fn recover_pod_keys(init_db: &InitDb, body: &RecoverRequest) -> Result
#[instrument(fields(login=
%
body
.
login),
skip_all)]
pub
async
fn
verify
(
init_db
:
&
InitDb
,
body
:
&
RegisterVerifyAccountReq
)
->
Result
<
()
>
{
let
mut
conn
=
shared_state
::
db_connection
(
init_db
)
.await
?
;
let
Some
(
mut
acc
)
=
get_account_from_db
(
&
mut
conn
,
&
body
.login
)
.await
?
else
{
return
Err
(
bad_request!
(
"Account does not exist"
))
let
Some
(
mut
acc
)
=
get_account_from_db
(
&
mut
conn
,
&
body
.login
)
.await
?
else
{
return
Err
(
bad_request!
(
"Account does not exist"
))
;
};
// Account already exists
...
...
@@ -179,8 +179,8 @@ pub async fn resend_verification_mail(
body
:
&
UserAccountCredentials
,
)
->
Result
<
()
>
{
let
mut
conn
=
shared_state
::
db_connection
(
init_db
)
.await
?
;
let
Some
(
mut
acc
)
=
get_account_from_db
(
&
mut
conn
,
&
body
.login
)
.await
?
else
{
return
Err
(
bad_request!
(
"No such account {}"
,
body
.login
));
let
Some
(
mut
acc
)
=
get_account_from_db
(
&
mut
conn
,
&
body
.login
)
.await
?
else
{
return
Err
(
bad_request!
(
"No such account {}"
,
body
.login
));
};
validate_password
(
body
.password
.clone
(),
acc
.item.password_hash
.clone
())
.await
?
;
...
...
@@ -291,7 +291,10 @@ pub async fn open_pod(init_db: &InitDb, body: PodCredentials) -> Result<PodOwner
pub
async
fn
get_example_pod
(
cli
:
&
CliOptions
)
->
Result
<
PodCredentials
>
{
debug!
(
"Going to return example POD credentials"
);
let
(
Some
(
example_owner_key
),
Some
(
example_db_key
))
=
(
&
cli
.owner_key_for_example_data
,
&
cli
.db_key_for_example_data
)
else
{
let
(
Some
(
example_owner_key
),
Some
(
example_db_key
))
=
(
&
cli
.owner_key_for_example_data
,
&
cli
.db_key_for_example_data
,
)
else
{
return
Err
(
internal_error!
(
"No example POD credentials defined"
));
};
...
...
@@ -317,7 +320,9 @@ pub async fn delete_account(
let
mut
conn
=
shared_state
::
db_connection
(
init_db
)
.await
?
;
let
Some
(
acc
)
=
get_account_from_db
(
&
mut
conn
,
&
body
.login
)
.await
?
else
{
return
Err
(
bad_request!
(
"There is no account registered with this email."
));
return
Err
(
bad_request!
(
"There is no account registered with this email."
));
};
validate_password
(
body
.password
.clone
(),
acc
.item.password_hash
.clone
())
.await
?
;
...
...
This diff is collapsed.
Click to expand it.
libpod/src/v5/database_api/item.rs
+
2
-
2
View file @
e0cc08e6
...
...
@@ -303,12 +303,12 @@ async fn handle_delete_items(tx: &AsyncTx, items: &HashSet<ItemId>) -> Result<()
pub
async
fn
delete_edge
(
tx
:
&
AsyncTx
,
payload
:
&
DeleteEdgeReq
)
->
Result
<
()
>
{
for
edge
in
&
payload
.edges
{
let
Some
((
source_type
,
_rowid
))
=
get_type_name_from_id
(
tx
,
&
edge
.source
)
?
else
{
let
Some
((
source_type
,
_rowid
))
=
get_type_name_from_id
(
tx
,
&
edge
.source
)
?
else
{
warn!
(
"Source node with id {} does not exist"
,
edge
.source
);
continue
;
};
let
Some
((
target_type
,
_rowid
))
=
get_type_name_from_id
(
tx
,
&
edge
.target
)
?
else
{
let
Some
((
target_type
,
_rowid
))
=
get_type_name_from_id
(
tx
,
&
edge
.target
)
?
else
{
warn!
(
"Target node with id {} does not exist"
,
edge
.target
);
continue
;
};
...
...
This diff is collapsed.
Click to expand it.
libpod/src/v5/database_api/search.rs
+
2
-
2
View file @
e0cc08e6
...
...
@@ -676,7 +676,7 @@ fn build_search_query_for_edge_to_node<'a>(payload: &SearchEdgeReq) -> Result<Se
};
let
mut
params
:
Vec
<
ToSqlOutput
>
=
vec!
[
payload
.source_id
.to_string
()
.into
()];
params
.extend
(
target_node_query
.params
.into_iter
()
);
params
.extend
(
target_node_query
.params
);
let
node_predicate
=
if
target_node_query
.predicates
.is_empty
()
{
String
::
new
()
...
...
@@ -740,7 +740,7 @@ async fn get_node_names_for_query(
// get node type and rowid from the registry
let
Some
((
item_name
,
rid
))
=
get_type_name_from_id
(
tx
,
id
)
?
else
{
// No such id in the database
return
Ok
(
None
)
return
Ok
(
None
)
;
};
if
is_edge_type
(
&
item_name
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets