Commit 997b42ee authored by Xavier Guimard's avatar Xavier Guimard

salsa: skip project in update_repo if hooks are not available

parent 8e4b03fd
...@@ -22,6 +22,7 @@ devscripts (2.18.12) UNRELEASED; urgency=medium ...@@ -22,6 +22,7 @@ devscripts (2.18.12) UNRELEASED; urgency=medium
MR: !94 MR: !94
+ Add a --ci-config-path option. MR: !96 + Add a --ci-config-path option. MR: !96
+ push_repo: allow to push even if the project already exists. MR: !97 + push_repo: allow to push even if the project already exists. MR: !97
+ Skip project in update_repo if hooks are not available.
* uscan: * uscan:
+ Fix warning when grouped package is up to date. + Fix warning when grouped package is up to date.
* French translation update. * French translation update.
......
...@@ -16,6 +16,7 @@ sub add_hooks { ...@@ -16,6 +16,7 @@ sub add_hooks {
or $self->config->email or $self->config->email
or $self->config->disable_email) { or $self->config->disable_email) {
my $hooks = $self->enabled_hooks($repo_id); my $hooks = $self->enabled_hooks($repo_id);
return 1 unless (defined $hooks);
# KGB hook (IRC) # KGB hook (IRC)
if ($self->config->kgb or $self->config->disable_kgb) { if ($self->config->kgb or $self->config->disable_kgb) {
unless ($self->config->irc_channel->[0] unless ($self->config->irc_channel->[0]
...@@ -147,7 +148,11 @@ sub enabled_hooks { ...@@ -147,7 +148,11 @@ sub enabled_hooks {
or $self->config->disable_kgb or $self->config->disable_kgb
or $self->config->tagpending or $self->config->tagpending
or $self->config->disable_tagpending) { or $self->config->disable_tagpending) {
$hooks = $self->api->project_hooks($repo_id); $hooks = eval { $self->api->project_hooks($repo_id) };
if ($@) {
ds_warn "Unable to check hooks for project $repo_id";
return undef;
}
foreach (@{$hooks}) { foreach (@{$hooks}) {
$res->{kgb} = { $res->{kgb} = {
id => $_->{id}, id => $_->{id},
......
...@@ -11,6 +11,7 @@ sub get_repo { ...@@ -11,6 +11,7 @@ sub get_repo {
my ($self, $prompt, @reponames) = @_; my ($self, $prompt, @reponames) = @_;
my @repos; my @repos;
if ($self->config->all and @reponames == 0) { if ($self->config->all and @reponames == 0) {
ds_debug "--all is set";
my $projects; my $projects;
# This rule disallow trying to configure all "Debian" projects: # This rule disallow trying to configure all "Debian" projects:
# - Debian id is 2 # - Debian id is 2
......
...@@ -30,6 +30,7 @@ sub _check_repo { ...@@ -30,6 +30,7 @@ sub _check_repo {
return @repos unless (ref $repos[0]); return @repos unless (ref $repos[0]);
foreach my $repo (@repos) { foreach my $repo (@repos) {
my ($id, $name) = @$repo; my ($id, $name) = @$repo;
ds_debug "Checking $name ($id)";
my @err; my @err;
my $project = eval { $self->api->project($id) }; my $project = eval { $self->api->project($id) };
unless ($project) { unless ($project) {
...@@ -57,6 +58,10 @@ sub _check_repo { ...@@ -57,6 +58,10 @@ sub _check_repo {
} }
# Webhooks (from Devscripts::Salsa::Hooks) # Webhooks (from Devscripts::Salsa::Hooks)
my $hooks = $self->enabled_hooks($id); my $hooks = $self->enabled_hooks($id);
unless (defined $hooks) {
ds_warn "Unable to get $name hooks";
next;
}
# KGB # KGB
if ($self->config->kgb and not $hooks->{kgb}) { if ($self->config->kgb and not $hooks->{kgb}) {
push @err, "kgb missing"; push @err, "kgb missing";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment