
    VhI                         d dl mZmZmZ eZd dlmZ d dlm	Z	 	 d dl
mZ dZdZdZdZdd	Z G d
 de      Zy# e$ rZeZY dZ["dZ[ww xY w)    )absolute_importdivisionprint_function)AnsibleError)
raise_from)FQDNNa  
name: fqdn_valid
short_description: Validates fully-qualified domain names against RFC 1123
version_added: 8.1.0
author: Vladimir Botka (@vbotka)
requirements:
  - fqdn>=1.5.1 (PyPI)
description:
  - This test validates Fully Qualified Domain Names (FQDNs)
    conforming to the Internet Engineering Task Force specification
    RFC 1123 and RFC 952.
  - The design intent is to validate that a string would be
    traditionally acceptable as a public Internet hostname to
    RFC-conforming software, which is a strict subset of the logic
    in modern web browsers like Mozilla Firefox and Chromium that
    determines whether make a DNS lookup.
  - Certificate Authorities like Let's Encrypt run a narrower set of
    string validation logic to determine validity for issuance. This
    test is not intended to achieve functional parity with CA
    issuance.
  - Single label names are allowed by default (O(min_labels=1)).
options:
  _input:
    description: Name of the host.
    type: str
    required: true
  min_labels:
    description: Required minimum of labels, separated by period.
    default: 1
    type: int
    required: false
  allow_underscores:
    description: Allow underscore characters.
    default: false
    type: bool
    required: false
a  
- name: Make sure that hostname is valid
  ansible.builtin.assert:
    that: hostname is community.general.fqdn_valid

- name: Make sure that hostname is at least 3 labels long (a.b.c)
  ansible.builtin.assert:
    that: hostname is community.general.fqdn_valid(min_labels=3)

- name: Make sure that hostname is at least 2 labels long (a.b). Allow '_'
  ansible.builtin.assert:
    that: hostname is community.general.fqdn_valid(min_labels=2, allow_underscores=True)
z@
_value:
  description: Whether the name is valid.
  type: bool
c                 t    t         rt        t        d      t                t        | ||      }|j                  S )z
    Example:
      - 'srv.example.com' is community.general.fqdn_valid
      - 'foo_bar.example.com' is community.general.fqdn_valid(allow_underscores=True)
    z7Python package fqdn must be installed to use this test.)
min_labelsallow_underscores)ANOTHER_LIBRARY_IMPORT_ERRORr   r   r   is_valid)namer
   r   fobjs       m/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/test/fqdn_valid.py
fqdn_validr   N   s6     $RS(	

 ?PQDMM    c                       e Zd ZdZd Zy)
TestModulezL Ansible test hostname validity.
        https://pypi.org/project/fqdn/
    c                     dt         iS )Nr   )r   )selfs    r   testszTestModule.testsd   s    *
 	
r   N)__name__
__module____qualname____doc__r    r   r   r   r   _   s    
r   r   )   F)
__future__r   r   r   type__metaclass__ansible.errorsr   ansible.module_utils.sixr   fqdnr   r   ImportErrorimp_excDOCUMENTATIONEXAMPLESRETURNr   objectr   r   r   r   <module>r*      si   
 C B ' /( $( $L
"
 
e  +#* +s   8 A	AA	