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

Initialize hosts formula #214

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Initialize hosts formula #214

wants to merge 1 commit into from

Conversation

tacerus
Copy link
Member

@tacerus tacerus commented Nov 7, 2024

No description provided.

Signed-off-by: Georg Pfuetzenreuter <[email protected]>
@cboltz
Copy link
Member

cboltz commented Nov 7, 2024

I have some generic questions about this PR:

  • do you really need a formula for /etc/hosts? (In other words: what's the problem with host.present and host.absent?)
  • what's the reason for introducing hosts AND infrastructure.hosts? I'd say one of them is enough ;-) - and if you really need two variants, I'd prefer an if over duplicated code.

@tacerus
Copy link
Member Author

tacerus commented Nov 7, 2024

Hi @cboltz,

this is indeed a replacement for the hostsfile formula (that is currently used in the openSUSE infrastructure for the purpose of managing /etc/hosts), which, through the use of the host state functions cannot enforce a certain state of /etc/hosts - in other words, there is no clean option to make an entry get removed if it is removed from host.present without also adding it to host.absent.

The infrastructure.hosts state is mainly used to enable the opinionated template adding hosts entries based on data found in our infrastructure and network pillars, using logic which is specific to our infrastructure (for example, it assumes addresses to start with a certain number and interfaces to end with a certain suffix). So far we do not have any opinionated (= specific to our infrastructures) code outside of the infrastructure-formula, and I would prefer not to introduce any.

@tacerus
Copy link
Member Author

tacerus commented Nov 7, 2024

To implement the cleanup logic with the host state functions, one would need to add logic which reads and parses the /etc/hosts file to assess whether entries are still to be managed.

@cboltz
Copy link
Member

cboltz commented Nov 8, 2024

Ok, the missing clean parameter is indeed a good argument to have a hosts formula.

I'm still not convinced that we need hosts and infrastructure.hosts, even if I understand your reasons. For the opinionated part - would making the template file configurable via pillar (and shipping the opinionated version in infrastructure´) be an option so that we don't need to duplicate init.sls, and (more important) don't need the note that hostsandinfrastructure.hosts` conflict?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants