Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
escapewindow committed Dec 7, 2016
1 parent 4177630 commit 5af4005
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.rst
Expand Up @@ -67,14 +67,14 @@ then
It's also possible to create a ``./secrets.json`` as above, then::

cp docker/Dockerfile.test Dockerfile
docker build -t scriptworker . && docker run scriptworker tox
docker build -t scriptworker-test . && docker run scriptworker-test tox

GPG Homedir testing
^^^^^^^^^^^^^^^^^^^

Sometimes it's nice to be able to test things like ``rebuild_gpg_homedirs``. To do so::

cp docker/Dockerfile.gnupg Dockerfile
docker build -t scriptworker . && docker run -i scriptworker bash -il
docker build -t scriptworker-gpg . && docker run -i scriptworker-gpg bash -il
# in the docker shell,
rebuild_gpg_homedirs scriptworker.yaml
8 changes: 1 addition & 7 deletions docker/Dockerfile.gnupg
@@ -1,9 +1,6 @@
FROM ubuntu:16.04
FROM python:3.5

RUN apt-get update && apt-get install -y \
python3 \
python3-dev \
python3-pip \
git \
curl

Expand All @@ -18,7 +15,6 @@ COPY tox.ini /data/
COPY MANIFEST.in /data/
COPY version.json /data/
COPY secrets.json /data/
# COPY * /data/
COPY docker/gnupg.yaml /data/scriptworker.yaml
COPY scriptworker/test/data/gpg/keys/scriptworker@example.com.pub /data/my_pubkey.asc
COPY scriptworker/test/data/gpg/keys/scriptworker@example.com.sec /data/my_privkey.asc
Expand All @@ -28,5 +24,3 @@ RUN curl https://hg.mozilla.org/build/puppet/archive/tip.tar.gz/modules/scriptwo

RUN pip3 install -r requirements-test-dev.txt
RUN python3 setup.py develop

#ENTRYPOINT ["/bin/bash"]
5 changes: 1 addition & 4 deletions docker/Dockerfile.test
@@ -1,9 +1,6 @@
FROM ubuntu:16.04
FROM python:3.5

RUN apt-get update && apt-get install -y \
python3 \
python3-dev \
python3-pip \
git

WORKDIR /data
Expand Down
4 changes: 1 addition & 3 deletions scriptworker/gpg.py
Expand Up @@ -1440,9 +1440,6 @@ def _update_git_and_rebuild_homedirs(context, basedir=None):
build_gpg_homedirs_from_repo(context, basedir=basedir)
log.info("Writing last_good_git_revision...")
write_last_good_git_revision(context, new_revision)
# Get rid of spurious event_loop errors. Since this function is only
# called from non-scriptworker entry points, this shouldn't have any
# negative effects.
return new_revision


Expand Down Expand Up @@ -1528,4 +1525,5 @@ def rebuild_gpg_homedirs():
else:
rm_lockfile(context)
event_loop = asyncio.get_event_loop()
# Get rid of spurious event_loop errors.
event_loop.close()
8 changes: 5 additions & 3 deletions scriptworker/worker.py
Expand Up @@ -84,9 +84,11 @@ async def async_main(context):
tmp_gpg_home = get_tmp_base_gpg_home_dir(context)
state = is_lockfile_present(context, "scriptworker", logging.DEBUG)
if os.path.exists(tmp_gpg_home) and state == "ready":
overwrite_gpg_home(tmp_gpg_home, context.config['base_gpg_home_dir'])
rm(tmp_gpg_home)
rm_lockfile(context)
try:
overwrite_gpg_home(tmp_gpg_home, context.config['base_gpg_home_dir'])
rm(tmp_gpg_home)
finally:
rm_lockfile(context)
await run_loop(context)
await asyncio.sleep(context.config['poll_interval'])

Expand Down

0 comments on commit 5af4005

Please sign in to comment.