[copr] master: Automatic commit of package [copr-frontend] release [1.49-1]. (68b72a5)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 68b72a5b20fb8242d31ff8c2f22025dc39c8309f
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Dec 11 14:45:44 2014 +0100
Automatic commit of package [copr-frontend] release [1.49-1].
>---------------------------------------------------------------
frontend/copr-frontend.spec | 10 +++++++++-
rel-eng/packages/copr-frontend | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/frontend/copr-frontend.spec b/frontend/copr-frontend.spec
index 4b11c7b..ba4c6da 100644
--- a/frontend/copr-frontend.spec
+++ b/frontend/copr-frontend.spec
@@ -5,7 +5,7 @@
%endif
Name: copr-frontend
-Version: 1.48
+Version: 1.49
Release: 1%{?dist}
Summary: Frontend for Copr
@@ -168,6 +168,14 @@ service httpd condrestart
%doc documentation/python-doc
%changelog
+* Thu Dec 11 2014 Valentin Gologuzov <vgologuz(a)redhat.com> 1.49-1
+- api workaround: removed auto_createrepo option
+- show copr-frontend version;
+- re-enabling of auto_createrepo should produce createrepo action
+- 1169366 - Files installed in both copr-frontend and copr-frontend-doc
+- Fix mismatch between documentation and actual API in new build
+- disabled debug prints, fixed PEP8 violations
+
* Mon Nov 24 2014 Valentin Gologuzov <vgologuz(a)redhat.com> 1.48-1
- [frontend] fixed paramater validation for API hanlde `create_new_copr`
- [frontend] show "createrepo" action only when user disable auto_createrepo
diff --git a/rel-eng/packages/copr-frontend b/rel-eng/packages/copr-frontend
index d7313da..fd34464 100644
--- a/rel-eng/packages/copr-frontend
+++ b/rel-eng/packages/copr-frontend
@@ -1 +1 @@
-1.48-1 frontend/
+1.49-1 frontend/
9 years, 4 months
[copr] master: [backend] minor docstring fix (58d473b)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 58d473b654699df447b26fdd4ec8a0eebff2bc02
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Dec 11 14:33:06 2014 +0100
[backend] minor docstring fix
>---------------------------------------------------------------
backend/backend/actions.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/backend/backend/actions.py b/backend/backend/actions.py
index 2a79fc5..4ae9c7c 100644
--- a/backend/backend/actions.py
+++ b/backend/backend/actions.py
@@ -16,7 +16,7 @@ class Action(object):
:param backend.callback.FrontendCallback frontent_callback:
object to post data back to frontend
- :param str destdir: filepath with build results
+ :param destdir: filepath with build results
:param dict action: dict-like object with action task
9 years, 4 months
[copr] master: [frontend] api workaround: removed auto_createrepo option (04070d4)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 04070d465ee8329d82add3dd5db58c726f6f2a37
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Dec 11 14:25:46 2014 +0100
[frontend] api workaround: removed auto_createrepo option
>---------------------------------------------------------------
.../coprs/views/api_ns/api_general.py | 14 +-------------
1 files changed, 1 insertions(+), 13 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 409598d..ceca86a 100644
--- a/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
+++ b/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
@@ -83,18 +83,6 @@ def api_new_copr(username):
elif form.validate_on_submit():
infos = []
- auto_createrepo = True
- try:
- dct = json.loads(flask.request.data)
- if "auto_createrepo" in dct:
- val = dct["auto_createrepo"]
- if isinstance(val, bool):
- auto_createrepo = val
- elif str(val).lower() in ["false", "no"]:
- auto_createrepo = False
- except Exception:
- pass
-
try:
copr = coprs_logic.CoprsLogic.add(
name=form.name.data.strip(),
@@ -104,7 +92,7 @@ def api_new_copr(username):
description=form.description.data,
instructions=form.instructions.data,
check_for_duplicates=True,
- auto_createrepo=auto_createrepo
+ auto_createrepo=True,
)
infos.append("New project was successfully created.")
9 years, 4 months
[copr] master: [frontend] show copr-frontend version; (91bf2aa)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 91bf2aa28bcdb79c31ca8fe42f2c61f51e70c3d8
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Dec 11 14:23:56 2014 +0100
[frontend] show copr-frontend version;
>---------------------------------------------------------------
frontend/copr-frontend.spec | 5 +++++
.../coprs_frontend/coprs/templates/layout.html | 5 +++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/frontend/copr-frontend.spec b/frontend/copr-frontend.spec
index c74a849..4b11c7b 100644
--- a/frontend/copr-frontend.spec
+++ b/frontend/copr-frontend.spec
@@ -106,6 +106,8 @@ popd
%install
+
+
install -d %{buildroot}%{_sysconfdir}/copr
install -d %{buildroot}%{_datadir}/copr/coprs_frontend
install -d %{buildroot}%{_sharedstatedir}/copr/data/openid_store
@@ -115,7 +117,10 @@ install -d %{buildroot}%{_sharedstatedir}/copr/data/openid_store/temp
install -d %{buildroot}%{_sharedstatedir}/copr/data/whooshee
install -d %{buildroot}%{_sharedstatedir}/copr/data/whooshee/copr_user_whoosheer
+
cp -a coprs_frontend/* %{buildroot}%{_datadir}/copr/coprs_frontend
+sed -i "s/__RPM_BUILD_VERSION/%{version}/" %{buildroot}%{_datadir}/copr/coprs_frontend/coprs/templates/layout.html
+
mv %{buildroot}%{_datadir}/copr/coprs_frontend/coprs.conf.example ./
mv %{buildroot}%{_datadir}/copr/coprs_frontend/config/* %{buildroot}%{_sysconfdir}/copr
rm %{buildroot}%{_datadir}/copr/coprs_frontend/CONTRIBUTION_GUIDELINES
diff --git a/frontend/coprs_frontend/coprs/templates/layout.html b/frontend/coprs_frontend/coprs/templates/layout.html
index 9ec9985..bef3fbf 100644
--- a/frontend/coprs_frontend/coprs/templates/layout.html
+++ b/frontend/coprs_frontend/coprs/templates/layout.html
@@ -52,6 +52,11 @@
<a href="https://fedorahosted.org/copr/wiki/UserDocs#FAQ">FAQ</a>
<a class="last" href="{{ url_for('api_ns.api_home') }}">API</a>
</p>
+<p>
+ <small>
+ Copr frontend build version: __RPM_BUILD_VERSION
+ </small>
+</p>
</div>
</body>
</html>
9 years, 4 months
[copr] master: Automatic commit of package [copr-backend] release [1.50-1]. (8a922a9)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 8a922a94a0684183258b52a94db45c86dbcbf241
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Wed Dec 10 16:51:50 2014 +0100
Automatic commit of package [copr-backend] release [1.50-1].
>---------------------------------------------------------------
backend/copr-backend.spec | 10 +++++++++-
rel-eng/packages/copr-backend | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/backend/copr-backend.spec b/backend/copr-backend.spec
index 9450a7f..df0e1b8 100644
--- a/backend/copr-backend.spec
+++ b/backend/copr-backend.spec
@@ -3,7 +3,7 @@
%endif
Name: copr-backend
-Version: 1.49
+Version: 1.50
Release: 1%{?dist}
Summary: Backend for Copr
@@ -180,6 +180,14 @@ useradd -r -g copr -G lighttpd -s /bin/bash -c "COPR user" copr
%exclude %{_pkgdocdir}/playbooks
%changelog
+* Wed Dec 10 2014 Valentin Gologuzov <vgologuz(a)redhat.com> 1.50-1
+- [backend] added option to control ansible ssh transport, changed by default
+ to `paramiko` [frontend] bugfix api create new
+- [backend] removed spawn_vars options, to be able to spawn VMs in advance
+- [backend] unittest for backend.daemons.log
+- [backend] massive refactoring and unittest coverage
+- [backend] backend.sign: discover `keygen_host` from backend config file
+
* Tue Nov 25 2014 Valentin Gologuzov <vgologuz(a)redhat.com> 1.49-1
- [backend] small bug in dispatcher
diff --git a/rel-eng/packages/copr-backend b/rel-eng/packages/copr-backend
index 4497f3d..1754c90 100644
--- a/rel-eng/packages/copr-backend
+++ b/rel-eng/packages/copr-backend
@@ -1 +1 @@
-1.49-1 backend/
+1.50-1 backend/
9 years, 4 months
[copr] master: [backend] added option to control ansible ssh transport, changed by default to `paramiko` [frontend] bugfix api create new (0194a58)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 0194a5831f594a1f4ae5b243f17f38fde59d1bd2
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Wed Dec 10 16:43:00 2014 +0100
[backend] added option to control ansible ssh transport, changed by default to `paramiko`
[frontend] bugfix api create new
>---------------------------------------------------------------
backend/backend/daemons/dispatcher.py | 13 +++++----
backend/backend/helpers.py | 6 ++++
backend/backend/mockremote/__init__.py | 20 ++++++++-------
backend/backend/mockremote/builder.py | 26 ++++++++++---------
backend/tests/deamons/test_dispatcher.py | 1 +
backend/tests/mockremote/test_builder.py | 8 ++++++
.../coprs/views/api_ns/api_general.py | 17 +++++++-----
7 files changed, 57 insertions(+), 34 deletions(-)
diff --git a/backend/backend/daemons/dispatcher.py b/backend/backend/daemons/dispatcher.py
index b995d22..fe046f8 100644
--- a/backend/backend/daemons/dispatcher.py
+++ b/backend/backend/daemons/dispatcher.py
@@ -232,14 +232,15 @@ class Worker(multiprocessing.Process):
"""
# we were getting some dead instances
# that's why I'm testing the connectivity here
- connection = ansible.runner.Runner(
+ runner_options = dict(
remote_user="root",
host_list="{},".format(ipaddr),
pattern=ipaddr,
forks=1,
- transport="ssh",
+ transport=self.opts.ssh.transport,
timeout=500
)
+ connection = ansible.runner.Runner(**runner_options)
connection.module_name = "shell"
connection.module_args = "echo hello"
@@ -252,8 +253,9 @@ class Worker(multiprocessing.Process):
if ipaddr not in res.get("contacted", {}):
self.callback.log(
- "Worker is not responding to"
- "the testing playbook. Terminating it.")
+ "Worker is not responding to the testing playbook. Terminating it."
+ "Runner options: {}".format(runner_options) +
+ "Ansible raw response:\n{}".format(res))
raise CoprWorkerSpawnFailError("Created VM ({}) was unresponsive "
"and therefore terminated".format(ipaddr))
@@ -469,8 +471,7 @@ class Worker(multiprocessing.Process):
"""
self._announce_start(job)
self.callback.log(
- "Skipping: package {0} has been already built before."
- .format(' '.join(job.pkg)))
+ "Skipping: package {0} has been already built before.".format(job.pkg))
job.status = BuildStatus.SKIPPED # skipped
self._announce_end(job)
diff --git a/backend/backend/helpers.py b/backend/backend/helpers.py
index cfb03cb..f7e149f 100644
--- a/backend/backend/helpers.py
+++ b/backend/backend/helpers.py
@@ -160,6 +160,12 @@ class BackendConfigReader(object):
opts.spawn_in_advance = _get_conf(
cp, "backend", "spawn_in_advance", False, mode="bool")
+ # ssh options
+ opts.ssh = Bunch()
+ # TODO: ansible Runner show some magic bugs with transport "ssh", using paramiko
+ opts.ssh.transport = _get_conf(
+ cp, "ssh", "transport", "paramiko")
+
# thoughts for later
# ssh key for connecting to builders?
# cloud key stuff?
diff --git a/backend/backend/mockremote/__init__.py b/backend/backend/mockremote/__init__.py
index 61c4233..380477e 100755
--- a/backend/backend/mockremote/__init__.py
+++ b/backend/backend/mockremote/__init__.py
@@ -134,15 +134,17 @@ class MockRemote(object):
self.callback = DefaultCallBack()
self.callback.log("Setting up builder: {0}".format(builder_host))
- self.builder = Builder(hostname=builder_host,
- username=self.opts.build_user,
- chroot=self.job.chroot,
- timeout=self.job.timeout or DEF_TIMEOUT,
- buildroot_pkgs=self.job.buildroot_pkgs,
- callback=self.callback,
- remote_basedir=self.opts.remote_basedir,
- remote_tempdir=self.opts.remote_tempdir,
- macros=self.macros, repos=self.repos)
+ self.builder = Builder(
+ opts=self.opts,
+ hostname=builder_host,
+ username=self.opts.build_user,
+ chroot=self.job.chroot,
+ timeout=self.job.timeout or DEF_TIMEOUT,
+ buildroot_pkgs=self.job.buildroot_pkgs,
+ callback=self.callback,
+ remote_basedir=self.opts.remote_basedir,
+ remote_tempdir=self.opts.remote_tempdir,
+ macros=self.macros, repos=self.repos)
self.builder.check()
if not self.job.chroot:
diff --git a/backend/backend/mockremote/builder.py b/backend/backend/mockremote/builder.py
index 02f489b..cdcb3bd 100644
--- a/backend/backend/mockremote/builder.py
+++ b/backend/backend/mockremote/builder.py
@@ -13,12 +13,14 @@ from ..constants import mockchain, rsync
class Builder(object):
- def __init__(self, hostname, username,
+ def __init__(self, opts, hostname, username,
timeout, chroot, buildroot_pkgs,
callback,
remote_basedir, remote_tempdir=None,
macros=None, repos=None):
+ # TODO: remove fields obtained from opts
+ self.opts = opts
self.hostname = hostname
self.username = username
self.timeout = timeout
@@ -33,9 +35,8 @@ class Builder(object):
self._remote_tempdir = remote_tempdir
self._remote_basedir = remote_basedir
# if we're at this point we've connected and done stuff on the host
- self.conn = _create_ans_conn(
- self.hostname, self.username, self.timeout)
- self.root_conn = _create_ans_conn(self.hostname, "root", self.timeout)
+ self.conn = self._create_ans_conn()
+ self.root_conn = self._create_ans_conn(username="root")
# self.callback.log("Created builder: {}".format(self.__dict__))
@@ -75,6 +76,15 @@ class Builder(object):
def tempdir(self, value):
self._remote_tempdir = value
+ def _create_ans_conn(self, username=None):
+ ans_conn = Runner(remote_user=username or self.username,
+ host_list=self.hostname + ",",
+ pattern=self.hostname,
+ forks=1,
+ transport=self.opts.ssh.transport,
+ timeout=self.timeout)
+ return ans_conn
+
def _run_ansible(self, cmd, module_name=None, as_root=False):
"""
Executes single ansible module
@@ -356,14 +366,6 @@ class Builder(object):
raise BuilderError(msg)
-def _create_ans_conn(hostname, username, timeout):
- ans_conn = Runner(remote_user=username,
- host_list=hostname + ",",
- pattern=hostname,
- forks=1,
- transport="ssh",
- timeout=timeout)
- return ans_conn
def get_ans_results(results, hostname):
diff --git a/backend/tests/deamons/test_dispatcher.py b/backend/tests/deamons/test_dispatcher.py
index 49d5820..9a90daf 100644
--- a/backend/tests/deamons/test_dispatcher.py
+++ b/backend/tests/deamons/test_dispatcher.py
@@ -78,6 +78,7 @@ class TestDispatcher(object):
self.spawn_pb = "/spawn.yml"
self.terminate_pb = "/terminate.yml"
self.opts = Bunch(
+ ssh=Bunch(transport="paramiko"),
spawn_in_advance=False,
frontend_url="http://example.com/",
frontend_auth="12345678",
diff --git a/backend/tests/mockremote/test_builder.py b/backend/tests/mockremote/test_builder.py
index 5cfd2bf..39eb0ed 100644
--- a/backend/tests/mockremote/test_builder.py
+++ b/backend/tests/mockremote/test_builder.py
@@ -3,6 +3,7 @@ import copy
from collections import defaultdict
from pprint import pprint
+from bunch import Bunch
from backend.exceptions import BuilderError, BuilderTimeOutError
import tempfile
@@ -57,8 +58,15 @@ class TestBuilder(object):
STDOUT = "stdout"
STDERR = "stderr"
+ opts = Bunch(
+ ssh=Bunch(
+ transport="paramiko"
+ )
+ )
+
def get_test_builder(self):
builder = Builder(
+ opts=self.opts,
hostname=self.BUILDER_HOSTNAME,
username=self.BUILDER_USER,
timeout=self.BUILDER_TIMEOUT,
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 faf08cc..409598d 100644
--- a/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
+++ b/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
@@ -84,13 +84,16 @@ def api_new_copr(username):
infos = []
auto_createrepo = True
- dct = json.loads(flask.request.data)
- if "auto_createrepo" in dct:
- val = dct["auto_createrepo"]
- if isinstance(val, bool):
- auto_createrepo = val
- elif str(val).lower() in ["false", "no"]:
- auto_createrepo = False
+ try:
+ dct = json.loads(flask.request.data)
+ if "auto_createrepo" in dct:
+ val = dct["auto_createrepo"]
+ if isinstance(val, bool):
+ auto_createrepo = val
+ elif str(val).lower() in ["false", "no"]:
+ auto_createrepo = False
+ except Exception:
+ pass
try:
copr = coprs_logic.CoprsLogic.add(
9 years, 4 months
[copr] master: [backend] test for backend option `spawn_in_advance` (c772ba2)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit c772ba28514d15b58e52ee12e79e1ef920a562f4
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Mon Dec 8 23:31:01 2014 +0100
[backend] test for backend option `spawn_in_advance`
>---------------------------------------------------------------
backend/tests/deamons/test_dispatcher.py | 43 +++++++++++++++++++++++++++--
1 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/backend/tests/deamons/test_dispatcher.py b/backend/tests/deamons/test_dispatcher.py
index 11a4dbf..49d5820 100644
--- a/backend/tests/deamons/test_dispatcher.py
+++ b/backend/tests/deamons/test_dispatcher.py
@@ -78,7 +78,7 @@ class TestDispatcher(object):
self.spawn_pb = "/spawn.yml"
self.terminate_pb = "/terminate.yml"
self.opts = Bunch(
- spawn_in_advance=True,
+ spawn_in_advance=False,
frontend_url="http://example.com/",
frontend_auth="12345678",
build_groups={
@@ -633,10 +633,17 @@ class TestDispatcher(object):
@mock.patch("backend.daemons.dispatcher.time")
def test_run(self, mc_time, init_worker):
self.worker.init_fedmsg = MagicMock()
- self.worker.obtain_job = MagicMock()
- self.worker.obtain_job.return_value = self.job
self.worker.spawn_instance_with_check = MagicMock()
self.worker.spawn_instance_with_check.return_value = self.vm_ip
+
+ self.worker.obtain_job = MagicMock()
+ self.worker.obtain_job.return_value = self.job
+
+ def validate_not_spawn():
+ assert not self.worker.spawn_instance_with_check.called
+ return mock.DEFAULT
+
+ self.worker.obtain_job.side_effect = validate_not_spawn
self.worker.terminate_instance = MagicMock()
mc_do_job = MagicMock()
@@ -654,6 +661,36 @@ class TestDispatcher(object):
assert self.worker.terminate_instance.called
@mock.patch("backend.daemons.dispatcher.time")
+ def test_run_spawn_in_advance(self, mc_time, init_worker):
+ self.worker.opts.spawn_in_advance = True
+ self.worker.init_fedmsg = MagicMock()
+ self.worker.spawn_instance_with_check = MagicMock()
+ self.worker.spawn_instance_with_check.return_value = self.vm_ip
+
+ self.worker.obtain_job = MagicMock()
+ self.worker.obtain_job.return_value = self.job
+
+ def validate_spawn():
+ assert self.worker.spawn_instance_with_check.called
+ self.worker.spawn_instance_with_check.reset_mock()
+ return mock.DEFAULT
+
+ self.worker.obtain_job.side_effect = validate_spawn
+ self.worker.terminate_instance = MagicMock()
+
+ mc_do_job = MagicMock()
+ self.worker.do_job = mc_do_job
+
+ def stop_loop(*args, **kwargs):
+ assert not self.worker.spawn_instance_with_check.called
+ self.worker.kill_received = True
+
+ mc_do_job.side_effect = stop_loop
+
+ self.worker.run()
+
+
+ @mock.patch("backend.daemons.dispatcher.time")
def test_run_finalize(self, mc_time, init_worker):
self.worker.init_fedmsg = MagicMock()
self.worker.obtain_job = MagicMock()
9 years, 5 months
[copr] master: [backend] removed spawn_vars options, to be able spawn VMs in advance (da03bd1)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit da03bd134432633acfd3699a5ce725bec8f813b5
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Mon Dec 8 23:24:39 2014 +0100
[backend] removed spawn_vars options, to be able spawn VMs in advance
>---------------------------------------------------------------
backend/backend/daemons/dispatcher.py | 18 ++++++----------
backend/backend/helpers.py | 1 -
backend/conf/copr-be.conf.example | 13 +-----------
backend/conf/copr-be.local.conf | 13 +-----------
backend/tests/deamons/test_backend.py | 2 -
backend/tests/deamons/test_dispatcher.py | 31 +++++++++--------------------
6 files changed, 19 insertions(+), 59 deletions(-)
diff --git a/backend/backend/daemons/dispatcher.py b/backend/backend/daemons/dispatcher.py
index 9b826fd..b995d22 100644
--- a/backend/backend/daemons/dispatcher.py
+++ b/backend/backend/daemons/dispatcher.py
@@ -288,7 +288,7 @@ class Worker(multiprocessing.Process):
return ipaddr
- def spawn_instance(self, job):
+ def spawn_instance(self):
"""
Spawn new VM, executing the following steps:
@@ -306,18 +306,12 @@ class Worker(multiprocessing.Process):
# Ansible playbook python API does not work here, dunno why. See:
# https://groups.google.com/forum/#!topic/ansible-project/DNBD2oHv5k8
- extra_vars = {}
- for var in self.opts.spawn_vars:
- if hasattr(job, var):
- extra_vars[var] = getattr(job, var)
-
try:
spawn_playbook = self.opts.build_groups[self.group_id]["spawn_playbook"]
except KeyError:
return None
- spawn_args = "-c ssh {0} {1}".format(
- spawn_playbook, ans_extra_vars_encode(extra_vars, "copr_task"))
+ spawn_args = "-c ssh {}".format(spawn_playbook)
# TODO: replace with for i in range(MAX_SPAWN_TRIES): ... else raise FatalError
i = 0
@@ -431,7 +425,7 @@ class Worker(multiprocessing.Process):
return True
return False
- def spawn_instance_with_check(self, job):
+ def spawn_instance_with_check(self):
"""
Wrapper around self.spawn_instance() with exception checking
@@ -444,7 +438,7 @@ class Worker(multiprocessing.Process):
- :py:class:`AnsibleError`: failure during anible command execution
"""
try:
- ip = self.spawn_instance(job)
+ ip = self.spawn_instance()
if not ip:
# TODO: maybe add specific exception?
raise CoprWorkerError(
@@ -615,6 +609,8 @@ class Worker(multiprocessing.Process):
vm_ip = None
while not self.kill_received:
+ if self.opts.spawn_in_advance:
+ vm_ip = self.spawn_instance_with_check()
job = self.obtain_job()
if not job:
@@ -622,7 +618,7 @@ class Worker(multiprocessing.Process):
continue
if not vm_ip:
- vm_ip = self.spawn_instance_with_check(job)
+ vm_ip = self.spawn_instance_with_check()
try:
self.do_job(vm_ip, job)
diff --git a/backend/backend/helpers.py b/backend/backend/helpers.py
index 5948888..cfb03cb 100644
--- a/backend/backend/helpers.py
+++ b/backend/backend/helpers.py
@@ -152,7 +152,6 @@ class BackendConfigReader(object):
cp, "backend", "verbose", False, mode="bool")
opts.worker_logdir = _get_conf(
cp, "backend", "worker_logdir", "/var/log/copr/workers/")
- opts.spawn_vars = _get_conf(cp, "backend", "spawn_vars", "").split(",")
opts.terminate_vars = _get_conf(cp, "backend", "terminate_vars", "").split(",")
opts.prune_days = _get_conf(cp, "backend", "prune_days", None, mode="int")
diff --git a/backend/conf/copr-be.conf.example b/backend/conf/copr-be.conf.example
index fe76c37..97fe92f 100644
--- a/backend/conf/copr-be.conf.example
+++ b/backend/conf/copr-be.conf.example
@@ -43,18 +43,7 @@ group0_terminate_playbook=/srv/copr-work/provision/terminatepb-PC.yml
group0_max_workers=8
-# What variables will be send to spawn_playbook. Expects comma separated list
-# of keywords. For example 'spawn_vars=chroot' will create
-# 'copr_task["chroot"]' variable accessible from spawn_playbook.
-# Currently supported parameters
-# - chroot
-# string representation of expect chroot to be alloced, e.g.
-# fedora-rawhide-ppc64
-#
-# default is None (empty)
-#spawn_vars=chroot
-
-# The same option as 'spawn_vars' above, except that variables will be send to
+# That variables will be send to
# terminate_playbook ansible script.
# Currently supported parameters:
# - ip
diff --git a/backend/conf/copr-be.local.conf b/backend/conf/copr-be.local.conf
index f59fb71..4fc5f47 100644
--- a/backend/conf/copr-be.local.conf
+++ b/backend/conf/copr-be.local.conf
@@ -42,18 +42,7 @@ group0_terminate_playbook=/srv/copr-work/provision/terminatepb-PC.yml
group0_max_workers=8
-# What variables will be send to spawn_playbook. Expects comma separated list
-# of keywords. For example 'spawn_vars=chroot' will create
-# 'copr_task["chroot"]' variable accessible from spawn_playbook.
-# Currently supported parameters
-# - chroot
-# string representation of expect chroot to be alloced, e.g.
-# fedora-rawhide-ppc64
-#
-# default is None (empty)
-#spawn_vars=chroot
-
-# The same option as 'spawn_vars' above, except that variables will be send to
+# That variables will be send to
# terminate_playbook ansible script.
# Currently supported parameters:
# - ip
diff --git a/backend/tests/deamons/test_backend.py b/backend/tests/deamons/test_backend.py
index 4fb81b2..4818b40 100644
--- a/backend/tests/deamons/test_backend.py
+++ b/backend/tests/deamons/test_backend.py
@@ -322,8 +322,6 @@ class TestBackend(object):
self.pwd.getpwnam.return_value.pw_uid = 9
run_backend(self.run_opts)
-
- print()
ddc = mc_daemon_context.call_args[1]
assert ddc["signal_map"] == {1: u'terminate', 15: u'terminate'}
diff --git a/backend/tests/deamons/test_dispatcher.py b/backend/tests/deamons/test_dispatcher.py
index 1b6a2a2..11a4dbf 100644
--- a/backend/tests/deamons/test_dispatcher.py
+++ b/backend/tests/deamons/test_dispatcher.py
@@ -88,7 +88,6 @@ class TestDispatcher(object):
"name": "3"
}
},
- spawn_vars=["chroot"],
terminate_vars=[],
fedmsg_enabled=False,
@@ -101,10 +100,7 @@ class TestDispatcher(object):
)
self.job = BuildJob(self.task, self.opts)
- self.try_spawn_args = (
- '-c ssh {} '
- '--extra-vars=\'{{"copr_task": {{"chroot": "{}"}}}}\''
- ).format(self.spawn_pb, self.CHROOT)
+ self.try_spawn_args = '-c ssh {}'.format(self.spawn_pb)
self.worker_num = 2
self.group_id = "3"
@@ -155,7 +151,7 @@ class TestDispatcher(object):
self.worker.spawn_instance = MagicMock()
self.worker.spawn_instance.return_value = self.vm_ip
- assert self.vm_ip == self.worker.spawn_instance_with_check(self.job)
+ assert self.vm_ip == self.worker.spawn_instance_with_check()
def test_spawn_instance_with_check_no_ip(self, init_worker):
self.worker.spawn_instance = MagicMock()
@@ -163,7 +159,7 @@ class TestDispatcher(object):
# with pytest.raises(ansible.errors.AnsibleError):
with pytest.raises(CoprWorkerError):
- self.worker.spawn_instance_with_check(self.job)
+ self.worker.spawn_instance_with_check()
def test_spawn_instance_with_check_ansible_error_reraised(self, init_worker):
self.worker.spawn_instance = MagicMock()
@@ -171,14 +167,14 @@ class TestDispatcher(object):
# with pytest.raises():
with pytest.raises(AnsibleError):
- self.worker.spawn_instance_with_check(self.job)
+ self.worker.spawn_instance_with_check()
def test_spawn_instance_missing_playbook_for_group_id(self, init_worker):
self.worker.try_spawn = MagicMock()
self.worker.validate_new_vm = MagicMock()
self.worker.group_id = "175"
- assert self.worker.spawn_instance(self.job) is None
+ assert self.worker.spawn_instance() is None
assert not self.worker.try_spawn.called
assert not self.worker.validate_new_vm.called
@@ -187,7 +183,7 @@ class TestDispatcher(object):
self.worker.try_spawn.return_value = self.vm_ip
self.worker.validate_new_vm = MagicMock()
- assert self.worker.spawn_instance(self.job) == self.vm_ip
+ assert self.worker.spawn_instance() == self.vm_ip
assert self.worker.try_spawn.called
assert self.worker.validate_new_vm.called
@@ -199,7 +195,7 @@ class TestDispatcher(object):
]
self.worker.validate_new_vm = MagicMock()
- assert self.worker.spawn_instance(self.job) == self.vm_ip
+ assert self.worker.spawn_instance() == self.vm_ip
assert len(self.worker.try_spawn.call_args_list) == 2
assert len(self.worker.validate_new_vm.call_args_list) == 1
@@ -214,7 +210,7 @@ class TestDispatcher(object):
None,
]
- assert self.worker.spawn_instance(self.job) == self.vm_ip
+ assert self.worker.spawn_instance() == self.vm_ip
assert len(self.worker.try_spawn.call_args_list) == 2
assert len(self.worker.validate_new_vm.call_args_list) == 2
@@ -225,17 +221,12 @@ class TestDispatcher(object):
self.worker.try_spawn.return_value = self.vm_ip
self.worker.validate_new_vm = MagicMock()
- assert self.worker.spawn_instance(self.job) == self.vm_ip
+ assert self.worker.spawn_instance() == self.vm_ip
assert self.worker.try_spawn.called
assert self.worker.validate_new_vm.called
assert self.worker.try_spawn.call_args == mock.call(self.try_spawn_args)
- self.worker.try_spawn.reset_mock()
- self.worker.opts.spawn_vars = []
- assert self.worker.spawn_instance(self.job) == self.vm_ip
- assert self.worker.try_spawn.call_args == mock.call('-c ssh /spawn.yml ')
-
def test_try_spawn_ansible_error_no_result(self, init_worker):
mc_run_ans = MagicMock()
self.worker.run_ansible_playbook = mc_run_ans
@@ -397,9 +388,7 @@ class TestDispatcher(object):
assert mc_subprocess.check_output.called_once
assert mc_subprocess.check_output.call_args == mock.call(
- 'ansible-playbook -c ssh /spawn.yml '
- '--extra-vars=\'{"copr_task": {"chroot": "fedora-20-x86_64"}}\'',
- shell=True)
+ 'ansible-playbook -c ssh /spawn.yml', shell=True)
9 years, 5 months