Enhancement #1845

Hosts: add host with dhcp reservation to /etc/hosts

Added by Giacomo Sanchietti over 8 years ago. Updated about 8 years ago.

Status:CLOSEDStart date:
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:nethserver-hosts
Target version:v6.4-beta1
Resolution: NEEDINFO:

Description

Add all host record of type local to /etc/hosts.

etc/e-smith/templates/etc/hosts/40hosts_local

#
# 40hosts_local
#
{
    use esmith::HostsDB;
    my $hdb = esmith::HostsDB->open_ro() || return '# hosts DB is not available';

    $OUT = '';

    foreach my $host ($hdb->get_all_by_prop('type', 'local'))
    {
        my $IpAddress = $host->prop('IpAddress') || '';

    if ($IpAddress eq '') {
        # skip all entries without an IP
        next;
    }

    my $Description = $host->prop('Description') || "";
        $OUT .= "# ${Description}\n" if($Description);
        $OUT .= sprintf "%-18s %s\n", $IpAddress, $host->key;
    }

    $OUT;
}

Associated revisions

Revision 16ac969e
Added by Giacomo Sanchietti over 8 years ago

/etc/hosts template: add hosts of type local. Refs #1845

History

#1 Updated by Giacomo Sanchietti over 8 years ago

  • Description updated (diff)

#2 Updated by Giacomo Sanchietti over 8 years ago

  • Subject changed from Dnsmasq: add host with dhcp reservation to /etc/hosts to Hosts: add host with dhcp reservation to /etc/hosts
  • Status changed from NEW to ON_DEV

#3 Updated by Giacomo Sanchietti over 8 years ago

  • Status changed from ON_DEV to MODIFIED
  • % Done changed from 0 to 100
  • Estimated time set to 0.50

Done.

#4 Updated by Davide Principi about 8 years ago

  • Status changed from MODIFIED to CLOSED

Also available in: Atom PDF