
    VhN
                     R    d Z dZdZddlmZ  G d de      Zd Zedk(  r e        y	y	)
a  
---
module: trait
short_description: Add/Delete a trait from OpenStack
author: OpenStack Ansible SIG
description:
  - Add or Delete a trait from OpenStack
options:
  id:
    description:
      - ID/Name of this trait
    required: true
    type: str
  state:
    description:
      - Should the resource be present or absent.
    choices: [present, absent]
    default: present
    type: str
extends_documentation_fragment:
- openstack.cloud.openstack
z
# Creates a trait with the ID CUSTOM_WINDOWS_SPLA
- openstack.cloud.trait:
      cloud: openstack
      state: present
      id: CUSTOM_WINDOWS_SPLA
z
trait:
    description: Dictionary describing the trait.
    returned: On success when I(state) is 'present'
    type: dict
    contains:
        id:
            description: ID of the trait.
            returned: success
            type: str
    )OpenStackModulec                   `    e Zd Z e ed       edddg            Z ed      Zd Zd	 Zy
)TraitModuleT)requiredpresentabsent)defaultchoices)idstate)supports_check_modec                 B    | j                   d   }|dk(  r|sy|dk(  r|ryy)Nr   r   Tr   F)params)selftraitr   s      i/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/openstack/cloud/plugins/modules/trait.py_system_state_changez TraitModule._system_state_changeB   s-    G$IeH    c                    | j                   d   }| j                   d   }	 | j                  j                  j                  |      }| j                  j                  r"| j                  | j                  |      |       d}|dk(  rM|s'| j                  j                  j                  |      }d}| j                  ||j                  d             y |dk(  rN|r9| j                  j                  j                  |d	       | j                  d
       | j                  d
       y y # | j                  j
                  j                  $ r d }Y w xY w)Nr   r   )changedr   Fr   T)computedr   )ignore_missing)r   )r   conn	placement	get_traitsdk
exceptionsNotFoundExceptionansible
check_mode	exit_jsonr   create_traitto_dictdelete_trait)r   r   r   r   r   s        r   runzTraitModule.runJ   s)   G$[[	II''11"5E <<""NN4#<#<U#C5NQI		++88<NNu}}e}'D  F h		##00E0Jt,NN5N)  xx""44 	E	s   %D% %%EEN)__name__
__module____qualname__dictargument_specmodule_kwargsr   r%    r   r   r   r   6   s?    9$i02M  M*r   r   c                  &    t               }  |         y )N)r   )modules    r   mainr/   h   s    ]F
Hr   __main__N)DOCUMENTATIONEXAMPLESRETURNBansible_collections.openstack.cloud.plugins.module_utils.openstackr   r   r/   r&   r,   r   r   <module>r5      sE   .

/*/ /*d
 zF r   