diff options
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | Dockerfile | 8 | ||||
-rw-r--r-- | docker-compose.yml | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Location.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/UKCouncilWMTS.pm | 1 | ||||
-rwxr-xr-x | script/bootstrap | 7 | ||||
-rw-r--r-- | t/cobrand/cheshireeast.t | 3 |
8 files changed, 20 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 16b8a032b..b858ac0d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ * Unreleased - Admin improvements: - order unsent reports by confirmed date + - Bugfixes + - Application user in Docker container can't install packages. #2914 * v3.0 (4th March 2020) - Security: diff --git a/Dockerfile b/Dockerfile index e3a747ca1..f6bc9436f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,11 +2,15 @@ FROM jgoerzen/debian-base-standard:stretch MAINTAINER sysadmin@mysociety.org ARG DEBIAN_FRONTEND=noninteractive +ARG VERSION_OVERRIDE RUN apt-get -qq update \ - && apt-get -qq -y install ca-certificates \ + && apt-get -qq -y install ca-certificates sudo \ && wget -O install-site.sh --no-verbose https://raw.githubusercontent.com/mysociety/commonlib/master/bin/install-site.sh \ - && chmod +x /install-site.sh + && chmod +x /install-site.sh \ + && echo 'fms ALL=(ALL) NOPASSWD: /var/www/fixmystreet/fixmystreet/bin/install_packages' \ + >/etc/sudoers.d/10_fms_install_packages \ + && chmod 0440 /etc/sudoers.d/10_fms_install_packages RUN /install-site.sh --docker fixmystreet fms 127.0.0.1.xip.io \ && apt-get purge -y --auto-remove \ diff --git a/docker-compose.yml b/docker-compose.yml index 80f0b56f1..cc653c922 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,6 +30,7 @@ services: FMS_ROOT: '/var/www/fixmystreet/fixmystreet' SUPERUSER_EMAIL: 'superuser@example.org' SUPERUSER_PASSWORD: '5up3r53cr3t' + SKIP_PACKAGES_INSTALL: networks: default: aliases: diff --git a/perllib/FixMyStreet/App/Controller/Location.pm b/perllib/FixMyStreet/App/Controller/Location.pm index 81c2c33fc..416fb942a 100644 --- a/perllib/FixMyStreet/App/Controller/Location.pm +++ b/perllib/FixMyStreet/App/Controller/Location.pm @@ -112,7 +112,7 @@ sub determine_location_from_pc : Private { # Log failure in a log db try { my $dbfile = FixMyStreet->path_to('../data/analytics.sqlite'); - my $db = DBI->connect("dbi:SQLite:dbname=$dbfile", undef, undef) or die "$DBI::errstr\n"; + my $db = DBI->connect("dbi:SQLite:dbname=$dbfile", undef, undef, { PrintError => 0 }) or die "$DBI::errstr\n"; my $sth = $db->prepare("INSERT INTO location_searches_with_no_results (datetime, cobrand, geocoder, url, user_input) VALUES (?, ?, ?, ?, ?)") or die $db->errstr . "\n"; diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index faa02f9fe..1a300da21 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -1247,7 +1247,7 @@ sub check_for_errors : Private { if ( $c->cobrand->allow_anonymous_reports ) { my $anon_details = $c->cobrand->anonymous_account; $report->user->email(undef) if $report->user->email eq $anon_details->{email}; - $report->name(undef) if $report->name eq $anon_details->{name}; + $report->name(undef) if $report->name && $report->name eq $anon_details->{name}; } return; diff --git a/perllib/FixMyStreet/Map/UKCouncilWMTS.pm b/perllib/FixMyStreet/Map/UKCouncilWMTS.pm index 7e3522714..53b6859bf 100644 --- a/perllib/FixMyStreet/Map/UKCouncilWMTS.pm +++ b/perllib/FixMyStreet/Map/UKCouncilWMTS.pm @@ -45,6 +45,7 @@ sub reproject_from_latlon($$$) { # Reproject a BNG easting/northing into WGS84 lat/lon sub reproject_to_latlon($$$) { my ($self, $x, $y) = @_; + return (0,0) if $x<0 || $y<0; my ($lat, $lon) = Utils::convert_en_to_latlon($x, $y); return ($lat, $lon); } diff --git a/script/bootstrap b/script/bootstrap index 5345b163e..10dc94bdf 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -7,10 +7,13 @@ git submodule --quiet update --init --recursive --rebase # Let's see if we can't work out where we might be running. if cut -d/ -f2 /proc/self/cgroup | sort -u | grep -q docker ; then - # Docker - sudo bin/install_packages docker + if [ -z ${SKIP_PACKAGES_INSTALL:+x} ] ; then + echo "==> Installing Docker packages..." + sudo bin/install_packages docker + fi else # Fallback + echo "==> Installing generic packages..." sudo bin/install_packages generic fi diff --git a/t/cobrand/cheshireeast.t b/t/cobrand/cheshireeast.t index c6c8198ab..4924a96ee 100644 --- a/t/cobrand/cheshireeast.t +++ b/t/cobrand/cheshireeast.t @@ -4,6 +4,9 @@ use FixMyStreet::TestMech; use FixMyStreet::Script::Alerts; use FixMyStreet::Script::Reports; +FixMyStreet::App->log->disable('info'); +END { FixMyStreet::App->log->enable('info'); } + my $mech = FixMyStreet::TestMech->new; my $body = $mech->create_body_ok( 21069, 'Cheshire East Council', { |