Commit cc6d57c6 authored by Jürgen Haas's avatar Jürgen Haas

Enhance feature branch deployments

parent 3fa6ebac
Pipeline #7751 passed with stage
in 7 minutes and 9 seconds
# python 3 headers, required if submitting to Ansible
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
lookup: id_from_branch
author: Juergen Haas <>
version_added: "0.9"
short_description: get the initial numeric id from a feature branch with pattern "feature/ID-some-name-for-the-branch"
- Same as short description ;-)
description: branch names
required: True
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.plugins.lookup import LookupBase
from subprocess import Popen, PIPE, STDOUT
import os
from __main__ import display
except ImportError:
from ansible.utils.display import Display
display = Display()
class LookupModule(LookupBase):
def run(self, terms, variables=None, **kwargs):
ret = ''
for term in terms:
display.debug("ID lookup using %s" % term)
display.vvvv(u"ID lookup using %s" % term)
parts = term.split('/')
if len(parts) == 2:
subparts = parts[1].split('-')
id = int(subparts[0])
if id >= 1 and id <=9:
ret = id
except Exception:
return [ret]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment