Commit Graph

76 Commits

Author SHA1 Message Date
Dan McGee
6b16b9487a Adjust page and content caching lengths and decorators
Remove never_cache from many places now that we don't actually need it
since we aren't caching by default. Adjust our cache_function decorator
times be shorter values, and also randomize them a bit to make cache
invalidations not all line up.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-05 13:03:00 -06:00
Dan McGee
a60801bb7d PyLint suggested cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-11 19:52:27 -06:00
Dan McGee
e65d2bc6db Switch back to using standard deviation in mirror check page
This got checked in by default, whoops.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-11 19:43:24 -06:00
Dan McGee
c2e84a787a Various small admin touchups
* Don't capitalize things in verbose_name, Django does this
  automatically and uses title case
* Add overrides for IP, URL, ISO, etc.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-07 13:11:52 -06:00
Dan McGee
d80f4236d0 Add package signoffs JSON view
This allows access to the same data (and even a bit more) from the
signoffs overview page in a machine-friendly way.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-10 18:09:19 -06:00
Dan McGee
c692c96ff5 Don't require mirrorlist URLs to have ISOs
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-26 19:18:26 -05:00
Dan McGee
71e57570c2 Pylint suggested and other cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11 19:29:15 -05:00
Dan McGee
c5b370f432 Admin setup tweaks
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22 16:42:06 -05:00
Dan McGee
110c79ad06 Small Python convention fixup
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-16 14:23:57 -05:00
Dan McGee
0f6c80e9a3 mirrors: do protocol formatting in template
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-29 23:34:24 -05:00
Dan McGee
dc9dedaeb0 Add JSON package details and files views
These are retrieved by adding 'json/' to the normal package details or
files view.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14 19:10:16 -05:00
Dan McGee
2fd78dfa00 Allow mirror country field to be persisted to DB as NULL
You need a custom field type in Django to allow this.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14 18:17:22 -05:00
Dan McGee
5fe626c6cc Management command cleanup
Now that we aren't seeing odd segfaults and hung tasks, we can remove
the traceback stuff from the scripts. Also use the 'io' module only, it
has been long enough.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09 16:17:42 -05:00
Dan McGee
1b91de9435 mirrors: pylint discovered cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-18 15:10:20 -05:00
Dan McGee
1e3191ff56 Never parse generated lastsync file
We should be encouraging our mirrors to serve us the original file, not
something they create and come up with.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-18 14:49:28 -05:00
Dan McGee
78a553e558 Add optional country override for individual mirror URLs
This allows a named top-level mirror to have geographically distributed
URLs, e.g. kernel.org and the geo-DNS setup.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-12 18:36:20 -05:00
Dan McGee
6fe08cd689 Utilize Django 1.3 'on_delete' feature on several foreign keys
The most important one here is PROTECT to keep people from making
bone-headed plays and deleting an Arch or Repo and every package along
with it. We can use this in a few other places, as well as some
carefully placed SET_NULL indicators.

Note that nothing here pushes deletion responsibilities down to the
database, although that will probably happen in a future commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-07 17:04:00 -05:00
Dan McGee
f793c413ad Make mirror name and URLs unique
So we don't create duplicates without knowing it in our database, like
we did earlier today.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-05 01:12:23 -05:00
Dan McGee
5df255a5b6 Enhance the mirror details page
Get the URLs with their performance data showing up, and simplify the
top part for non-authenticated users while adding more detail for
logged-in users.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28 18:26:55 -05:00
Dan McGee
5f0916a8df Move country filter last in mirror admin
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28 18:26:23 -05:00
Dan McGee
f29700ce67 Add ordering to mirror protocols
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-03 15:00:36 -06:00
Dan McGee
6d5909ca5d Auto-resolve mirror URLs on save
This prevents people from having to mess with these checkboxes at all in
the admin, and we incur no delay on their initial values being correct
waiting for the cron job to run.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-27 12:44:30 -06:00
Dan McGee
db1524fd64 Auto map the protocol URL field
And perform better validation when doing so.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-27 12:31:12 -06:00
Dan McGee
fc7fc1d10a Slight tweaks to mirror commands
We know we are doing updates when setting IPv4/IPv6 information, so set
force_update to True to save the useless select query on each save(). For
mirror checks, use a less cumbersome deque for the results since it is also
thread-safe, and have all the log entries committed in one go.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-22 15:43:48 -06:00
Dan McGee
b9fdcd0622 Modularize URLs
Make some additional URL config files that can be included so we aren't
trying to do so much in the top level config. This also allows us to
branch a bit more rather than go linear down the rather lengthy list.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-22 15:29:10 -06:00
Dan McGee
0bb5e9fd6d Defer format string substitution to logger
Don't use 'fmtstr % (arg1, arg2)' type format; logger can be passed a format
string and the arguments to populate it. Saves a bit of work for strings
that never end up getting displayed anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 15:10:48 -06:00
Dan McGee
7b969772cc Add a mirror status JSON view
Requested in FS#21144. This should provide most if not all of the data that
was provided on the archlinux.de website, although there are some
differences in what is returned to the user. It is nearly the same data as
that provided in the HTML view, the difference being things are a bit more
machine-friendly and the list is not split into good and bad portions.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 13:58:40 -06:00
Dan McGee
7a320edae1 Move database interaction out of the threaded section
We were seeing a lot of hangs and long-running never-ending processes. This
might be due to some multithreading issues within Django, so move the save()
calls to a loop after the join() on the threads doing the mirror polling.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 13:40:01 -06:00
Dan McGee
1553e2b5c9 Use check count for this URL, not max of all mirrors
Prevents a recently enabled mirror from getting unfairly represented as far
as completion percentage goes.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 01:13:32 -06:00
Dan McGee
5db6522b35 Fix mirror check unicode function
Needed a few self. qualifiers in there.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-07 17:05:44 -06:00
Dan McGee
be3080f912 Don't require country on mirrorlist submission
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-07 11:55:08 -06:00
Dan McGee
3dea0da4a9 Ensure mirrorlist generator works if no status available
Saw this error come through on the live site today, as well as being
reproducible when no mirror check runs have happened in the last 24 hours on
a development machine. Let mirrors that have no available checks show up on
this page, but be sorted last and show a score of unknown.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-11-04 14:29:50 -05:00
Dan McGee
8973ee37c2 Show all mirrors if no IP version specified
I'm eating my words on this one- we don't want to filter to none() if we
don't have an IP version specified, because people hitting the URL without a
ip_version parameter would no longer get any mirrors back. Filter if they
are provided by using a Q() object.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 19:15:50 -05:00
PyroPeter
952ca5f349 Allow filtering of mirrorlist by IP-version
Dan: Use a forms.MultipleChoiceField to match the protocol selection.

Signed-off-by: PyroPeter <abi1789@googlemail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 18:57:38 -05:00
Dan McGee
fe5e460d06 Mirror check script cleanup
Don't import all the constants from logging, just use logging.* instead.
Also, fix some typos that somehow snuck into one of my commits.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 18:44:17 -05:00
PyroPeter
28cc96af28 Add mirrorresolv manage.py command
Dan:
* Fix up some style issues such as spacing between operators
* Ensure one failed lookup doesn't crash the whole script
* Be silent out of the box if there are no errors, just like mirrorcheck

Signed-off-by: PyroPeter <abi1789@googlemail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 18:42:51 -05:00
PyroPeter
c057b079c7 Add has_ipv{4,6} to MirrorUrl
Dan: Add some more useful labels for use in the admin.

Signed-off-by: PyroPeter <abi1789@googlemail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 18:25:54 -05:00
PyroPeter
670aefbb14 Add 'All' choice and make it the default
Signed-off-by: PyroPeter <abi1789@googlemail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 18:14:10 -05:00
Dan McGee
e2612ab3f6 mirrorcheck: catch and handle another socket timeout case
We were seeing processes hang on the Arch server. It looks like there are
ways for socket.timeout to come out of the main check code, so add another
except block to catch this case. In addition, make sure we always call
task_done() even on failures so processes eventually die.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:49:04 -05:00
Dan McGee
82f3b02f60 Factor check completion pct into mirror score
Use it as the divisor in our slightly longer equation.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-07 08:09:07 -05:00
Dan McGee
2e299273e2 mirrorcheck: record duration on file not found errors
On an HTTP 404, FTP 550, or inability to parse the lastsync file, record the
duration of the check even though we couldn't get a time from the mirror.
This allows for these checks to show up as completed but in error, which is
more what.

Previously, inability to parse the date was also recorded as a success, so
change that to be a failure and record an error message with it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-07 08:07:03 -05:00
Dan McGee
ed49122429 Fix an off by one error in math for check interval
Because we are averaging the interval and not the value, we need to subtract
one from the total we are dividing by. Whoops.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-01 18:08:54 -05:00
Dan McGee
ed6fbafb35 Update MirrorProtocol fixture data
Move it to the correct location and add the new field. Also tidy up some of
the instructions dealing with loading this data.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-30 14:36:38 -05:00
Dan McGee
bb84f9c96c Use new is_download field
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-30 14:32:54 -05:00
Dan McGee
3ebe31bdad Add is_download field to mirror protocols
This will replace all the usages of '!= rsync' and 'is ftp or http' we have
in the code with one check on a boolean flag.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-30 14:20:45 -05:00
Dan McGee
2c13364880 Mirror status improvements
* Fix sorting issues. '', 'unknown', and '∞' should now always sort after
  anything else in the list.
* Add a completion percentage column; this will tell you at a glance if a
  mirror is sometimes unresponsive. This should probably be incorporated
  into the mirror score.
* Make a few more things dynamic in the template, like the time back the
  page reflects.
* Add some additional template tags for formatting things.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-30 12:47:30 -05:00
Dan McGee
7def999b0a Fix migration dependencies exposed after moving models
When we moved some models from one app to another, we didn't do anything to
ensure the tables were created at all initially. Enforce this by adding the
minimal required dependencies- those migrations in the 'main' model that
last touched the involved models moving between apps.

Noticed-by: Angel Velasquez <angvp@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-29 15:16:39 -05:00
Dan McGee
bc5a5781bf Add a basic mirror details page
Still some work to do here, but this covers the basics of the public view we
can show for mirrors and their associated data. The upstream and downstream
links should be working OK to aid navigation, but right now we have some
potential dead links for non-authenticated users if they click a link to a
"private" mirror.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-24 19:39:37 -05:00
Dan McGee
1c6099f4b2 Make general mirror list view public
Hide some columns when not logged in because they aren't relevant for the
general public, but this will work nicely as a base page for all of our
known mirrors.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-24 19:39:37 -05:00
Dan McGee
10fca82816 Give more information about mirror check runs and frequency
Show how many times the check has ran in the last 24 hours, as well as the
average interval between checks.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-24 19:39:36 -05:00