Remove the sample .conf file

The sample configuration file is almost never up to date as it has to
be updated by a person submitting a patch.

The implementation of published autogenerated sample config files in
documentation was done in I88a2429dd3cacd1d014b5b441b98fbfee7e1e208
and in If00cd3bcc654a45944c0bc8b3f146c75bd970f9a. These generate
sample configuration files and publish them in the documentation on
every commit, ensuring that they are always up to date, and not
requiring human intervention to be updated.

As has been done with nova (in Mitaka), cinder (in Newton), and
neutron (in Newton) this patch removes the sample config file from the
git tree and replaces it with a README file explaining how to generate
them, or where to find the latest published versions in the online
documentation.

This commit also breaks a related testcase into two distinct tests for
easier readability, making it clearer what the behavior is through one
assertion/concept per test.

Depends-On: https://review.openstack.org/#/c/562007/
Change-Id: Ic4d6a98035f59b6ebe48d9c85af50fc9408fc3ab
This commit is contained in:
Jesse Pretorius 2017-11-18 11:26:02 +00:00 committed by Lance Bragstad
parent 56237b709e
commit 3ffee23599
4 changed files with 35 additions and 2946 deletions

1
.gitignore vendored
View File

@ -36,6 +36,7 @@ keystone/locale/*/LC_MESSAGES/*.mo
releasenotes/build
# sample config included in docs
doc/source/_static/keystone.conf.sample
etc/keystone.conf.sample
# sample policy file included in docs
doc/source/_static/keystone.policy.yaml.sample
etc/keystone.policy.yaml.sample

9
etc/README.txt Normal file
View File

@ -0,0 +1,9 @@
To generate the sample keystone.conf and keystone.policy.yaml files, run the
following commands from the top level of the keystone directory:
tox -egenconfig
tox -egenpolicy
For a pre-generated example of the latest files, see:
https://docs.openstack.org/keystone/latest/configuration/samples/index.html

File diff suppressed because it is too large Load Diff

View File

@ -12,8 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
import uuid
from oslo_config import generator
import keystone.conf
from keystone import exception
from keystone.server import wsgi
@ -27,22 +30,30 @@ class ConfigTestCase(unit.TestCase):
def config_files(self):
config_files = super(ConfigTestCase, self).config_files()
# Insert the keystone sample as the first config file to be loaded
# since it is used in one of the code paths to determine the paste-ini
# location.
config_files.insert(0, unit.dirs.etc('keystone.conf.sample'))
# NOTE(lbragstad): This needs some investigation, but CONF.find_file()
# apparently needs the sample configuration file in order to find the
# paste file. This should really be replaced by just setting the
# default configuration directory on the config object instead.
sample_file = 'keystone.conf.sample'
args = ['--namespace', 'keystone', '--output-file',
unit.dirs.etc(sample_file)]
generator.main(args=args)
config_files.insert(0, unit.dirs.etc(sample_file))
self.addCleanup(os.remove, unit.dirs.etc(sample_file))
return config_files
def test_paste_config(self):
self.assertEqual(unit.dirs.etc('keystone-paste.ini'),
wsgi.find_paste_config())
self.config_fixture.config(group='paste_deploy',
config_file=uuid.uuid4().hex)
self.assertRaises(exception.ConfigFileNotFound,
wsgi.find_paste_config)
self.config_fixture.config(group='paste_deploy', config_file='')
self.assertEqual(unit.dirs.etc('keystone.conf.sample'),
wsgi.find_paste_config())
def test_default_paste_config_location_succeeds(self):
paste_file_location = unit.dirs.etc(CONF.paste_deploy.config_file)
self.assertEqual(paste_file_location, wsgi.find_paste_config())
def test_invalid_paste_file_location_fails(self):
self.config_fixture.config(
group='paste_deploy', config_file=uuid.uuid4().hex
)
self.assertRaises(
exception.ConfigFileNotFound, wsgi.find_paste_config
)
def test_config_default(self):
self.assertIsNone(CONF.auth.password)