[copr] master: add indexes (3c03f2f)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 3c03f2fa7a40e2d0341492d2f96a681d68803156
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Wed Apr 23 16:57:57 2014 +0200
add indexes
>---------------------------------------------------------------
.../alembic/versions/20140423001_add_indexes.py | 41 ++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/frontend/coprs_frontend/alembic/versions/20140423001_add_indexes.py b/frontend/coprs_frontend/alembic/versions/20140423001_add_indexes.py
new file mode 100644
index 0000000..a6c698d
--- /dev/null
+++ b/frontend/coprs_frontend/alembic/versions/20140423001_add_indexes.py
@@ -0,0 +1,41 @@
+"""add indexes
+
+Revision ID: 20140423001
+Revises: 5845661bb37d
+Create Date: 2014-04-24 11:25:36.216132
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '20140423001'
+down_revision = '5845661bb37d'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade():
+ op.create_index('build_ended_on_canceled_started_on', 'build', ['ended_on', 'canceled', 'started_on'])
+ op.create_index('copr_owner_id', 'copr', ['owner_id'])
+ op.create_index('copr_deleted_name', 'copr', ['deleted', 'name'])
+ op.create_index('copr_chroot_copr_id', 'copr_chroot', ['copr_id'])
+ op.create_index('action_result_action_type', 'action', ['result', 'action_type'])
+ op.create_index('user_openid_name', 'user', ['openid_name'])
+ op.create_index('copr_permission_copr_id', 'copr_permission', ['copr_id'])
+ op.create_index('build_chroot_build_id', 'build_chroot', ['build_id'])
+ op.create_index('user_api_login', 'user', ['api_login'])
+ op.create_index('legal_flag_resolved_on', 'legal_flag', ['resolved_on'])
+
+def downgrade():
+ op.drop_index('build_ended_on_canceled_started_on')
+ op.drop_index('copr_owner_id')
+ op.drop_index('copr_deleted_name')
+ op.drop_index('copr_chroot_copr_id')
+ op.drop_index('action_result_action_type')
+ op.drop_index('user_openid_name')
+ op.drop_index('copr_permission_copr_id')
+ op.drop_index('build_chroot_build_id')
+ op.drop_index('user_api_login')
+ op.drop_index('legal_flag_resolved_on')
+
+
10 years
[copr] master: 1086729 - make build tab friendly for users without JS (00d5f77)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 00d5f77844a16e37affea7dace8e44391d3b7b9d
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Wed Apr 23 15:08:16 2014 +0200
1086729 - make build tab friendly for users without JS
all entries are shown by default and hide them when page is loaded.
>---------------------------------------------------------------
frontend/coprs_frontend/coprs/static/copr.css | 1 -
frontend/coprs_frontend/coprs/static/copr.js | 5 +++++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/static/copr.css b/frontend/coprs_frontend/coprs/static/copr.css
index 102e033..03586c5 100644
--- a/frontend/coprs_frontend/coprs/static/copr.css
+++ b/frontend/coprs_frontend/coprs/static/copr.css
@@ -288,7 +288,6 @@ table.builds-table form {
table.builds-table tr.details {
width: 100%;
- display: none;
}
table.status-table {
diff --git a/frontend/coprs_frontend/coprs/static/copr.js b/frontend/coprs_frontend/coprs/static/copr.js
index 41b9fd6..d4fb222 100644
--- a/frontend/coprs_frontend/coprs/static/copr.js
+++ b/frontend/coprs_frontend/coprs/static/copr.js
@@ -1,3 +1,8 @@
+//hide build details
+$(document).ready(function () {
+ $("table.builds-table tr.details").hide();
+});
+
// showing build details
$(document).ready(function () {
$("table.builds-table tr[class^='build-']").each(function (i, e) {
10 years
[copr] master: [cli] shell return codes with errors (911def0)
by asamalik@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 911def0d0ebe02ad64d28f440437c4f58c7f3fb7
Author: Adam Samalik <asamalik(a)redhat.com>
Date: Thu Apr 17 11:35:15 2014 +0200
[cli] shell return codes with errors
>---------------------------------------------------------------
cli/copr_cli/copr_exceptions.py | 14 ++++++++++++++
cli/copr_cli/main.py | 7 +++++++
cli/copr_cli/subcommands.py | 28 ++++++++++++++--------------
3 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/cli/copr_cli/copr_exceptions.py b/cli/copr_cli/copr_exceptions.py
index bb9c009..4be2f06 100644
--- a/cli/copr_cli/copr_exceptions.py
+++ b/cli/copr_cli/copr_exceptions.py
@@ -23,3 +23,17 @@ class CoprCliConfigException(CoprCliException):
malformated.
"""
pass
+
+
+class CoprCliRequestException(Exception):
+ """ Exception thrown when server says no. For example,
+ the user provided wrong project name or build ID.
+ """
+ pass
+
+
+class CoprCliUnknownResponseException(Exception):
+ """ Exception thrown when the response is unknown to cli.
+ It usualy means that something is broken.
+ """
+ pass
diff --git a/cli/copr_cli/main.py b/cli/copr_cli/main.py
index a1dc532..50d8a06 100644
--- a/cli/copr_cli/main.py
+++ b/cli/copr_cli/main.py
@@ -144,6 +144,10 @@ def main(argv=sys.argv[1:]):
except KeyboardInterrupt:
sys.stderr.write("\nInterrupted by user.")
sys.exit(1)
+ except copr_exceptions.CoprCliRequestException, e:
+ sys.stderr.write("\nSomething went wrong:")
+ sys.stderr.write("\nError: {0}\n".format(e))
+ sys.exit(1)
except argparse.ArgumentTypeError, e:
sys.stderr.write("\nError: {0}".format(e))
sys.exit(2)
@@ -154,6 +158,9 @@ def main(argv=sys.argv[1:]):
sys.stderr.write("\nError: {0}\n".format(e))
sys.stderr.write("Lines in INI file should not be indented.\n")
sys.exit(4)
+ except copr_exceptions.CoprCliUnknownResponseException, e:
+ sys.stderr.write("\nError: {0}\n".format(e))
+ sys.exit(5)
# except Exception as e:
# print "Error: {0}".format(e)
# sys.exit(100)
diff --git a/cli/copr_cli/subcommands.py b/cli/copr_cli/subcommands.py
index 92c775b..2a74ea0 100644
--- a/cli/copr_cli/subcommands.py
+++ b/cli/copr_cli/subcommands.py
@@ -20,29 +20,29 @@ import copr_exceptions
def _get_data(req, user, copr=None):
""" Wrapper around response from server
- check data and print nice error in case of some error (and return None)
- otherwise return json object.
+ checks data and raises a CoprCliRequestException with nice error message
+ or CoprCliUnknownResponseException in case of some some error.
+ Otherwise return json object.
"""
if "<title>Sign in Coprs</title>" in req.text:
- sys.stderr.write("Invalid API token\n")
+ raise copr_exceptions.CoprCliRequestException("Invalid API token\n")
return
if req.status_code == 404:
if copr is None:
- sys.stderr.write("User {0} is unknown.\n".format(user["username"]))
+ raise copr_exceptions.CoprCliRequestException(
+ "User {0} is unknown.\n".format(user["username"]))
else:
- sys.stderr.write("Project {0}/{1} not found.\n".format(
- (user["username"], copr)))
- return
+ raise copr_exceptions.CoprCliRequestException(
+ "Project {0}/{1} not found.\n".format(
+ user["username"], copr))
try:
output = json.loads(req.text)
except ValueError:
- sys.stderr.write("Unknown response from server.\n")
- return
+ raise copr_exceptions.CoprCliUnknownResponseException(
+ "Unknown response from the server.")
if req.status_code != 200:
- sys.stderr.write(
- "Something went wrong:\n {0}\n".format(output["error"]))
- return
+ raise copr_exceptions.CoprCliRequestException(output["error"])
return output
@@ -131,8 +131,8 @@ def create(name, chroots=[], description=None, instructions=None,
repos=None, initial_pkgs=None):
""" Create a new copr. """
if chroots is None:
- sys.stderr.write("Error: At least one chroot must be selected\n")
- sys.exit(1)
+ raise copr_exceptions.CoprCliRequestException(
+ "At least one chroot must be selected")
user = get_user()
copr_api_url = get_api_url()
10 years
[copr] master: copr-cli cancel fix (3e639f7)
by asamalik@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 3e639f74e736e6489cb4e6abef375ea4dbff0a70
Author: Adam Samalik <asamalik(a)redhat.com>
Date: Thu Apr 17 10:10:55 2014 +0200
copr-cli cancel fix
>---------------------------------------------------------------
cli/copr_cli/subcommands.py | 2 +-
.../coprs/views/api_ns/api_general.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cli/copr_cli/subcommands.py b/cli/copr_cli/subcommands.py
index a204000..92c775b 100644
--- a/cli/copr_cli/subcommands.py
+++ b/cli/copr_cli/subcommands.py
@@ -191,7 +191,7 @@ def cancel(build_id):
URL = "{0}/coprs/cancel_build/{1}/".format(
copr_api_url,
build_id)
- req = requests.get(URL, auth=(user["login"], user["token"]))
+ req = requests.post(URL, auth=(user["login"], user["token"]))
output = _get_data(req, user)
if output is None:
return (False, "Error occurred.")
diff --git a/frontend/coprs_frontend/coprs/views/api_ns/api_general.py b/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
index 53b4737..b3bcd7b 100644
--- a/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
+++ b/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
@@ -320,7 +320,7 @@ def cancel_build(build_id):
else:
db.session.commit()
httpcode = 200
- output = {'output': 'ok', status: "Build canceled"}
+ output = {'output': 'ok', 'status': "Build canceled"}
else:
output = {"output": "notok", "error": "Invalid build"}
httpcode = 404
10 years
[copr] master: correctly print chroots (e5fbf80)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit e5fbf809ec092aa55f9ef90f29c6bfd54501dae4
Author: Miroslav Suchý <miroslav(a)suchy.cz>
Date: Wed Apr 16 14:20:15 2014 +0200
correctly print chroots
addressing:
Exception on /api/playground/list/ [GET]
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1687, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1360, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1358, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1344, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/share/copr/coprs_frontend/coprs/views/api_ns/api_general.py", line 467, in playground_list
jsonout = flask.jsonify(output)
File "/usr/lib/python2.7/site-packages/flask/helpers.py", line 198, in jsonify
indent=None if request.is_xhr else 2), mimetype='application/json')
File "/usr/lib64/python2.7/json/__init__.py", line 250, in dumps
sort_keys=sort_keys, **kw).encode(obj)
File "/usr/lib64/python2.7/json/encoder.py", line 209, in encode
chunks = list(chunks)
File "/usr/lib64/python2.7/json/encoder.py", line 434, in _iterencode
for chunk in _iterencode_dict(o, _current_indent_level):
File "/usr/lib64/python2.7/json/encoder.py", line 408, in _iterencode_dict
for chunk in chunks:
File "/usr/lib64/python2.7/json/encoder.py", line 332, in _iterencode_list
for chunk in chunks:
File "/usr/lib64/python2.7/json/encoder.py", line 408, in _iterencode_dict
for chunk in chunks:
File "/usr/lib64/python2.7/json/encoder.py", line 332, in _iterencode_list
for chunk in chunks:
File "/usr/lib64/python2.7/json/encoder.py", line 442, in _iterencode
o = _default(o)
File "/usr/lib64/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <coprs.models.MockChroot object at 0x7f9ef4c72450> is not JSON serializable
>---------------------------------------------------------------
.../coprs/views/api_ns/api_general.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/views/api_ns/api_general.py b/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
index 4195a9f..53b4737 100644
--- a/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
+++ b/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
@@ -462,7 +462,7 @@ def playground_list():
for repo in repos:
output["repos"].append({"username": repo.owner.name,
"coprname": repo.name,
- "chroots": repo.active_chroots})
+ "chroots": [chroot.name for chroot in repo.active_chroots]})
jsonout = flask.jsonify(output)
jsonout.status_code = 200
10 years
[copr] master: [frontend] SEND_EMAILS config correction (e57f848)
by asamalik@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit e57f84874e057deaeffe75487d8bea9b0b2fbe91
Author: Adam Samalik <asamalik(a)redhat.com>
Date: Wed Apr 16 13:38:08 2014 +0200
[frontend] SEND_EMAILS config correction
>---------------------------------------------------------------
.../coprs/views/coprs_ns/coprs_general.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py b/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
index a2c80e4..0dd9746 100644
--- a/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
+++ b/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
@@ -284,7 +284,7 @@ def copr_permissions_applier_change(username, coprname):
admin_mails.append(perm.user.mail)
# sending emails
- if flask.current_app.config["SEND_EMAILS"]:
+ if flask.current_app.config.get("SEND_EMAILS", False):
for mail in admin_mails:
msg = MIMEText("{6} is asking for these permissions:\n\n"
"Builder: {0} -> {1}\nAdmin: {2} -> {3}\n\n"
@@ -332,7 +332,7 @@ def copr_update_permissions(username, coprname):
"copr_admin_{0}".format(perm.user_id)].data
coprs_logic.CoprPermissionsLogic.update_permissions(
flask.g.user, copr, perm, new_builder, new_admin)
- if flask.current_app.config["SEND_EMAILS"]:
+ if flask.current_app.config.get("SEND_EMAILS", False):
if old_builder is not new_builder or \
old_admin is not new_admin:
msg = MIMEText("Your permissions have changed:\n\n"
10 years
[copr] master: Automatic commit of package [copr-frontend] release [1.33-1]. (9266a8c)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 9266a8c7720bcefdbfb06954ceecdd9a0fd26ced
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Apr 15 15:22:29 2014 +0200
Automatic commit of package [copr-frontend] release [1.33-1].
>---------------------------------------------------------------
frontend/copr-frontend.spec | 7 ++++++-
rel-eng/packages/copr-frontend | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/frontend/copr-frontend.spec b/frontend/copr-frontend.spec
index 04977b3..c86900e 100644
--- a/frontend/copr-frontend.spec
+++ b/frontend/copr-frontend.spec
@@ -5,7 +5,7 @@
%endif
Name: copr-frontend
-Version: 1.32
+Version: 1.33
Release: 1%{?dist}
Summary: Frontend for Copr
@@ -160,6 +160,11 @@ service httpd condrestart
%doc %{_pkgdocdir}/python-doc
%changelog
+* Tue Apr 15 2014 Miroslav Suchý <msuchy(a)redhat.com> 1.33-1
+- api: add chroots to playground api call
+- check if chroot exist for specified project
+- better explain additional yum repos
+
* Thu Apr 10 2014 Miroslav Suchý <msuchy(a)redhat.com> 1.32-1
- send permissions request to admin not to requestee
diff --git a/rel-eng/packages/copr-frontend b/rel-eng/packages/copr-frontend
index 57091a0..928fe6b 100644
--- a/rel-eng/packages/copr-frontend
+++ b/rel-eng/packages/copr-frontend
@@ -1 +1 @@
-1.32-1 frontend/
+1.33-1 frontend/
10 years
[copr] master: api: add chroots to playground api call (8f311a7)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 8f311a7aa5850c208a6948204c7a652168490c87
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Apr 14 15:44:46 2014 +0200
api: add chroots to playground api call
>---------------------------------------------------------------
.../coprs/views/api_ns/api_general.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/views/api_ns/api_general.py b/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
index b1acaee..4195a9f 100644
--- a/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
+++ b/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
@@ -461,7 +461,8 @@ def playground_list():
output = {"output": "ok", "repos": []}
for repo in repos:
output["repos"].append({"username": repo.owner.name,
- "coprname": repo.name})
+ "coprname": repo.name,
+ "chroots": repo.active_chroots})
jsonout = flask.jsonify(output)
jsonout.status_code = 200
10 years