def _doc_is_active()

in source/Orchestrator/get_approval_requirement.py [0:0]


def _doc_is_active(doc, account):
    try:
        ssm = _get_ssm_client(account, SOLUTION_ID + '-SHARR-Orchestrator-Member')
        docinfo = ssm.describe_document(
            Name=doc
            )['Document']
        
        doctype = docinfo.get('DocumentType', 'unknown')
        docstate = docinfo.get('Status', 'unknown')

        if doctype == "Automation" and \
           docstate == "Active":
            return True
        else:
            return False

    except ClientError as ex:
        exception_type = ex.response['Error']['Code']
        if exception_type in "InvalidDocument":
            return False
        else:
            LOGGER.error('An unhandled client error occurred: ' + exception_type)
            return False

    except Exception as e:
        LOGGER.error('An unhandled error occurred: ' + str(e))
        return False