Commit graph

249 commits

Author SHA1 Message Date
Ralph Bean
2bca286974 Make genacls.sh a template. 2015-12-17 21:54:17 +00:00
Ralph Bean
0e2ee11f58 Conditionalize that so I can debug in stg. 2015-12-17 17:32:13 +00:00
Pierre-Yves Chibon
6750a233fd Turn off namespacing in gitolite for the moment 2015-12-17 18:21:25 +01:00
Pierre-Yves Chibon
d0639e74d2 Needs some space otherwise endup in the same line 2015-12-17 17:46:54 +01:00
Pierre-Yves Chibon
8a58b9049a Style 2015-12-17 17:45:31 +01:00
Pierre-Yves Chibon
1dff3ce655 Fix symlinking the new repo to the old location 2015-12-17 17:44:57 +01:00
Ralph Bean
26141bb5e0 Fix GIT_FOLDER for prod. 2015-12-17 16:37:09 +00:00
Pierre-Yves Chibon
16fb8ba80a Invert the folder/symlink status between rpms and repositories 2015-12-17 16:38:43 +01:00
Pierre-Yves Chibon
9908aa99fe Point dist-git's cgit to the real deal 2015-12-17 16:36:15 +01:00
Pierre-Yves Chibon
f7fa7a6822 Upon new package git creation, create symlink to old location 2015-12-15 17:20:54 +01:00
Pierre-Yves Chibon
ec89cc5e83 Tag as distgit and config a few more tasks in the distgit role 2015-12-11 13:49:27 +01:00
Pierre-Yves Chibon
e5fa3f7374 Point to /srv/git/repositories as this is both backward and forward compatible
And adjust the documentation to mkbranch
2015-12-11 13:44:18 +01:00
Pierre-Yves Chibon
705d5df833 Invoke mkbranch and setup_git_package with ns/pkgname as package name 2015-12-11 13:43:52 +01:00
Pierre-Yves Chibon
382d837d7a Update pkgdb_sync_git_branches to the new pkgdb API while remaining backward compatible
This commit also adds a TEST_ONLY global boolean useful if you want to
test the script without modifying anything on the filesystem.
2015-12-11 13:35:19 +01:00
Pierre-Yves Chibon
d4307d396e Fix indentation in genacls.pkgdb 2015-12-11 12:30:49 +01:00
Pierre-Yves Chibon
32f824900c Port genacls.pkgdb to the new pkgdb API while being backward compatible with the old one 2015-12-11 12:17:35 +01:00
Kevin Fenzi
87a5d3b374 Re-add run_once here. 2015-11-30 20:16:21 +00:00
Kevin Fenzi
7bc33f64f2 Might need to drop this for ansible 2.0 2015-11-21 18:12:36 +00:00
Pierre-Yves Chibon
c8d7b8485b Store the key in a variable 2015-11-20 17:29:32 +01:00
Patrick Uiterwijk
08568865fe Replace all restart httpd with reload httpd
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
2015-11-04 23:40:01 +00:00
Kevin Fenzi
1caa9a2ef8 Add httpd_read_user_content selinux boolean on distgit 2015-07-21 23:44:31 +00:00
Mathieu Bridon
af02e32085 distgit: Ensure the hardlinked sources all belong to apache
Without this, client uploads and downloads aren't working any more.
2015-07-15 17:20:35 +02:00
Pierre-Yves Chibon
24d6ca29a8 Turn on git_system_enable_homedirs but don't ask why 2015-07-15 11:38:22 +02:00
5c0a086356 changes for branching
Signed-off-by: Dennis Gilmore <ausil@fedoraproject.org>
2015-07-15 06:35:24 +00:00
Mathieu Bridon
3ff24f67b2 distgit: Generators don't have a length
This is fallout from the previous commit.
2015-07-13 23:03:44 +02:00
Mathieu Bridon
a11c53cb4d distgit: Harden the hardlink script a bit
Turns out the lookaside cache is not as clean as I expected.

Specifically, it contains some files where we'd expect directories, for
example:

/srv/cache/lookaside/pkgs/GFS-kernel/@13013.1e77f453ba1c86cd7616087d0643bbd8e
/srv/cache/lookaside/pkgs/openswan/tmpLRV5Gn5556cb2fcea6ba862ce14e1debf98b6d

This commit makes the script print an error instead of crashing on an
OSError in such a case.
2015-07-13 22:55:57 +02:00
Mathieu Bridon
e7074e8ad9 distgit: Add a script to make the new paths in the lookaside cache
We are migrating from the following path scheme:
    /%(srpmname)s/%(filename)s/%(hash)s/%(filename)s

To:
    /%(srpmname)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

As a result, we need to hardlink all the files existing under the old
path to their new path.

This script does just that.

Given that it should only ever be run once anyway, it is added as a
file to the distgit role, but not set to be installed anywhere.
2015-07-13 20:16:30 +00:00
Mathieu Bridon
6ea2c97f74 Add the full traceback to the logs 2015-06-05 18:33:13 +02:00
Mathieu Bridon
c474289e3b distgit: Catch all errors
With this, we should never fail silently any more.
2015-06-05 18:19:05 +02:00
Mathieu Bridon
635611cfb7 distgit: Reuse the same code to create directories
This avoids some race conditions, as testing for a directory existence
before creating it is racy.

The best way is to try creating it no matter what, and ignore errors
when the directory already exists.
2015-06-05 18:19:01 +02:00
Mathieu Bridon
8ecd6b0fd0 distgit: Add some logs when hardlinks are made 2015-06-05 18:18:32 +02:00
Mathieu Bridon
bd10dee3c1 distgit: Simplify forming the fedmsg path 2015-06-05 18:17:35 +02:00
Pierre-Yves Chibon
f12571f531 Add some distgit tags 2015-06-05 18:13:00 +02:00
Mathieu Bridon
b3d5bd9d8e distgit: Avoid reupload
The script checks for the file at the new location.

As a result, it will report that the file is missing if it had only been
uploaded to the old location, which will prompt the client to reupload.

With this change, the script will check at the new location, and if it
doesn't find the file it will try checking for it at the old location as
well.

If the file is found at the old location, we hardlink it to the new
location, and report the file is available.
2015-06-05 17:49:53 +02:00
Mathieu Bridon
d6e5e69ebd distgit: Drop unused imports 2015-06-05 17:49:17 +02:00
Mathieu Bridon
09f525598f distgit: Pretend we're on NFS
Staging doesn't use NFS for its lookaside cache, like Prod does.

This makes SELinux happier, pretending that staging also is on NFS.
2015-06-05 11:10:49 +02:00
Patrick Uiterwijk
4b22cd9f2a Update upload_cgi and add cgi-nfs for pkgs
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
2015-06-05 09:02:28 +00:00
Mathieu Bridon
fefea74100 distgit: Properly make the symlink 2015-06-04 18:12:10 +02:00
Mathieu Bridon
9b1e60ece2 distgit: One more case of error handling 2015-06-04 16:11:42 +02:00
Pierre-Yves Chibon
cbeaa9437c Store the new version of the selinux policy for distgit 2015-06-04 09:33:10 +00:00
Pierre-Yves Chibon
c7678aed77 Require the types git_script_t and nfs_t 2015-06-04 09:29:26 +00:00
Mathieu Bridon
8cb0fa5632 Add a docstring to send_error 2015-06-04 10:58:50 +02:00
Mathieu Bridon
187de33c8a distgit: Improve error reporting to the client
There is a send_error method, which sends the error message back to the
client. (pyrpkg in our case)

Unfortunately, that method doesn't send back an error HTTP status code,
which I'm assuming must be interpreted as a "200 OK" status.

pyrpkg completely ignore the text sent back by the server, unless the
status code is not 200, which means all those errors are silently
ignored.

This commit makes sure the send_error method will always return an error
status ("500 Internal Server Error" by default), and moves all the error
handling code to use that method, specifying their own status code if
needed.
2015-06-04 10:58:50 +02:00
Pierre-Yves Chibon
3108b3b1fe Allow git_script_t to create link on NFS 2015-06-04 10:34:47 +02:00
Mathieu Bridon
0897e5d042 distgit: Don't raise, return the error to the client
Raising only sends the error to the logs, the client thinks everything
went fine.
2015-06-04 10:00:17 +02:00
Mathieu Bridon
c166eadb79 distgit: Actually hardlink over the existing source at the old path
Without this, the file could exist at both the old and new path, taking
the space on the disk twice.

This forces a hardlink if the file already existed at the old path.
2015-05-29 19:07:47 +02:00
Mathieu Bridon
1de198612a distgit: And so does os.makedirs 2015-05-29 18:05:04 +02:00
Mathieu Bridon
015c24618c distgit: os.link fails if the dest already exists 2015-05-29 18:00:31 +02:00
Mathieu Bridon
2e35fa64a3 distgit: Ensure the folder exists
We can't hard link the file if the folder containing the link
destination does not exist.

Hurray for testing in staging!
2015-05-29 11:59:57 +02:00
Mathieu Bridon
e570c2f271 distgit: Upload files to both the new and old path
Currently, the CGI script is set to upload files:
- to the old path if the upload uses md5
- to the new path if the upload uses sha512

The old path is as follows:
    /%(srpmname)s/%(filename)s/%(hash)s/%(filename)s

The new path is:
    /%(srpmname)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

This was meant to ensure compatibility with current fedpkg which
always downloads from the old path, but will eventually download from
the new path when we move to sha512.

However, working more on this, I now think it would make for a smoother
transition if we instead always stored the files at the new path, but
just hardlinked to the old path if the upload is using md5.

This is what this patch achieves.

With this deployed in production, fedpkg could be patched to try
downloading from the new path, and fallback to the old one if necessary,
which decouples the migration to the new path from the migration to the
new hash.
2015-05-29 11:24:24 +02:00