leboncoin/concourse-fiaas-resource

View on GitHub
assets/check

Summary

Maintainability
Test Coverage
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Concourse check resource
"""
# Python 2 and 3 compatibility
from __future__ import unicode_literals

import os.path
import sys

from resource import Resource


class FiaasDeployment(Resource):
    """Concourse resource implementation for FIAAS Deployment"""

    def __init__(self, *args, **kwargs):
        super(self.__class__, self).__init__(*args, **kwargs)

    def check(self, source, version):
        if version:
            ver = version
        else:
            ver = {"version": ""}
        rvalue = [ver]
        rcode = 0
        return rcode, rvalue

if __name__ == '__main__':
    r = FiaasDeployment()
    try:
        rcode = r.run(os.path.basename(__file__))
    except Exception as e:
        sys.stderr.write("ERROR: " + str(e) + "\n")
        sys.exit(1)
    sys.exit(rcode)