#26 Retire fegistry.
Merged 6 years ago by bowlofeggs. Opened 6 years ago by bowlofeggs.
bowlofeggs/fegistry retire  into  master

file modified
+2 -9
@@ -1,11 +1,4 @@ 

  # fegistry

  

- Fegistry is the container registry endpoint for Fedora's users. It will answer the initial requests

- when users ```docker pull``` Fedora containers.

- 

- 

- ## Contributing

- 

- Contributions are welcome! Please consult our

- [contribution guidelines](https://docs.pagure.org/fegistry/contributing.html)

- to get started.

+ Fegistry was intended to be the container registry endpoint for Fedora's users. It is now a retired

+ project.

file removed
-61
@@ -1,61 +0,0 @@ 

- # -*- mode: ruby -*-

- # vi: set ft=ruby :

- 

- # To use Vagrant to develop fegistry, on your host:

- # git clone https://pagure.io/fegistry.git

- # cd fegistry

- # cp Vagrantfile.example Vagrantfile

- # vagrant up

- # vagrant ssh  # Now you're in the fegistry development environment, have fun!

- 

- Vagrant.configure(2) do |config|

-   config.vm.box_url = "https://download.fedoraproject.org/pub/fedora/linux/releases/25/CloudImages"\

-                       "/x86_64/images/Fedora-Cloud-Base-Vagrant-25-1.3.x86_64.vagrant-libvirt.box"

-   config.vm.box = "f25-cloud-libvirt"

-   config.vm.network "forwarded_port", guest: 5000, host: 5000

- 

-   # This is an optional plugin that, if installed, updates the host's /etc/hosts

-   # file with the hostname of the guest VM. In Fedora it is packaged as

-   # ``vagrant-hostmanager``

-   if Vagrant.has_plugin?("vagrant-hostmanager")

-       config.hostmanager.enabled = true

-       config.hostmanager.manage_host = true

-   end

- 

-   config.vm.synced_folder ".", "/vagrant", disabled: true

-   config.vm.synced_folder ".", "/home/vagrant/fegistry", type: "sshfs"

- 

-   # To cache update packages (which is helpful if frequently doing `vagrant destroy && vagrant up`)

-   # you can create a local directory and share it to the guest's DNF cache. Uncomment the lines

-   # below to create and use a dnf cache directory

-   #

-   # Dir.mkdir('.dnf-cache') unless File.exists?('.dnf-cache')

-   # config.vm.synced_folder ".dnf-cache", "/var/cache/dnf", type: "sshfs", sshfs_opts_append: "-o nonempty"

- 

-   # Ansible needs the guest to have these

-   config.vm.provision "shell", inline: "sudo dnf install -y libselinux-python python2-dnf"

-   config.vm.provision "ansible" do |ansible|

-       ansible.playbook = "devel/ansible/playbook.yml"

-   end

- 

-   # Create a fegistry guest

-   config.vm.define "fegistry" do |fegistry|

-      fegistry.vm.host_name = "fegistry.example.com"

- 

-      fegistry.vm.provider :libvirt do |domain|

-          # Season to taste

-          domain.cpus = 4

-          domain.graphics_type = "spice"

-          domain.memory = 512

-          domain.video_type = "qxl"

- 

-          # Uncomment the following line if you would like to enable libvirt's unsafe cache

-          # mode. It is called unsafe for a reason, as it causes the virtual host to ignore all

-          # fsync() calls from the guest. Only do this if you are comfortable with the possibility of

-          # your development guest becoming corrupted (in which case you should only need to do a

-          # vagrant destroy and vagrant up to get a new one).

-          #

-          # domain.volume_cache = "unsafe"

-      end

-   end

- end

@@ -1,8 +0,0 @@ 

- ---

- - hosts: all

-   become: true

-   become_method: sudo

-   vars:

-   roles:

-     - core

-     - dev

@@ -1,12 +0,0 @@ 

- ---

- - name: Install basic packages

-   dnf:

-       name: "{{ item }}"

-       state: present

-   with_items:

-       - bash-completion

-       - dstat

-       - fedora-easy-karma

-       - htop

-       - tmux

-       - tree

@@ -1,17 +0,0 @@ 

- # .bashrc

- 

- # Source global definitions

- if [ -f /etc/bashrc ]; then

-         . /etc/bashrc

- fi

- 

- # Uncomment the following line if you don't like systemctl's auto-paging feature:

- # export SYSTEMD_PAGER=

- 

- shopt -s expand_aliases

- alias fdocs="pushd /home/vagrant/fegistry/docs && make html; popd"

- alias flog="sudo journalctl -u fegistry"

- alias frestart="sudo systemctl restart fegistry"

- alias fstart="sudo systemctl start fegistry"

- alias fstop="sudo systemctl stop fegistry"

- alias ftest="pushd /home/vagrant/fegistry && python3 setup.py nosetests; popd"

@@ -1,13 +0,0 @@ 

- [Unit]

- Description=fegistry

- After=network-online.target

- Wants=network-online.target

- 

- [Service]

- Environment=FLASK_APP=/home/vagrant/fegistry/fegistry/views.py

- Environment=FLASK_DEBUG=1

- User=vagrant

- ExecStart=/usr/bin/flask run -h 0.0.0.0

- 

- [Install]

- WantedBy=multi-user.target

@@ -1,40 +0,0 @@ 

- ---

- - name: Install dev packages

-   dnf:

-       name: "{{ item }}"

-       state: present

-   with_items:

-       - git

-       - python3-flake8

-       - python3-flask

-       - python3-mock

-       - python3-nose

-       - python3-nose-cov

-       - python3-PyYAML

-       - python3-sphinx

- 

- - name: Install the .bashrc

-   copy:

-       src: .bashrc

-       dest: /home/vagrant/.bashrc

-       mode: 0644

-       owner: vagrant

-       group: vagrant

- 

- - name: Install fegistry in developer mode

-   command: python3 setup.py develop

-   args:

-       chdir: /home/vagrant/fegistry

-       creates: /usr/lib/python3.*/site-packages/fegistry.egg-link

- 

- - name: Install the systemd unit

-   copy:

-       src: fegistry.service

-       dest: /etc/systemd/system/fegistry.service

-       mode: 0644

- 

- - name: Start and enable the fegistry service

-   systemd:

-       name: fegistry

-       state: started

-       enabled: yes

file removed
-27
@@ -1,27 +0,0 @@ 

- # Minimal makefile for Sphinx documentation

- #

- 

- # You can set these variables from the command line.

- SPHINXOPTS    =

- SPHINXBUILD   = sphinx-build-3

- SPHINXPROJ    = fegistry

- SOURCEDIR     = .

- BUILDDIR      = _build

- 

- # Put it first so that "make" without argument is like "make help".

- help:

- 	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

- 

- pagure-docs: html

- 	@git clone ssh://git@pagure.io/docs/fegistry.git _build/fegistry-docs

- 	@cp -r _build/html/* _build/fegistry-docs/

- 	@echo "Done building docs"

- 	@echo "Inspect _build/fegistry-docs and push it when ready"

- 

- 

- .PHONY: help pagure-docs Makefile

- 

- # Catch-all target: route all unknown targets to Sphinx using the new

- # "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).

- %: Makefile

- 	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

file removed
-158
@@ -1,158 +0,0 @@ 

- #!/usr/bin/env python3

- # -*- coding: utf-8 -*-

- #

- # fegistry documentation build configuration file, created by

- # sphinx-quickstart on Fri Dec 16 14:34:38 2016.

- #

- # This file is execfile()d with the current directory set to its

- # containing dir.

- #

- # Note that not all possible configuration values are present in this

- # autogenerated file.

- #

- # All configuration values have a default; values that are commented out

- # serve to show the default.

- 

- # If extensions (or modules to document with autodoc) are in another directory,

- # add these directories to sys.path here. If the directory is relative to the

- # documentation root, use os.path.abspath to make it absolute, like shown here.

- #

- import fegistry

- 

- 

- # -- General configuration ------------------------------------------------

- 

- # If your documentation needs a minimal Sphinx version, state it here.

- #

- # needs_sphinx = '1.0'

- 

- # Add any Sphinx extension module names here, as strings. They can be

- # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom

- # ones.

- extensions = [

-     'sphinx.ext.autodoc',

-     'sphinx.ext.doctest',

-     'sphinx.ext.githubpages',

-     'sphinx.ext.napoleon',

-     'sphinx.ext.viewcode',

- ]

- 

- # Add any paths that contain templates here, relative to this directory.

- templates_path = ['_templates']

- 

- # The suffix(es) of source filenames.

- # You can specify multiple suffix as a list of string:

- #

- # source_suffix = ['.rst', '.md']

- source_suffix = '.rst'

- 

- # The master toctree document.

- master_doc = 'index'

- 

- # General information about the project.

- project = 'fegistry'

- copyright = '2016, 2017 Red Hat, Inc.'

- author = 'Red Hat, Inc.'

- 

- # The version info for the project you're documenting, acts as replacement for

- # |version| and |release|, also used in various other places throughout the

- # built documents.

- #

- # The short X.Y version.

- version = '.'.join(fegistry.__version__.split('.')[:2])

- # The full version, including alpha/beta/rc tags.

- release = fegistry.__version__

- 

- # The language for content autogenerated by Sphinx. Refer to documentation

- # for a list of supported languages.

- #

- # This is also used if you do content translation via gettext catalogs.

- # Usually you set "language" from the command line for these cases.

- language = None

- 

- # List of patterns, relative to source directory, that match files and

- # directories to ignore when looking for source files.

- # This patterns also effect to html_static_path and html_extra_path

- exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

- 

- # The name of the Pygments (syntax highlighting) style to use.

- pygments_style = 'sphinx'

- 

- # If true, `todo` and `todoList` produce output, else they produce nothing.

- todo_include_todos = False

- 

- 

- # -- Options for HTML output ----------------------------------------------

- 

- # The theme to use for HTML and HTML Help pages.  See the documentation for

- # a list of builtin themes.

- #

- html_theme = 'alabaster'

- 

- # Theme options are theme-specific and customize the look and feel of a theme

- # further.  For a list of options available for each theme, see the

- # documentation.

- #

- # html_theme_options = {}

- 

- # Add any paths that contain custom static files (such as style sheets) here,

- # relative to this directory. They are copied after the builtin static files,

- # so a file named "default.css" will overwrite the builtin "default.css".

- html_static_path = ['_static']

- 

- 

- # -- Options for HTMLHelp output ------------------------------------------

- 

- # Output file base name for HTML help builder.

- htmlhelp_basename = 'fegistrydoc'

- 

- 

- # -- Options for LaTeX output ---------------------------------------------

- 

- latex_elements = {

-     # The paper size ('letterpaper' or 'a4paper').

-     #

-     # 'papersize': 'letterpaper',

- 

-     # The font size ('10pt', '11pt' or '12pt').

-     #

-     # 'pointsize': '10pt',

- 

-     # Additional stuff for the LaTeX preamble.

-     #

-     # 'preamble': '',

- 

-     # Latex figure (float) alignment

-     #

-     # 'figure_align': 'htbp',

- }

- 

- # Grouping the document tree into LaTeX files. List of tuples

- # (source start file, target name, title,

- #  author, documentclass [howto, manual, or own class]).

- latex_documents = [

-     (master_doc, 'fegistry.tex', 'fegistry Documentation',

-      'Jeremy Cline', 'manual'),

- ]

- 

- 

- # -- Options for manual page output ---------------------------------------

- 

- # One entry per manual page. List of tuples

- # (source start file, name, description, authors, manual section).

- man_pages = [

-     (master_doc, 'fegistry', 'fegistry Documentation',

-      [author], 1)

- ]

- 

- 

- # -- Options for Texinfo output -------------------------------------------

- 

- # Grouping the document tree into Texinfo files. List of tuples

- # (source start file, target name, title, author,

- #  dir menu entry, description, category)

- texinfo_documents = [

-     (master_doc, 'fegistry', 'fegistry Documentation',

-      author, 'fegistry', 'One line description of project.',

-      'Miscellaneous'),

- ]

file removed
-17
@@ -1,17 +0,0 @@ 

- Configuration

- =============

- 

- fegistry can be configured through a `YAML <http://yaml.org/>`_ config file. By default, fegistry

- will load its configuration from ``/etc/fegistry/fegistry.yaml``. You can override the configuration

- path by setting its ``FEGISTRY_CONFIG`` environment variable to an alternate path, if you like.

- fegistry has built-in defaults for all of its configuration items and will use the default for any

- parameters not found in its config file, or if no config file is available for it to use.

- 

- As fegistry is a `Flask <http://flask.pocoo.org>`_ application, there is a set of

- `built-in Flask settings <http://flask.pocoo.org/docs/0.12/config/#builtin-configuration-values>`_

- that you can use in the config file. In addition to these settings, fegistry defines the following

- settings:

- 

- * ``LOG_LEVEL``: The logging level that fegistry should use when logging to syslog. This accepts any

-   of the standard Python `logging levels <https://docs.python.org/3/library/logging.html#levels>`_,

-   and it will even upper case for you if you don't like shouting.

file removed
-118
@@ -1,118 +0,0 @@ 

- Development Guide

- =================

- 

- Contribution guidelines

- -----------------------

- 

- Before you submit a pull request to fegistry, please ensure that it meets these criteria:

- 

- * All tests must pass.

- * Code should have 100% test coverage. This one is particularly important, as we don't want to

-   deploy any broken code into production.

- * Functions, methods, and classes should have docblocks that explain what the code block is, and

-   describing any parameters it accepts and what it returns (if anything).

- * Code should follow `PEP-8 <https://www.python.org/dev/peps/pep-0008>`_. You can use the

-   ``flake8`` utility to automatically check your code. There is a

-   ``fegistry.tests.test_style.TestStyle.test_code_with_flake8`` test, which enforced PEP-8 on the

-   codebase.

- * Sign-off on your commits by adding a line like this to your commit message::

- 

-     Signed-off-by: Your name <you@example.com>

- 

-   This signifies that you have read and agree to the

-   `Developer Certificate of Origin <http://developercertificate.org/>`_ v1.1::

- 

-     Developer Certificate of Origin

-     Version 1.1

- 

-     Copyright (C) 2004, 2006 The Linux Foundation and its contributors.

-     1 Letterman Drive

-     Suite D4700

-     San Francisco, CA, 94129

- 

-     Everyone is permitted to copy and distribute verbatim copies of this

-     license document, but changing it is not allowed.

- 

- 

-     Developer's Certificate of Origin 1.1

- 

-     By making a contribution to this project, I certify that:

- 

-     (a) The contribution was created in whole or in part by me and I

-         have the right to submit it under the open source license

-         indicated in the file; or

- 

-     (b) The contribution is based upon previous work that, to the best

-         of my knowledge, is covered under an appropriate open source

-         license and I have the right under that license to submit that

-         work with modifications, whether created in whole or in part

-         by me, under the same open source license (unless I am

-         permitted to submit under a different license), as indicated

-         in the file; or

- 

-     (c) The contribution was provided directly to me by some other

-         person who certified (a), (b) or (c) and I have not modified

-         it.

- 

-     (d) I understand and agree that this project and the contribution

-         are public and that a record of the contribution (including all

-         personal information I submit with it, including my sign-off) is

-         maintained indefinitely and may be redistributed consistent with

-         this project or the open source license(s) involved.

- 

- 

- Development environment

- -----------------------

- 

- `Vagrant <https://www.vagrantup.com>`_ allows contributors to get quickly up and running with a

- development environment by automatically configuring a virtual machine. Before you get

- started, ensure that your host machine has virtualization extensions enabled in its BIOS so the

- guest doesn't go slower than molasses. To get started, simply

- use these commands::

- 

-     $ sudo dnf install ansible libvirt vagrant-libvirt vagrant-sshfs

-     $ sudo systemctl enable libvirtd

-     $ sudo systemctl start libvirtd

-     $ cp Vagrantfile.example Vagrantfile

-     # Make sure your fegistry checkout is your shell's cwd

-     $ vagrant up

- 

- fegistry is now running in the guest, and port 5000 has been forwarded on your host::

- 

-     $ curl -i http://localhost:5000/v2/

- 	HTTP/1.0 200 OK

- 	Content-Type: application/json

- 	Content-Length: 2

- 	Docker-Distribution-API-Version: registry/2.0

- 	Server: Werkzeug/0.11.10 Python/3.5.2

- 	Date: Thu, 15 Dec 2016 22:04:33 GMT

- 

- 	{}

- 

- You can use ``vagrant ssh`` to ssh into the guest if you like. Inside the guest environment, you

- will find the code shared at ``/home/vagrant/fegistry``. There are some convenient bash aliases::

- 

-     fdocs:    Build the docs. The output will be in /home/vagrant/fegistry/docs/_build/html/ .

-     flog:     Display the development server's log. You can pass a ``-f`` flag to continuously

-               display the log.

-     frestart: Restart the development server. The development server does automatically pick up

-               code changes, so you shouldn't need this much.

-     fstart:   Start the development server.

-     fstop:    Stop the development server.

-     ftest:    Run the test suite.

- 

- 

- ``vagrant ssh`` also accepts a ``-c`` flag that allows you to run a command in the guest. For

- example, you can run the tests wtih ``vagrant ssh -c ftest``.

- 

- When you are done with your Vagrant guest, you can destroy it permanently by running this command on

- the host::

- 

-     $ vagrant destroy

- 

- 

- Build requirements

- ------------------

- 

- The documentation requires Sphinx >= 1.3, so that the napoleon extension is included in the Sphinx

- distribution.

file removed
-27
@@ -1,27 +0,0 @@ 

- .. fegistry documentation master file, created by

-    sphinx-quickstart on Fri Dec 16 14:34:38 2016.

-    You can adapt this file completely to your liking, but it should at least

-    contain the root `toctree` directive.

- 

- Fegistry

- ========

- 

- Fegistry is the container registry endpoint for Fedora's users. It will answer the initial requests

- when users ``docker pull`` Fedora containers.

- 

- .. toctree::

-    :maxdepth: 2

-    :caption: Contents:

- 

-    configuration

-    contributing

-    reference/index

- 

- 

- 

- Indices and tables

- ==================

- 

- * :ref:`genindex`

- * :ref:`modindex`

- * :ref:`search`

@@ -1,21 +0,0 @@ 

- Reference

- =========

- 

- .. automodule:: fegistry

-     :members:

-     :undoc-members:

-     :show-inheritance:

- 

- .. contents::

-     :local:

-     :backlinks: none

- 

- 

- Views

- -----

- 

- .. automodule:: fegistry.views

-     :members:

-     :undoc-members:

-     :show-inheritance:

- 

file removed
-2
@@ -1,2 +0,0 @@ 

- ---

- # LOG_LEVEL: warning

file removed
-21
@@ -1,21 +0,0 @@ 

- # Copyright â“’ 2016 Red Hat, Inc.

- # This file is part of fegistry.

- #

- # fegistry is free software: you can redistribute it and/or modify

- # it under the terms of the GNU General Public License as published by

- # the Free Software Foundation, either version 3 of the License, or

- # (at your option) any later version.

- #

- # fegistry is distributed in the hope that it will be useful,

- # but WITHOUT ANY WARRANTY; without even the implied warranty of

- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

- # GNU General Public License for more details.

- #

- # You should have received a copy of the GNU General Public License

- # along with fegistry.  If not, see <http://www.gnu.org/licenses/>.

- """

- Fegistry is a small flask application designed to handle requests

- for Fedora containers.

- """

- 

- __version__ = '0.0.0'

file removed
-59
@@ -1,59 +0,0 @@ 

- # Copyright â“’ 2017 Red Hat, Inc.

- # This file is part of fegistry.

- #

- # fegistry is free software: you can redistribute it and/or modify

- # it under the terms of the GNU General Public License as published by

- # the Free Software Foundation, either version 3 of the License, or

- # (at your option) any later version.

- #

- # fegistry is distributed in the hope that it will be useful,

- # but WITHOUT ANY WARRANTY; without even the implied warranty of

- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

- # GNU General Public License for more details.

- #

- # You should have received a copy of the GNU General Public License

- # along with fegistry.  If not, see <http://www.gnu.org/licenses/>.

- """

- This module contains code to initialize fegistry's app.config.

- """

- import logging.handlers

- import os

- 

- import yaml

- 

- 

- _DEFAULT_CONFIG = {'LOG_LEVEL': 'WARNING'}

- 

- 

- def load(app):

-     """

-     Load fegistry's configuration into the given app's config attribute. It will first load the

-     default values and then will use either /etc/fegistry/fegistry.yaml, or alternatively a path

-     specified by the environment variable FEGISTRY_CONFIG_FILE, if provided.

-     """

-     app.config.from_mapping(_DEFAULT_CONFIG)

- 

-     if 'FEGISTRY_CONFIG' in os.environ:

-         config_path = os.environ['FEGISTRY_CONFIG']

-     else:

-         config_path = '/etc/fegistry/fegistry.yaml'

- 

-     if os.path.exists(config_path):

-         app.logger.info('Reading config from {}'.format(config_path))

-         with open(config_path) as config_file:

-             config = config_file.read()

-             config = yaml.safe_load(config)

-             if isinstance(config, dict):

-                 app.config.from_mapping(config)

-             else:

-                 app.logger.info(('Config file does not map to an associative array. Using default'

-                                  ' config only'))

-     else:

-         app.logger.info('Config file {} not found. Using default config'.format(config_path))

- 

-     # Set up logging

-     app.config['LOG_LEVEL'] = app.config['LOG_LEVEL'].upper()

-     app.logger.info('Configuring a syslog handler at level: {}'.format(app.config['LOG_LEVEL']))

-     syslog_handler = logging.handlers.SysLogHandler(address='/dev/log')

-     syslog_handler.setLevel(getattr(logging, app.config['LOG_LEVEL']))

-     app.logger.addHandler(syslog_handler)

@@ -1,35 +0,0 @@ 

- # Copyright â“’ 2016 Red Hat, Inc.

- # This file is part of fegistry.

- #

- # fegistry is free software: you can redistribute it and/or modify

- # it under the terms of the GNU General Public License as published by

- # the Free Software Foundation, either version 3 of the License, or

- # (at your option) any later version.

- #

- # fegistry is distributed in the hope that it will be useful,

- # but WITHOUT ANY WARRANTY; without even the implied warranty of

- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

- # GNU General Public License for more details.

- #

- # You should have received a copy of the GNU General Public License

- # along with fegistry.  If not, see <http://www.gnu.org/licenses/>.

- """This test suite contains tests on fegistry.__init__."""

- 

- import imp

- 

- import unittest

- 

- import fegistry

- 

- 

- # Since setup.py imports fegistry to get the version before launching nose/coverage, coverage thinks

- # we are missing coverage on fegistry's top level __init__.py. We can use imp.reload() to make

- # coverage happy. Plus, why not assert that the __version__ is a string while we're at it?

- imp.reload(fegistry)

- 

- 

- class TestVersion(unittest.TestCase):

-     """This test class contains tests on the __version__ attribute."""

-     def test___version__(self):

-         """Make sure the version is a string."""

-         self.assertTrue(isinstance(fegistry.__version__, str))

@@ -1,132 +0,0 @@ 

- # Copyright â“’ 2017 Red Hat, Inc.

- # This file is part of fegistry.

- #

- # fegistry is free software: you can redistribute it and/or modify

- # it under the terms of the GNU General Public License as published by

- # the Free Software Foundation, either version 3 of the License, or

- # (at your option) any later version.

- #

- # fegistry is distributed in the hope that it will be useful,

- # but WITHOUT ANY WARRANTY; without even the implied warranty of

- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

- # GNU General Public License for more details.

- #

- # You should have received a copy of the GNU General Public License

- # along with fegistry.  If not, see <http://www.gnu.org/licenses/>.

- """This test suite contains tests on fegistry.config."""

- import logging

- import mock

- import unittest

- 

- import flask

- 

- from fegistry import config

- 

- 

- class LoadTestCase(unittest.TestCase):

-     """A test class for testing the load() function."""

-     @mock.patch('fegistry.config.open',

-                 mock.mock_open(read_data='# Some comment\n---\n# LOG_LEVEL: ERROR'))

-     @mock.patch('fegistry.config.os.path.exists', return_value=True)

-     def test_empty_config_file(self, exists):

-         """Ensure that fegistry can handle an empty config file, and uses defaults in this case."""

-         app = flask.Flask('test')

- 

-         with mock.patch.object(app.logger, 'info'):

-             with mock.patch.object(app.logger, 'addHandler'):

-                 config.load(app)

- 

-                 self.assertEqual(app.logger.addHandler.call_count, 1)

-                 handler = app.logger.addHandler.mock_calls[0][1][0]

- 

-             info_logs = '\n'.join(c[1][0] for c in app.logger.info.mock_calls)

-             self.assertEqual(

-                 info_logs,

-                 ('Reading config from /etc/fegistry/fegistry.yaml\nConfig file does not map to an '

-                  'associative array. Using default config only\nConfiguring a syslog handler at '

-                  'level: WARNING'))

- 

-         exists.assert_called_once_with('/etc/fegistry/fegistry.yaml')

-         self.assertTrue(isinstance(handler, logging.handlers.SysLogHandler))

-         self.assertEqual(handler.address, '/dev/log')

-         # The default value of WARNING should have been used since the config file was just comments

-         self.assertEqual(handler.level, logging.WARNING)

- 

-     @mock.patch('fegistry.config.open',

-                 mock.mock_open(read_data='# Some comment\n---\nLOG_LEVEL: ERROR'))

-     @mock.patch('fegistry.config.os.path.exists', return_value=True)

-     @mock.patch.dict('fegistry.config.os.environ', {'FEGISTRY_CONFIG': '/some/custom.yaml'})

-     def test_fegistry_config_env_var_provided(self, exists):

-         """Ensure correct operation when the FEGISTRY_CONFIG environment variable is provided."""

-         app = flask.Flask('test')

- 

-         with mock.patch.object(app.logger, 'info'):

-             with mock.patch.object(app.logger, 'addHandler'):

-                 config.load(app)

- 

-                 self.assertEqual(app.logger.addHandler.call_count, 1)

-                 handler = app.logger.addHandler.mock_calls[0][1][0]

- 

-             info_logs = '\n'.join(c[1][0] for c in app.logger.info.mock_calls)

-             self.assertEqual(

-                 info_logs,

-                 ('Reading config from /some/custom.yaml\nConfiguring a syslog handler at level: '

-                  'ERROR'))

- 

-         exists.assert_called_once_with('/some/custom.yaml')

-         self.assertTrue(isinstance(handler, logging.handlers.SysLogHandler))

-         self.assertEqual(handler.address, '/dev/log')

-         # The ERROR log level should have been used since the config file was configured as such.

-         self.assertEqual(handler.level, logging.ERROR)

- 

-     @mock.patch('fegistry.config.os.path.exists', return_value=False)

-     def test_missing_config_file(self, exists):

-         """Ensure that a missing config file is handled gracefully, with a log message and the use

-            of defaults."""

-         app = flask.Flask('test')

- 

-         with mock.patch.object(app.logger, 'info'):

-             with mock.patch.object(app.logger, 'addHandler'):

-                 config.load(app)

- 

-                 self.assertEqual(app.logger.addHandler.call_count, 1)

-                 handler = app.logger.addHandler.mock_calls[0][1][0]

- 

-             info_logs = '\n'.join(c[1][0] for c in app.logger.info.mock_calls)

-             self.assertEqual(

-                 info_logs,

-                 ('Config file /etc/fegistry/fegistry.yaml not found. Using default config\n'

-                  'Configuring a syslog handler at level: WARNING'))

- 

-         exists.assert_called_once_with('/etc/fegistry/fegistry.yaml')

-         self.assertTrue(isinstance(handler, logging.handlers.SysLogHandler))

-         self.assertEqual(handler.address, '/dev/log')

-         # The default value of WARNING should have been used since the config file didn't exist

-         self.assertEqual(handler.level, logging.WARNING)

- 

-     @mock.patch('fegistry.config.open',

-                 mock.mock_open(read_data='# Some comment\n---\nLOG_LEVEL: DEBUG'))

-     @mock.patch('fegistry.config.os.path.exists', return_value=True)

-     def test_with_config_file(self, exists):

-         """Ensure correct operation when the FEGISTRY_CONFIG environment variable is not

-            provided and the config file is not empty."""

-         app = flask.Flask('test')

- 

-         with mock.patch.object(app.logger, 'info'):

-             with mock.patch.object(app.logger, 'addHandler'):

-                 config.load(app)

- 

-                 self.assertEqual(app.logger.addHandler.call_count, 1)

-                 handler = app.logger.addHandler.mock_calls[0][1][0]

- 

-             info_logs = '\n'.join(c[1][0] for c in app.logger.info.mock_calls)

-             self.assertEqual(

-                 info_logs,

-                 ('Reading config from /etc/fegistry/fegistry.yaml\nConfiguring a syslog handler at '

-                  'level: DEBUG'))

- 

-         exists.assert_called_once_with('/etc/fegistry/fegistry.yaml')

-         self.assertTrue(isinstance(handler, logging.handlers.SysLogHandler))

-         self.assertEqual(handler.address, '/dev/log')

-         # The DEBUG log level should have been used since the config file was configured as such.

-         self.assertEqual(handler.level, logging.DEBUG)

@@ -1,36 +0,0 @@ 

- # Copyright â“’ 2016 Red Hat, Inc.

- # This file is part of fegistry.

- #

- # fegistry is free software: you can redistribute it and/or modify

- # it under the terms of the GNU General Public License as published by

- # the Free Software Foundation, either version 3 of the License, or

- # (at your option) any later version.

- #

- # fegistry is distributed in the hope that it will be useful,

- # but WITHOUT ANY WARRANTY; without even the implied warranty of

- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

- # GNU General Public License for more details.

- #

- # You should have received a copy of the GNU General Public License

- # along with fegistry.  If not, see <http://www.gnu.org/licenses/>.

- """This test suite enforces code style automatically."""

- 

- import os

- import subprocess

- import unittest

- 

- 

- REPO_PATH = os.path.abspath(

-     os.path.dirname(os.path.join(os.path.dirname(__file__), '..', '..', '..')))

- 

- 

- class TestStyle(unittest.TestCase):

-     """This test class contains tests pertaining to code style."""

-     def test_code_with_flake8(self):

-         """Enforce PEP-8 compliance on the codebase.

- 

-         This test runs flake8 on the code.

-         """

-         flake8_command = ['python3-flake8', '--max-line-length', '100', REPO_PATH]

- 

-         self.assertEqual(subprocess.call(flake8_command), 0)

@@ -1,53 +0,0 @@ 

- # Copyright â“’ 2016 Red Hat, Inc.

- # This file is part of fegistry.

- #

- # fegistry is free software: you can redistribute it and/or modify

- # it under the terms of the GNU General Public License as published by

- # the Free Software Foundation, either version 3 of the License, or

- # (at your option) any later version.

- #

- # fegistry is distributed in the hope that it will be useful,

- # but WITHOUT ANY WARRANTY; without even the implied warranty of

- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

- # GNU General Public License for more details.

- #

- # You should have received a copy of the GNU General Public License

- # along with fegistry.  If not, see <http://www.gnu.org/licenses/>.

- """This test suite contains tests on fegistry.views."""

- 

- import json

- import unittest

- 

- import flask

- 

- from fegistry import views

- 

- 

- class ViewsTestCase(unittest.TestCase):

-     """A superclass for testing the views module."""

-     def setUp(self):

-         views.app.config['TESTING'] = True

-         self.app = views.app.test_client()

- 

- 

- class TestAddDockerHeaders(unittest.TestCase):

-     """This test class contains tests on the add_docker_headers() function."""

-     def test_add_docker_headers(self):

-         """Assert correct behavior when the status code is 200."""

-         response = flask.Response(status="200")

- 

-         response = views.add_docker_headers(response)

- 

-         self.assertEqual(response.headers['Docker-Distribution-API-Version'], 'registry/2.0')

- 

- 

- class Testv2(ViewsTestCase):

-     """This test class tests the v2() function."""

-     def test_v2(self):

-         """Check the /v2/ handler."""

-         response = self.app.get('/v2/')

- 

-         self.assertEqual(response.status_code, 200)

-         self.assertEqual(json.loads(response.get_data().decode('utf-8')), {})

-         self.assertEqual(response.headers['Docker-Distribution-API-Version'], 'registry/2.0')

-         self.assertEqual(response.headers['Content-Type'], 'application/json')

file removed
-48
@@ -1,48 +0,0 @@ 

- # Copyright â“’ 2016, 2017 Red Hat, Inc.

- # This file is part of fegistry.

- #

- # fegistry is free software: you can redistribute it and/or modify

- # it under the terms of the GNU General Public License as published by

- # the Free Software Foundation, either version 3 of the License, or

- # (at your option) any later version.

- #

- # fegistry is distributed in the hope that it will be useful,

- # but WITHOUT ANY WARRANTY; without even the implied warranty of

- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

- # GNU General Public License for more details.

- #

- # You should have received a copy of the GNU General Public License

- # along with fegistry.  If not, see <http://www.gnu.org/licenses/>.

- import flask

- 

- from fegistry import config

- 

- 

- app = flask.Flask(__name__)

- config.load(app)

- 

- 

- @app.after_request

- def add_docker_headers(response):

-     """

-     Add the necessary Docker headers to every response.

- 

-     Args:

-         response (flask.Response): The :class:`flask.Response` to modify

- 

-     Returns:

-         flask.Response: The modified flask response

-     """

-     response.headers['Docker-Distribution-API-Version'] = 'registry/2.0'

-     return response

- 

- 

- @app.route('/v2/')

- def v2():

-     """

-     Answer the GET /v2/ API call with {}.

- 

-     Returns:

-         flask.Response: A JSON response

-     """

-     return flask.json.jsonify({})

file removed
-8
@@ -1,8 +0,0 @@ 

- [nosetests]

- cover-erase=TRUE

- cover-inclusive=TRUE

- cover-min-percentage=100

- cover-package=fegistry

- cover-xml=TRUE

- with-coverage=TRUE

- with-xunit=TRUE

file removed
-52
@@ -1,52 +0,0 @@ 

- #!/usr/bin/env python3

- # Copyright â“’ 2016, 2017 Red Hat, Inc.

- # This file is part of fegistry.

- #

- # fegistry is free software: you can redistribute it and/or modify

- # it under the terms of the GNU General Public License as published by

- # the Free Software Foundation, either version 3 of the License, or

- # (at your option) any later version.

- #

- # fegistry is distributed in the hope that it will be useful,

- # but WITHOUT ANY WARRANTY; without even the implied warranty of

- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

- # GNU General Public License for more details.

- #

- # You should have received a copy of the GNU General Public License

- # along with fegistry.  If not, see <http://www.gnu.org/licenses/>.

- import os

- 

- from setuptools import setup, find_packages

- 

- import fegistry

- 

- 

- here = os.path.abspath(os.path.dirname(__file__))

- README = open(os.path.join(here, 'README.md')).read()

- VERSION = fegistry.__version__

- 

- # Possible options are at https://pypi.python.org/pypi?%3Aaction=list_classifiers

- CLASSIFIERS = [

-     'Development Status :: 2 - Pre-Alpha',

-     'Framework :: Flask',

-     'Intended Audience :: Developers',

-     'Intended Audience :: System Administrators',

-     'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',

-     'Operating System :: POSIX :: Linux',

-     'Programming Language :: Python :: 3 :: Only',

-     'Topic :: System :: Software Distribution']

- LICENSE = 'GPLv3'

- MAINTAINER = 'Fedora Infrastructure Team'

- MAINTAINER_EMAIL = 'infrastructure@lists.fedoraproject.org'

- PLATFORMS = ['Fedora', 'GNU/Linux']

- URL = 'https://pagure.io/fegistry'

- 

- 

- setup(

-     name='fegistry', version=VERSION, description='The Fedora registry endpoint.',

-     long_description=README, classifiers=CLASSIFIERS, license=LICENSE, maintainer=MAINTAINER,

-     maintainer_email=MAINTAINER_EMAIL, platforms=PLATFORMS, url=URL, keywords='fedora',

-     packages=find_packages(exclude=('fegistry.tests', 'fegistry.tests.*')),

-     include_package_data=True, zip_safe=False, install_requires=['flask', 'PyYAML'],

-     tests_require=['flake8', 'mock', 'nose', 'nose-cov'],

-     test_suite="nose.collector")