diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-10-02 18:02:02 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2012-10-07 18:35:03 +0100 |
commit | 73c45025586a2036282ff6789d1f1c05da4b7eba (patch) | |
tree | e083cea74296422a25ee148e061ed5428a18ec6a /simplejenkinsapi | |
parent | bcff4e3d6604481f22264e30bd4bceb4ad02066c (diff) | |
download | jenkinstool-73c45025586a2036282ff6789d1f1c05da4b7eba.tar.gz |
Add set_name method, for the displayName field
If displayName is set, then Jenkins prints that as the name of the
job. If it is absent, then the job's id is used.
It may be convienient to have the id be different to the name.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Diffstat (limited to 'simplejenkinsapi')
-rw-r--r-- | simplejenkinsapi/jobconfig.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/simplejenkinsapi/jobconfig.py b/simplejenkinsapi/jobconfig.py index 286269d..f49c0b2 100644 --- a/simplejenkinsapi/jobconfig.py +++ b/simplejenkinsapi/jobconfig.py @@ -93,6 +93,14 @@ class JobConfig(object): description.clear() description.text = new_description % self._get_params() + def set_name(self, new_name): + displayName = self._tree.find('displayName') + if displayName is not None: + displayName.clear() + else: + displayName = ET.SubElement(self._project, 'displayName') + displayName.text = new_name % self._get_params() + def add_shell_command(self, shell_text): builders = self._project.find('builders') shell = ET.SubElement(builders, 'hudson.tasks.Shell') |