consolidate repo option names

live_images:            additional_repos        -> repo
ostree:                 source_repo_from        -> repo_from
                        extra_source_repos      -> repo
ostree_installer:       source_repo_from        -> repo_from

With the change, the phases have consolidate option names for variant
repos and external repos.

Old option names will continue to work, old names will be converted
to new names after validation automatically if new options are not
specified in config.

Signed-off-by: Qixiang Wan <qwan@redhat.com>
This commit is contained in:
Qixiang Wan 2017-02-22 10:48:05 +08:00
parent c93207addb
commit 2ae8710934
11 changed files with 81 additions and 52 deletions

View File

@ -925,7 +925,7 @@ Live Images Settings
* ``ksurl`` (*str*) [optional] -- where to get the kickstart from * ``ksurl`` (*str*) [optional] -- where to get the kickstart from
* ``name`` (*str*) * ``name`` (*str*)
* ``version`` (*str*) * ``version`` (*str*)
* ``additional_repos`` (*list*) -- external repos specified by URL * ``repo`` (*list*) -- external repos specified by URL
* ``repo_from`` (*list*) -- repos from other variants * ``repo_from`` (*list*) -- repos from other variants
* ``specfile`` (*str*) -- for images wrapped in RPM * ``specfile`` (*str*) -- for images wrapped in RPM
* ``scratch`` (*bool*) -- only RPM-wrapped images can use scratch builds, * ``scratch`` (*bool*) -- only RPM-wrapped images can use scratch builds,
@ -935,6 +935,10 @@ Live Images Settings
is ``appliance`` corresponding to ``koji spin-appliance``. is ``appliance`` corresponding to ``koji spin-appliance``.
* ``sign`` (*bool*) -- only RPM-wrapped images can be signed * ``sign`` (*bool*) -- only RPM-wrapped images can be signed
Deprecated options:
* ``additional_repos`` (*list*) -- deprecated, use ``repo`` instead
**live_images_no_rename** **live_images_no_rename**
(*bool*) -- When set to ``True``, filenames generated by Koji will be used. (*bool*) -- When set to ``True``, filenames generated by Koji will be used.
When ``False``, filenames will be generated based on ``image_name_format`` When ``False``, filenames will be generated based on ``image_name_format``
@ -1121,12 +1125,12 @@ a new commit.
* ``treefile`` -- (*str*) Filename of configuration for ``rpm-ostree``. * ``treefile`` -- (*str*) Filename of configuration for ``rpm-ostree``.
* ``config_url`` -- (*str*) URL for Git repository with the ``treefile``. * ``config_url`` -- (*str*) URL for Git repository with the ``treefile``.
* ``source_repo_from`` -- (*str*) Name of variant serving as source repository. * ``repo_from`` -- (*str*) Name of variant serving as source repository.
* ``ostree_repo`` -- (*str*) Where to put the ostree repository * ``ostree_repo`` -- (*str*) Where to put the ostree repository
These keys are optional: These keys are optional:
* ``extra_source_repos`` -- (*[dict]*) Extra source repos to get packages * ``repo`` -- (*[dict]*) Extra source repos to get packages
while composing the OSTree repository. Each dict represents a yum repo. while composing the OSTree repository. Each dict represents a yum repo.
The allowed keys are: The allowed keys are:
@ -1149,6 +1153,11 @@ a new commit.
* ``tag_ref`` -- (*bool*, default ``True``) If set to ``False``, a git * ``tag_ref`` -- (*bool*, default ``True``) If set to ``False``, a git
reference will not be created. reference will not be created.
Deprecated options:
* ``source_repo_from`` -- (*str*) Deprecated, use ``repo_from`` instead.
* ``extra_source_repos`` -- (*[dict]*) Deprecated, use ``repo`` instead.
Example config Example config
-------------- --------------
@ -1159,8 +1168,8 @@ Example config
"x86_64": { "x86_64": {
"treefile": "fedora-atomic-docker-host.json", "treefile": "fedora-atomic-docker-host.json",
"config_url": "https://git.fedorahosted.org/git/fedora-atomic.git", "config_url": "https://git.fedorahosted.org/git/fedora-atomic.git",
"source_repo_from": "Server", "repo_from": "Server",
"extra_source_repos": [ "repo": [
{ {
"name": "repo_a", "name": "repo_a",
"baseurl": "http://example.com/repo/x86_64/os", "baseurl": "http://example.com/repo/x86_64/os",
@ -1193,7 +1202,7 @@ an OSTree repository. This always runs in Koji as a ``runroot`` task.
The configuration dict for each variant arch pair must have this key: The configuration dict for each variant arch pair must have this key:
* ``source_repo_from`` -- (*str|[str]*) Name of variant or a name list of * ``repo_from`` -- (*str|[str]*) Name of variant or a name list of
variants serving as source repositories. variants serving as source repositories.
These keys are optional: These keys are optional:
@ -1220,6 +1229,9 @@ an OSTree repository. This always runs in Koji as a ``runroot`` task.
``template_repo`` needs to point to a Git repository from which to take the ``template_repo`` needs to point to a Git repository from which to take the
templates. templates.
Deprecated options:
* ``source_repo_from`` -- (*str|[str]*) Deprecated, use ``repo_from`` instead.
Example config Example config
-------------- --------------
@ -1228,7 +1240,7 @@ Example config
ostree_installer = [ ostree_installer = [
("^Atomic$", { ("^Atomic$", {
"x86_64": { "x86_64": {
"source_repo_from": "Everything", "repo_from": "Everything",
"release": None, "release": None,
"installpkgs": ["fedora-productimg-atomic"], "installpkgs": ["fedora-productimg-atomic"],
"add_template": ["atomic-installer/lorax-configure-repo.tmpl"], "add_template": ["atomic-installer/lorax-configure-repo.tmpl"],

View File

@ -418,7 +418,10 @@ def _make_schema():
"name": {"type": "string"}, "name": {"type": "string"},
"subvariant": {"type": "string"}, "subvariant": {"type": "string"},
"version": {"type": "string"}, "version": {"type": "string"},
"additional_repos": {"$ref": "#/definitions/strings"}, "repo": {
"$ref": "#/definitions/strings",
"alias": "additional_repos",
},
"repo_from": {"$ref": "#/definitions/strings"}, "repo_from": {"$ref": "#/definitions/strings"},
"specfile": {"type": "string"}, "specfile": {"type": "string"},
"scratch": {"type": "boolean"}, "scratch": {"type": "boolean"},
@ -764,8 +767,14 @@ def _make_schema():
"properties": { "properties": {
"treefile": {"type": "string"}, "treefile": {"type": "string"},
"config_url": {"type": "string"}, "config_url": {"type": "string"},
"source_repo_from": {"type": "string"}, "repo_from": {
"extra_source_repos": {"$ref": "#/definitions/list_of_source_repo_dicts"}, "type": "string",
"alias": "source_repo_from",
},
"repo": {
"$ref": "#/definitions/list_of_source_repo_dicts",
"alias": "extra_source_repos",
},
"keep_original_sources": {"type": "boolean"}, "keep_original_sources": {"type": "boolean"},
"ostree_repo": {"type": "string"}, "ostree_repo": {"type": "string"},
"failable": {"$ref": "#/definitions/list_of_strings"}, "failable": {"$ref": "#/definitions/list_of_strings"},
@ -774,7 +783,7 @@ def _make_schema():
"config_branch": {"type": "string"}, "config_branch": {"type": "string"},
"tag_ref": {"type": "boolean"}, "tag_ref": {"type": "boolean"},
}, },
"required": ["treefile", "config_url", "source_repo_from", "ostree_repo"], "required": ["treefile", "config_url", "repo_from", "ostree_repo"],
"additionalProperties": False, "additionalProperties": False,
}), }),
@ -782,7 +791,10 @@ def _make_schema():
"type": "object", "type": "object",
"properties": { "properties": {
"repo": {"$ref": "#/definitions/strings"}, "repo": {"$ref": "#/definitions/strings"},
"source_repo_from": {"$ref": "#/definitions/strings"}, "repo_from": {
"$ref": "#/definitions/strings",
"alias": "source_repo_from",
},
"release": {"$ref": "#/definitions/optional_string"}, "release": {"$ref": "#/definitions/optional_string"},
"failable": {"$ref": "#/definitions/list_of_strings"}, "failable": {"$ref": "#/definitions/list_of_strings"},
"installpkgs": {"$ref": "#/definitions/list_of_strings"}, "installpkgs": {"$ref": "#/definitions/list_of_strings"},
@ -794,7 +806,7 @@ def _make_schema():
"template_repo": {"type": "string"}, "template_repo": {"type": "string"},
"template_branch": {"type": "string"}, "template_branch": {"type": "string"},
}, },
"required": ["source_repo_from"], "required": ["repo_from"],
"additionalProperties": False, "additionalProperties": False,
}), }),

View File

@ -89,8 +89,8 @@ class Tree(OSTree):
self.extra_config = self.args.extra_config self.extra_config = self.args.extra_config
if self.extra_config: if self.extra_config:
self.extra_config = json.load(open(self.extra_config, 'r')) self.extra_config = json.load(open(self.extra_config, 'r'))
source_repo_from = self.extra_config.get('source_repo_from', None) source_repo_from = self.extra_config.get('repo_from', None)
extra_source_repos = self.extra_config.get('extra_source_repos', []) extra_source_repos = self.extra_config.get('repo', [])
keep_original_sources = self.extra_config.get('keep_original_sources', False) keep_original_sources = self.extra_config.get('keep_original_sources', False)
repos = extra_source_repos + [{'name': 'source_repo_from', 'baseurl': source_repo_from}] repos = extra_source_repos + [{'name': 'source_repo_from', 'baseurl': source_repo_from}]
tweak_treeconf(self.treefile, source_repos=repos, keep_original_sources=keep_original_sources) tweak_treeconf(self.treefile, source_repos=repos, keep_original_sources=keep_original_sources)

View File

@ -64,7 +64,7 @@ class LiveImagesPhase(base.PhaseLoggerMixin, base.ImageConfigMixin, base.ConfigG
self.compose, self.compose.paths.compose.repository(arch, variant, create_dir=False))) self.compose, self.compose.paths.compose.repository(arch, variant, create_dir=False)))
# additional repos # additional repos
repos.extend(data.get("additional_repos", [])) repos.extend(data.get("repo", []))
repos.extend(self._get_extra_repos(arch, variant, force_list(data.get('repo_from', [])))) repos.extend(self._get_extra_repos(arch, variant, force_list(data.get('repo_from', []))))
return repos return repos

View File

@ -46,7 +46,7 @@ class OSTreeThread(WorkerThread):
(arch, variant.uid, self.num)) (arch, variant.uid, self.num))
repodir = os.path.join(workdir, 'config_repo') repodir = os.path.join(workdir, 'config_repo')
source_variant = compose.all_variants[config['source_repo_from']] source_variant = compose.all_variants[config['repo_from']]
source_repo = translate_path(compose, source_repo = translate_path(compose,
compose.paths.compose.repository('$basearch', compose.paths.compose.repository('$basearch',
source_variant, source_variant,
@ -54,10 +54,10 @@ class OSTreeThread(WorkerThread):
self._clone_repo(repodir, config['config_url'], config.get('config_branch', 'master')) self._clone_repo(repodir, config['config_url'], config.get('config_branch', 'master'))
source_repos = [{'name': '%s-%s' % (compose.compose_id, config['source_repo_from']), source_repos = [{'name': '%s-%s' % (compose.compose_id, config['repo_from']),
'baseurl': source_repo}] 'baseurl': source_repo}]
extra_source_repos = config.get('extra_source_repos', None) extra_source_repos = config.get('repo', None)
if extra_source_repos: if extra_source_repos:
for extra in extra_source_repos: for extra in extra_source_repos:
baseurl = extra['baseurl'] baseurl = extra['baseurl']
@ -77,9 +77,9 @@ class OSTreeThread(WorkerThread):
# repos in configuration can have repo url set to variant UID, # repos in configuration can have repo url set to variant UID,
# update it to have the actual url that we just translated. # update it to have the actual url that we just translated.
new_config.update({'source_repo_from': source_repo}) new_config.update({'repo_from': source_repo})
if extra_source_repos: if extra_source_repos:
new_config.update({'extra_source_repos': extra_source_repos}) new_config.update({'repo': extra_source_repos})
# remove unnecessary (for 'pungi-make-ostree tree' script ) elements # remove unnecessary (for 'pungi-make-ostree tree' script ) elements
# from config, it doesn't hurt to have them, however remove them can # from config, it doesn't hurt to have them, however remove them can

View File

@ -47,7 +47,7 @@ class OstreeInstallerThread(WorkerThread):
self.logdir = compose.paths.log.topdir('%s/ostree_installer' % arch) self.logdir = compose.paths.log.topdir('%s/ostree_installer' % arch)
source_from_repos = [self._get_source_repo(compose, arch, v) source_from_repos = [self._get_source_repo(compose, arch, v)
for v in shortcuts.force_list(config['source_repo_from'])] for v in shortcuts.force_list(config['repo_from'])]
repos = shortcuts.force_list(config.pop('repo', [])) repos = shortcuts.force_list(config.pop('repo', []))
source_repos = source_from_repos + repos source_repos = source_from_repos + repos
output_dir = os.path.join(compose.paths.work.topdir(arch), variant.uid, 'ostree_installer') output_dir = os.path.join(compose.paths.work.topdir(arch), variant.uid, 'ostree_installer')

View File

@ -38,6 +38,11 @@ class MockVariant(mock.Mock):
return self.uid return self.uid
class IterableMock(mock.Mock):
def __iter__(self):
return iter([])
class DummyCompose(object): class DummyCompose(object):
def __init__(self, topdir, config): def __init__(self, topdir, config):
self.supported = True self.supported = True

View File

@ -23,7 +23,7 @@ class TestLiveImagesPhase(PungiTestCase):
('^Client$', { ('^Client$', {
'amd64': { 'amd64': {
'kickstart': 'test.ks', 'kickstart': 'test.ks',
'additional_repos': ['http://example.com/repo/'], 'repo': ['http://example.com/repo/'],
'repo_from': ['Everything', 'Server-optional'], 'repo_from': ['Everything', 'Server-optional'],
'release': None, 'release': None,
} }
@ -76,7 +76,7 @@ class TestLiveImagesPhase(PungiTestCase):
('^Client$', { ('^Client$', {
'amd64': { 'amd64': {
'kickstart': 'test.ks', 'kickstart': 'test.ks',
'additional_repos': ['http://example.com/repo/'], 'repo': ['http://example.com/repo/'],
'repo_from': 'Everything', 'repo_from': 'Everything',
'release': None, 'release': None,
} }
@ -124,7 +124,7 @@ class TestLiveImagesPhase(PungiTestCase):
('^Client$', { ('^Client$', {
'amd64': { 'amd64': {
'kickstart': 'test.ks', 'kickstart': 'test.ks',
'additional_repos': ['http://example.com/repo/'], 'repo': ['http://example.com/repo/'],
'repo_from': ['Everything'], 'repo_from': ['Everything'],
'release': None, 'release': None,
} }
@ -171,11 +171,11 @@ class TestLiveImagesPhase(PungiTestCase):
('^Client$', { ('^Client$', {
'amd64': [{ 'amd64': [{
'kickstart': 'test.ks', 'kickstart': 'test.ks',
'additional_repos': ['http://example.com/repo/'], 'repo': ['http://example.com/repo/'],
'repo_from': ['Everything'], 'repo_from': ['Everything'],
}, { }, {
'kickstart': 'another.ks', 'kickstart': 'another.ks',
'additional_repos': ['http://example.com/repo/'], 'repo': ['http://example.com/repo/'],
'repo_from': ['Everything'], 'repo_from': ['Everything'],
}] }]
}) })
@ -244,7 +244,7 @@ class TestLiveImagesPhase(PungiTestCase):
'amd64': { 'amd64': {
'kickstart': 'test.ks', 'kickstart': 'test.ks',
'ksurl': 'https://git.example.com/kickstarts.git?#HEAD', 'ksurl': 'https://git.example.com/kickstarts.git?#HEAD',
'additional_repos': ['http://example.com/repo/'], 'repo': ['http://example.com/repo/'],
'repo_from': ['Everything'], 'repo_from': ['Everything'],
'type': 'appliance', 'type': 'appliance',
} }
@ -299,7 +299,7 @@ class TestLiveImagesPhase(PungiTestCase):
('^Client$', { ('^Client$', {
'amd64': { 'amd64': {
'kickstart': 'test.ks', 'kickstart': 'test.ks',
'additional_repos': ['http://example.com/repo/'], 'repo': ['http://example.com/repo/'],
'repo_from': ['Everything'], 'repo_from': ['Everything'],
'type': 'appliance', 'type': 'appliance',
} }
@ -354,7 +354,7 @@ class TestLiveImagesPhase(PungiTestCase):
('^Client$', { ('^Client$', {
'amd64': { 'amd64': {
'kickstart': 'test.ks', 'kickstart': 'test.ks',
'additional_repos': ['http://example.com/repo/'], 'repo': ['http://example.com/repo/'],
'repo_from': ['Everything'], 'repo_from': ['Everything'],
'type': 'appliance', 'type': 'appliance',
} }
@ -406,7 +406,7 @@ class TestLiveImagesPhase(PungiTestCase):
('^Client$', { ('^Client$', {
'amd64': { 'amd64': {
'kickstart': 'test.ks', 'kickstart': 'test.ks',
'additional_repos': ['http://example.com/repo/'], 'repo': ['http://example.com/repo/'],
'repo_from': ['Everything'], 'repo_from': ['Everything'],
'release': None, 'release': None,
} }

View File

@ -20,7 +20,7 @@ class OstreeInstallerPhaseTest(helpers.PungiTestCase):
@mock.patch('pungi.phases.ostree_installer.ThreadPool') @mock.patch('pungi.phases.ostree_installer.ThreadPool')
def test_run(self, ThreadPool): def test_run(self, ThreadPool):
cfg = mock.Mock() cfg = helpers.IterableMock()
compose = helpers.DummyCompose(self.topdir, { compose = helpers.DummyCompose(self.topdir, {
'ostree_installer': [ 'ostree_installer': [
('^Everything$', {'x86_64': cfg}) ('^Everything$', {'x86_64': cfg})
@ -133,7 +133,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
self.compose.supported = False self.compose.supported = False
pool = mock.Mock() pool = mock.Mock()
cfg = { cfg = {
'source_repo_from': 'Everything', 'repo_from': 'Everything',
'release': '20160321.n.0', 'release': '20160321.n.0',
} }
koji = KojiWrapper.return_value koji = KojiWrapper.return_value
@ -169,7 +169,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
get_file_size, get_mtime, ImageCls, run): get_file_size, get_mtime, ImageCls, run):
pool = mock.Mock() pool = mock.Mock()
cfg = { cfg = {
'source_repo_from': 'http://example.com/repo/$arch/', 'repo_from': 'http://example.com/repo/$arch/',
'release': '20160321.n.0', 'release': '20160321.n.0',
} }
koji = KojiWrapper.return_value koji = KojiWrapper.return_value
@ -203,7 +203,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
get_file_size, get_mtime, ImageCls, run): get_file_size, get_mtime, ImageCls, run):
pool = mock.Mock() pool = mock.Mock()
cfg = { cfg = {
'source_repo_from': 'Everything', 'repo_from': 'Everything',
'release': '20160321.n.0', 'release': '20160321.n.0',
'repo': [ 'repo': [
'https://example.com/extra-repo1.repo', 'https://example.com/extra-repo1.repo',
@ -241,7 +241,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
get_file_size, get_mtime, ImageCls, run): get_file_size, get_mtime, ImageCls, run):
pool = mock.Mock() pool = mock.Mock()
cfg = { cfg = {
'source_repo_from': ['Everything', 'Server'], 'repo_from': ['Everything', 'Server'],
'release': '20160321.n.0', 'release': '20160321.n.0',
'repo': [ 'repo': [
'https://example.com/extra-repo1.repo', 'https://example.com/extra-repo1.repo',
@ -281,7 +281,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
get_mtime, ImageCls, run): get_mtime, ImageCls, run):
pool = mock.Mock() pool = mock.Mock()
cfg = { cfg = {
'source_repo_from': 'Everything', 'repo_from': 'Everything',
'release': '20160321.n.0', 'release': '20160321.n.0',
'add_template': ['some-file.txt'], 'add_template': ['some-file.txt'],
} }
@ -314,7 +314,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
get_dir_from_scm): get_dir_from_scm):
pool = mock.Mock() pool = mock.Mock()
cfg = { cfg = {
'source_repo_from': 'Everything', 'repo_from': 'Everything',
'release': '20160321.n.0', 'release': '20160321.n.0',
'add_template': ['some_file.txt'], 'add_template': ['some_file.txt'],
'add_arch_template': ['other_file.txt'], 'add_arch_template': ['other_file.txt'],
@ -362,7 +362,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
get_file_size, get_mtime, ImageCls, run): get_file_size, get_mtime, ImageCls, run):
pool = mock.Mock() pool = mock.Mock()
cfg = { cfg = {
'source_repo_from': 'Everything', 'repo_from': 'Everything',
'release': None, 'release': None,
"installpkgs": ["fedora-productimg-atomic"], "installpkgs": ["fedora-productimg-atomic"],
"add_template": ["/spin-kickstarts/atomic-installer/lorax-configure-repo.tmpl"], "add_template": ["/spin-kickstarts/atomic-installer/lorax-configure-repo.tmpl"],
@ -423,7 +423,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
get_mtime, ImageCls, run): get_mtime, ImageCls, run):
pool = mock.Mock() pool = mock.Mock()
cfg = { cfg = {
'source_repo_from': 'Everything', 'repo_from': 'Everything',
'release': None, 'release': None,
'failable': ['x86_64'] 'failable': ['x86_64']
} }
@ -449,7 +449,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
get_file_size, get_mtime, ImageCls, run): get_file_size, get_mtime, ImageCls, run):
pool = mock.Mock() pool = mock.Mock()
cfg = { cfg = {
'source_repo_from': 'Everything', 'repo_from': 'Everything',
'release': None, 'release': None,
'failable': ['*'], 'failable': ['*'],
} }

View File

@ -19,7 +19,7 @@ class OSTreePhaseTest(helpers.PungiTestCase):
@mock.patch('pungi.phases.ostree.ThreadPool') @mock.patch('pungi.phases.ostree.ThreadPool')
def test_run(self, ThreadPool): def test_run(self, ThreadPool):
cfg = mock.Mock() cfg = helpers.IterableMock()
compose = helpers.DummyCompose(self.topdir, { compose = helpers.DummyCompose(self.topdir, {
'ostree': [ 'ostree': [
('^Everything$', {'x86_64': cfg}) ('^Everything$', {'x86_64': cfg})
@ -51,7 +51,7 @@ class OSTreeThreadTest(helpers.PungiTestCase):
self.repo = os.path.join(self.topdir, 'place/for/atomic') self.repo = os.path.join(self.topdir, 'place/for/atomic')
os.makedirs(os.path.join(self.repo, 'refs', 'heads')) os.makedirs(os.path.join(self.repo, 'refs', 'heads'))
self.cfg = { self.cfg = {
'source_repo_from': 'Everything', 'repo_from': 'Everything',
'config_url': 'https://git.fedorahosted.org/git/fedora-atomic.git', 'config_url': 'https://git.fedorahosted.org/git/fedora-atomic.git',
'config_branch': 'f24', 'config_branch': 'f24',
'treefile': 'fedora-atomic-docker-host.json', 'treefile': 'fedora-atomic-docker-host.json',
@ -305,8 +305,8 @@ class OSTreeThreadTest(helpers.PungiTestCase):
koji.run_runroot_cmd.side_effect = self._mock_runroot(0) koji.run_runroot_cmd.side_effect = self._mock_runroot(0)
cfg = { cfg = {
'source_repo_from': 'Everything', 'repo_from': 'Everything',
'extra_source_repos': [ 'repo': [
{ {
'name': 'repo_a', 'name': 'repo_a',
'baseurl': 'http://url/to/repo/a', 'baseurl': 'http://url/to/repo/a',
@ -333,9 +333,9 @@ class OSTreeThreadTest(helpers.PungiTestCase):
self.assertTrue(os.path.isfile(extra_config_file)) self.assertTrue(os.path.isfile(extra_config_file))
extra_config = json.load(open(extra_config_file, 'r')) extra_config = json.load(open(extra_config_file, 'r'))
self.assertTrue(extra_config.get('keep_original_sources', False)) self.assertTrue(extra_config.get('keep_original_sources', False))
self.assertEqual(extra_config.get('source_repo_from', None), 'http://example.com/Everything/$basearch/os') self.assertEqual(extra_config.get('repo_from', None), 'http://example.com/Everything/$basearch/os')
self.assertEqual(len(extra_config.get('extra_source_repos', [])), len(cfg['extra_source_repos'])) self.assertEqual(len(extra_config.get('repo', [])), len(cfg['repo']))
self.assertEqual(extra_config.get('extra_source_repos').pop()['baseurl'], 'http://example.com/Server/$basearch/os') self.assertEqual(extra_config.get('repo').pop()['baseurl'], 'http://example.com/Server/$basearch/os')
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

View File

@ -156,8 +156,8 @@ class OstreeTreeScriptTest(helpers.PungiTestCase):
extra_config_file = os.path.join(self.topdir, 'extra_config.json') extra_config_file = os.path.join(self.topdir, 'extra_config.json')
extra_config = { extra_config = {
"source_repo_from": "http://www.example.com/Server.repo", "repo_from": "http://www.example.com/Server.repo",
"extra_source_repos": [ "repo": [
{ {
"name": "optional", "name": "optional",
"baseurl": "http://example.com/repo/x86_64/optional", "baseurl": "http://example.com/repo/x86_64/optional",
@ -230,8 +230,8 @@ class OstreeTreeScriptTest(helpers.PungiTestCase):
extra_config_file = os.path.join(self.topdir, 'extra_config.json') extra_config_file = os.path.join(self.topdir, 'extra_config.json')
extra_config = { extra_config = {
"source_repo_from": "http://www.example.com/Server.repo", "repo_from": "http://www.example.com/Server.repo",
"extra_source_repos": [ "repo": [
{ {
"name": "optional", "name": "optional",
"baseurl": "http://example.com/repo/x86_64/optional", "baseurl": "http://example.com/repo/x86_64/optional",