Fix integration with Zuul before release
* Make default config files location a class attribute * Add missing __init__.py file * Fix incorrect parameter "change_ids" to "changes" in promote * Add release notes to documentation Change-Id: Ifdb6186e09cbc52cbcb1aea56863c25ddec22203
This commit is contained in:
parent
4c4171c54e
commit
ab852e407a
@ -14,3 +14,4 @@ Documentation
|
||||
installation
|
||||
configuration
|
||||
commands
|
||||
releasenotes
|
||||
|
5
doc/source/releasenotes.rst
Normal file
5
doc/source/releasenotes.rst
Normal file
@ -0,0 +1,5 @@
|
||||
Release Notes
|
||||
=============
|
||||
|
||||
.. release-notes::
|
||||
:unreleased-version-title: In Development
|
4
releasenotes/notes/initialize_repo-17cb89d5bb13132c.yaml
Normal file
4
releasenotes/notes/initialize_repo-17cb89d5bb13132c.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Repository initialization. The code is imported from zuul.
|
@ -278,7 +278,7 @@ class TestApi(BaseTestCase):
|
||||
prom = client.promote('tenant1', 'check', ['1,1', '2,1'])
|
||||
client.session.post.assert_called_with(
|
||||
'https://fake.zuul/api/tenant/tenant1/promote',
|
||||
json={'change_ids': ['1,1', '2,1'],
|
||||
json={'changes': ['1,1', '2,1'],
|
||||
'pipeline': 'check'}
|
||||
)
|
||||
self.assertEqual(True, prom)
|
||||
|
@ -299,7 +299,7 @@ class TestCmd(BaseTestCase):
|
||||
'--changes', '3,3', '4,1', '5,3'])
|
||||
session.post.assert_called_with(
|
||||
'https://fake.zuul/api/tenant/tenant1/promote',
|
||||
json={'change_ids': ['3,3', '4,1', '5,3'],
|
||||
json={'changes': ['3,3', '4,1', '5,3'],
|
||||
'pipeline': 'gate'}
|
||||
)
|
||||
self.assertEqual(0, exit_code)
|
||||
|
13
zuulclient/__init__.py
Normal file
13
zuulclient/__init__.py
Normal file
@ -0,0 +1,13 @@
|
||||
# Copyright 2020 Red Hat, inc
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
@ -145,7 +145,7 @@ class ZuulRESTClient(object):
|
||||
if not self.auth_token:
|
||||
raise Exception('Auth Token required')
|
||||
args = {'pipeline': pipeline,
|
||||
'change_ids': change_ids}
|
||||
'changes': change_ids}
|
||||
url = urllib.parse.urljoin(
|
||||
self.base_url,
|
||||
'tenant/%s/promote' % tenant)
|
||||
|
@ -24,6 +24,7 @@ class ZuulClient(CLI):
|
||||
app_name = 'zuul-client'
|
||||
app_description = 'Zuul User CLI'
|
||||
log = logging.getLogger("zuul-client")
|
||||
default_config_locations = ['~/.zuul.conf']
|
||||
|
||||
def createParser(self):
|
||||
parser = super(ZuulClient, self).createParser()
|
||||
|
@ -29,6 +29,9 @@ import time
|
||||
class App(object):
|
||||
app_name = None # type: str
|
||||
app_description = None # type: str
|
||||
default_config_locations = ['/etc/zuul/zuul.conf',
|
||||
'~/zuul.conf',
|
||||
'~/.zuul.conf']
|
||||
|
||||
def __init__(self):
|
||||
self.args = None
|
||||
@ -63,7 +66,7 @@ class App(object):
|
||||
if self.args.config:
|
||||
locations = [self.args.config]
|
||||
else:
|
||||
locations = ['~/.zuul.conf']
|
||||
locations = self.default_config_locations
|
||||
for fp in locations:
|
||||
if os.path.exists(os.path.expanduser(fp)):
|
||||
self.config.read(os.path.expanduser(fp))
|
||||
|
Loading…
Reference in New Issue
Block a user