Skip to content

Commit

Permalink
Set the url/uri argument naming right for sendmail plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
bkabrda committed Sep 24, 2015
1 parent 43829a7 commit fdcf9f7
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/configuration_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Some options are also mandatory.

* `pdc_secret` (*optional*, `string`) - name of kubernetes secret to use for plugins communicating with PDC

* `pdc_uri` (*optional*, `string`) - URI of PDC server instance, e.g. `pdc.mycompany.com`
* `pdc_url` (*optional*, `string`) - URL of PDC server instance, e.g. `https://pdc.mycompany.com`

* `smtp_uri` (*optional*, `string`) - URI of SMTP server, e.g. `smtp.mycompany.com`

Expand Down
2 changes: 1 addition & 1 deletion inputs/prod_inner.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"send_on": ["auto_fail"],
"url": "{{OPENSHIFT_URI}}",
"pdc_url": "{{PDC_URL}}",
"smtp_url": "{{SMTP_URL}}",
"smtp_uri": "{{SMTP_URI}}",
"from_address": "osbs@example.com",
"error_addresses": ["errors@example.com"]
},
Expand Down
2 changes: 1 addition & 1 deletion osbs/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def create_prod_build(self, git_uri, git_ref, git_branch, user, component,
yum_repourls=yum_repourls,
pulp_secret=self.build_conf.get_pulp_secret(),
pdc_secret=self.build_conf.get_pdc_secret(),
pdc_uri=self.build_conf.get_pdc_uri(),
pdc_url=self.build_conf.get_pdc_url(),
smtp_uri=self.build_conf.get_smtp_uri(),
use_auth=self.build_conf.get_builder_use_auth(),
pulp_registry=self.os_conf.get_pulp_registry(),
Expand Down
8 changes: 4 additions & 4 deletions osbs/build/build_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,13 @@ def render(self, validate=True):
# but still construct the unique tag
self.template['spec']['output']['to']['name'] = self.spec.image_tag.value

# if we have pdc_uri and smtp_uri, configure sendmail plugin, else remove it
if self.spec.pdc_uri.value and self.spec.smtp_uri.value:
# if we have pdc_url and smtp_uri, configure sendmail plugin, else remove it
if self.spec.pdc_url.value and self.spec.smtp_uri.value:
self.dj.dock_json_set_arg('exit_plugins', 'sendmail', 'url',
self.spec.openshift_uri.value)
self.dj.dock_json_set_arg('exit_plugins', 'sendmail', 'pdc_url',
self.spec.pdc_uri.value)
self.dj.dock_json_set_arg('exit_plugins', 'sendmail', 'smtp_url',
self.spec.pdc_url.value)
self.dj.dock_json_set_arg('exit_plugins', 'sendmail', 'smtp_uri',
self.spec.smtp_uri.value)
self.dj.dock_json_set_arg('exit_plugins', 'sendmail', 'submitter',
self.spec.user.value)
Expand Down
8 changes: 4 additions & 4 deletions osbs/build/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class ProdSpec(CommonSpec):
pulp_secret = BuildParam("pulp_secret", allow_none=True)
pulp_registry = BuildParam("pulp_registry", allow_none=True)
pdc_secret = BuildParam("pdc_secret", allow_none=True)
pdc_uri = BuildParam("pdc_uri", allow_none=True)
pdc_url = BuildParam("pdc_url", allow_none=True)
smtp_uri = BuildParam("smtp_uri", allow_none=True)
nfs_server_path = BuildParam("nfs_server_path", allow_none=True)
nfs_dest_dir = BuildParam("nfs_dest_dir", allow_none=True)
Expand All @@ -183,7 +183,7 @@ def __init__(self):
self.pulp_secret,
self.pulp_registry,
self.pdc_secret,
self.pdc_uri,
self.pdc_url,
self.smtp_uri,
self.nfs_server_path,
self.git_push_url,
Expand All @@ -194,7 +194,7 @@ def set_params(self, sources_command=None, architecture=None, vendor=None,
build_host=None, authoritative_registry=None,
koji_target=None, kojiroot=None, kojihub=None,
source_secret=None, # compatibility name for pulp_secret
pulp_secret=None, pulp_registry=None, pdc_secret=None, pdc_uri=None,
pulp_secret=None, pulp_registry=None, pdc_secret=None, pdc_url=None,
smtp_uri=None, nfs_server_path=None,
nfs_dest_dir=None, git_branch=None, base_image=None,
name_label=None, git_push_url=None, git_push_username=None,
Expand All @@ -211,7 +211,7 @@ def set_params(self, sources_command=None, architecture=None, vendor=None,
self.pulp_secret.value = pulp_secret or source_secret
self.pulp_registry.value = pulp_registry
self.pdc_secret.value = pdc_secret
self.pdc_uri.value = pdc_uri
self.pdc_url.value = pdc_url
self.smtp_uri.value = smtp_uri
self.nfs_server_path.value = nfs_server_path
self.nfs_dest_dir.value = nfs_dest_dir
Expand Down
4 changes: 2 additions & 2 deletions osbs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ def get_pdc_secret(self):
secret = self._get_value("pdc_secret", self.conf_section,
"pdc_secret", can_miss=True)

def get_pdc_uri(self):
return self._get_value("pdc_uri", self.conf_section, "pdc_uri", can_miss=True)
def get_pdc_url(self):
return self._get_value("pdc_url", self.conf_section, "pdc_url", can_miss=True)

def get_smtp_uri(self):
return self._get_value("smtp_uri", self.conf_section, "smtp_uri", can_miss=True)
Expand Down
6 changes: 3 additions & 3 deletions tests/build/test_build_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ def test_with_sendmail_plugin(self):
'build_host': "our.build.host.example.com",
'authoritative_registry': "registry.example.com",
'pdc_secret': secret_name,
'pdc_uri': 'pdc.example.com',
'pdc_url': 'https://pdc.example.com',
'smtp_uri': 'smtp.example.com',
}
build_request.set_params(**kwargs)
Expand All @@ -723,11 +723,11 @@ def test_with_sendmail_plugin(self):
mount_path = pdc_secret[0]['mountPath']
expected = {'args': {'from_address': 'osbs@example.com',
'url': 'http://openshift/',
'pdc_url': 'pdc.example.com',
'pdc_url': 'https://pdc.example.com',
'pdc_secret_path': mount_path,
'send_on': ['auto_fail'],
'error_addresses': ['errors@example.com'],
'smtp_url': 'smtp.example.com',
'smtp_uri': 'smtp.example.com',
'submitter': 'john-foo'},
'name': 'sendmail'}
assert get_plugin(plugins, 'exit_plugins', 'sendmail') == expected

1 comment on commit fdcf9f7

@TomasTomecek
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Please sign in to comment.