Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add domain name for fqdn if host has short name #152

Merged
merged 1 commit into from
Nov 25, 2021

Conversation

Tiboris
Copy link
Member

@Tiboris Tiboris commented Nov 25, 2021

Append the meta_domain["name"] to the hostname
of the resource where name is not fqdn to get one

Signed-off-by: Tibor Dudlák tdudlak@redhat.com

@Tiboris Tiboris added the bug Something isn't working label Nov 25, 2021
Copy link
Contributor

@pvoborni pvoborni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving.

Though I was wondering if we should attempt to fix typos like: hostname = "short.bar.testt", domain = "bar.test". In this case shortname will be: short and fqdn will be: short.bar.testt.bar.test. Alternative implementation can be also get_shortname(name) + "." + dom_nam. But I'm not sure what is better.

@pvoborni pvoborni self-assigned this Nov 25, 2021
@pvoborni
Copy link
Contributor

I think we should also extend https://github.com/neoave/mrack/blob/master/tests/unit/test_ansible_inventory.py with tests to ensure that hostname, fqdn are generated according to expectations to prevent future regressions. Could be a separate PR. Will you write it or should I?

Append the meta_domain["name"] to the hostname
of the resource where name is not fqdn to get one

Signed-off-by: Tibor Dudlák <tdudlak@redhat.com>
@pvoborni
Copy link
Contributor

For referene, verified via:

Input:

domains:
  - name: foo.bar
    type: ipa
    hosts:
      # FQDN
      - name: first.foo.bar
        role: master
        group: ipaserver
        os: rhel-8.4
      # Short name
      - name: client
        role: client
        group: ipaserver
        os: rhel-8.4
      # Invalid name as it is FQDN which does not belong into domain
      - name: client2.invalid
        role: client
        group: ipaserver
        os: rhel-8.4
      # Invalid name as it is FQDN with a sub domain - should be defined as
      # a separate domain
      - name: client2.invalid.foo.bar
        role: client
        group: ipaserver
        os: rhel-8.4

output, reduced to 4 variables per host:

2021-11-25T15:33:42       hosts:
2021-11-25T15:33:42         client:
2021-11-25T15:33:42           meta_dc_record: DC=foo,DC=bar
2021-11-25T15:33:42           meta_domain: foo.bar
2021-11-25T15:33:42           meta_fqdn: client.foo.bar
2021-11-25T15:33:42           meta_hostname: client
2021-11-25T15:33:42         client2.invalid:
2021-11-25T15:33:42           meta_dc_record: DC=foo,DC=bar
2021-11-25T15:33:42           meta_domain: foo.bar
2021-11-25T15:33:42           meta_fqdn: client2.foo.bar
2021-11-25T15:33:42           meta_hostname: client2
2021-11-25T15:33:42         client2.invalid.foo.bar:
2021-11-25T15:33:42           meta_dc_record: DC=foo,DC=bar
2021-11-25T15:33:42           meta_domain: foo.bar
2021-11-25T15:33:42           meta_fqdn: client2.foo.bar
2021-11-25T15:33:42           meta_hostname: client2
2021-11-25T15:33:42         first.foo.bar:
2021-11-25T15:33:42           meta_dc_record: DC=foo,DC=bar
2021-11-25T15:33:42           meta_domain: foo.bar
2021-11-25T15:33:42           meta_fqdn: first.foo.bar
2021-11-25T15:33:42           meta_hostname: first



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants