diff --git a/da_integrare.spec b/da_integrare.spec deleted file mode 100644 index 0742cb1..0000000 --- a/da_integrare.spec +++ /dev/null @@ -1,97 +0,0 @@ -Summary: apache/mod_php stack for Doraemon -Name: doraemon -Version: 1.3.0.1 -Release: 1%{?dist} -License: GPL -URL: %{url_prefix}/%{name} -BuildArch: noarch - -Source0: %{name}-%{version}.tar.gz - - -BuildRequires: nethserver-devtools - -BuildRequires: systemd -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd - -Requires: httpd, php, sudo, php-xml, php-mcrypt, nethserver-httpd-admin -Requires: nethserver-base, nethserver-php -Requires: nethserver-lang-en - -%description -Runs an Apache instance on port 3000 that serves -the doraemon web application - -%prep -%setup - - -# Nethgui: -cd %{_builddir}/nethgui-%{nethgui_commit} - -%build -perl createlinks -mkdir -p root/%{_nseventsdir}/%{name}-update - -%install -(cd root ; find . -depth -print | cpio -dump %{buildroot}) -rm -f %{name}-%{version}-%{release}-filelist -%{genfilelist} %{buildroot} \ - > %{name}-%{version}-%{release}-filelist -mkdir -p %{buildroot}/%{_localstatedir}/log/doraemon -mkdir -p %{buildroot}/%{_localstatedir}/cache/doraemon - -# Copy the server-manager dir -mkdir -p %{buildroot}%{_nsuidir} -cp -av nethserver-manager %{buildroot}%{_nsuidir}/nethserver-manager - -%files -f %{name}-%{version}-%{release}-filelist -%defattr(-,root,root) -%doc %{extradocs} - -%{_nsuidir}/nethserver-manager - - -%dir %{_nseventsdir}/%{name}-update -%dir %{_sysconfdir}/httpd/doraemon.d - -%attr(0750,srvmgr,srvmgr) %dir %{_localstatedir}/cache/doraemon -%attr(0644,root,root) %ghost %{_sysconfdir}/init/doraemon.conf -%attr(0644,root,root) %ghost %{_sysconfdir}/httpd/doraemon/httpd.conf -%attr(0700,root,root) %dir %{_localstatedir}/log/doraemon -%attr(0644,root,root) %config %ghost %{_localstatedir}/log/doraemon/access_log -%attr(0644,root,root) %config %ghost %{_localstatedir}/log/doraemon/error_log -%config(noreplace) /etc/sysconfig/doraemon - -%post -%systemd_post doraemon.service - -%preun -%systemd_preun doraemon.service - -%postun -%systemd_postun - -%changelog -* Tue Oct 27 2015 Emiliano Vavassori - 1.2.1-2.ns6 -- Packing corrections to rpm to fix upgrading issue - -* Tue Oct 27 2015 Emiliano Vavassori - 1.2.1-1.ns6 -- Packing new minor correction on how packages are extracted from db - -* Mon Sep 11 2015 Emiliano Vavassori - 1.2.0-1.ns6 -- Packing new version with ansible dynamic inventory support, epoptes server role support. - -* Mon Sep 07 2015 Emiliano Vavassori - 1.1.1-1.ns6 -- Packing new version with correct roles. - -* Sun Sep 06 2015 Emiliano Vavassori - 1.1.0-1.ns6 -- Packing new version with new functionalities. - -* Wed Jul 15 2015 Emiliano Vavassori - 1.0.0-2.ns6 -- Added logrotate file. - -* Mon Jul 13 2015 Emiliano Vavassori - 1.0.0-1.ns6 -- Unique binary for both ansiblehelper and mac2hostname. diff --git a/doraemon.spec b/doraemon.spec index 9923f8e..88d21dd 100644 --- a/doraemon.spec +++ b/doraemon.spec @@ -1,15 +1,16 @@ Summary: Helps client to join domain and maintain itself Name: doraemon -Version: 1.2.1 -Release: 2.ns6 +Version: 1.3.0 +Release: 1.ns6 URL: https://github.com/bglug-it/doraemon/ License: GPLv2+ Group: System Environment/Daemons BuildRoot: %{_tmppath}/%{name}-root -Requires: python python-bottle python-crypto2.6 nethserver-base -Requires(post): chkconfig nethserver-base -Requires(preun): chkconfig initscripts nethserver-base -Source0: doraemon-1.2.1.tar.gz +BuildRequires: nethserver-devtools > 1.0.1 +Requires: httpd, php, sudo, php-xml, php-mcrypt +Requires: nethserver-base, nethserver-php +Requires: upstart +Source0: doraemon-1.3.0.tar.gz BuildArch: noarch %description @@ -21,33 +22,20 @@ Helps client on a domain network to get information for its maintenance. %build %install -rm -rf %{buildroot} -install -d %{buildroot} -install -d -m 755 %{buildroot}%{_sysconfdir} -install -m 644 doraemon.ini %{buildroot}%{_sysconfdir}/%{name}.ini -# Installo il servizio -install -d -m 755 %{buildroot}%{_initrddir} -install -m 755 initrd %{buildroot}%{_initrddir}/%{name} -# Installo lo script vero e proprio -install -d -m 755 %{buildroot}%{_bindir} -install -m 755 doraemon.py %{buildroot}%{_bindir}/%{name}.py -# Cartella del database -install -d %{buildroot}%{_sharedstatedir}/%{name} -# File per il rotate -install -d %{buildroot}%{_sysconfdir}/logrotate.d -install -m 644 doraemon.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name} -# File di Nethserver -install -d %{buildroot}%{_sysconfdir}/e-smith/db/configuration/defaults/%{name} -install -m 644 type %{buildroot}%{_sysconfdir}/e-smith/db/configuration/defaults/%{name}/type -install -m 644 status %{buildroot}%{_sysconfdir}/e-smith/db/configuration/defaults/%{name}/status -install -m 644 access %{buildroot}%{_sysconfdir}/e-smith/db/configuration/defaults/%{name}/access -install -m 644 TCPPort %{buildroot}%{_sysconfdir}/e-smith/db/configuration/defaults/%{name}/TCPPort +(cd root ; find . -depth -print | cpio -dump %{buildroot}) +rm -f %{name}-%{version}-%{release}-filelist +%{genfilelist} %{buildroot} > %{name}-%{version}-%{release}-filelist +mkdir -p %{buildroot}%{_localstatedir}/log/doraemon +mkdir -p %{buildroot}%{_localstatedir}/cache/doraemon + +# Copy the webroot dir +# mkdir -p %{buildroot}%{_datarootdir}/%{name} +# cp -av doraemon/* %{buildroot}%{_datadir}/%{name} %post if [ "$1" = 1 ]; then - /sbin/chkconfig --add %{name} - /sbin/service %{name} start >/dev/null 2>&1 - /sbin/e-smith/db configuration set %{name} service status enabled TCPPort 3000 access private + /sbin/start %{name} >/dev/null 2>&1 || : + /sbin/e-smith/db configuration set %{name} service status enabled TCPPort 3000 access private DefaultRole client DomainFile /etc/domain.yml ManagementKeyFile /home/amgmt/.ssh/id_rsa.pub NamingBase lab NamingDigits 2 VaultPassFile /home/amgmt/.ansible/vault.txt /sbin/e-smith/signal-event runlevel-adjust /sbin/e-smith/signal-event firewall-adjust fi @@ -55,8 +43,7 @@ fi %preun if [ "$1" = 0 ]; then /sbin/e-smith/db configuration delete %{name} - /sbin/service %{name} stop >/dev/null 2>&1 - chkconfig --del %{name} + /sbin/stop %{name} >/dev/null 2>&1 || : /sbin/e-smith/signal-event runlevel-adjust /sbin/e-smith/signal-event firewall-adjust fi @@ -64,22 +51,26 @@ fi %clean rm -rf %{buildroot} +%files -f %{name}-%{version}-%{release}-filelist %files %defattr(644,root,root,755) -%doc README.md LICENSE -%config(noreplace) %{_sysconfdir}/%{name}.ini -%attr(755,-,-) %{_initrddir}/%{name} -%attr(755,-,-) %{_bindir}/%{name}.py +# %doc README.md LICENSE.txt +# %attr(755,-,-) %{_initrddir}/%{name} +# %{_sysconfdir}/logrotate.d/%{name} +# %dir %{_sysconfdir}/httpd/doraemon +%attr(0750,srvmgr,srvmgr) %dir %{_localstatedir}/cache/doraemon +# %attr(0644,root,root) %ghost %{_sysconfdir}/init/doraemon.conf +# %attr(0644,root,root) %ghost %{_sysconfdir}/httpd/doraemon/httpd.conf +%attr(0700,root,root) %dir %{_localstatedir}/log/doraemon +%attr(0644,root,root) %config %ghost %{_localstatedir}/log/doraemon/access_log +%attr(0644,root,root) %config %ghost %{_localstatedir}/log/doraemon/error_log -%dir %attr(755,-,-) %{_sharedstatedir}/%{name} -%{_sysconfdir}/logrotate.d/%{name} -%dir %attr(755,-,-) %{_sysconfdir}/e-smith/db/configuration/defaults/%{name} -%{_sysconfdir}/e-smith/db/configuration/defaults/%{name}/status -%{_sysconfdir}/e-smith/db/configuration/defaults/%{name}/type -%{_sysconfdir}/e-smith/db/configuration/defaults/%{name}/access -%{_sysconfdir}/e-smith/db/configuration/defaults/%{name}/TCPPort %changelog +* Mon Jul 18 2016 Paolo Asperti - 1.3.0-1.ns6 +- PHP porting +- Added a basic UI + * Tue Oct 27 2015 Emiliano Vavassori - 1.2.1-2.ns6 - Packing corrections to rpm to fix upgrading issue diff --git a/root/etc/e-smith/db/configuration/migrate/migrate_from_doraemon_120 b/root/etc/e-smith/db/configuration/migrate/migrate_from_doraemon_120 new file mode 100644 index 0000000..05df6ff --- /dev/null +++ b/root/etc/e-smith/db/configuration/migrate/migrate_from_doraemon_120 @@ -0,0 +1,33 @@ +{ + # + # feature2956_ns6 -- Base: refactor Remote Access page + # + # The ValidFrom prop is migrated to AllowAccess + # + + # TODO: gestire la migrazione dal doraemon precedente (sqlite + doraemon.ini -> e-smith) + + use esmith::ConfigDB; + use esmith::util; + + my $cdb = esmith::ConfigDB->open(); + + my $validFrom = $cdb->get_prop_and_delete('httpd-admin', 'ValidFrom') || ''; + + # 1) Ignore ValidFrom if AllowHosts is already set + if($cdb->get_prop('httpd-admin', 'AllowHosts')) { + return ""; + } + + # 2) Sanitize and import validFrom value if access is private + if($cdb->get_prop('httpd-admin', 'access') eq 'private') { + my $newValue = join(',', map { + my ($ipaddr, $netmask) = (split(/\//, $_)); + $_ eq '0.0.0.0/0.0.0.0' ? () : esmith::util::computeLocalNetworkShortSpec($ipaddr, $netmask); + } split(/,/, $validFrom)); + $cdb->set_prop('httpd-admin', 'AllowHosts', $newValue); + } + + + ""; +} diff --git a/root/etc/e-smith/events/actions/doraemon-asyncreload b/root/etc/e-smith/events/actions/doraemon-asyncreload new file mode 100755 index 0000000..ae656e5 --- /dev/null +++ b/root/etc/e-smith/events/actions/doraemon-asyncreload @@ -0,0 +1,3 @@ +#!/bin/bash + +exec /sbin/start doraemon-reload diff --git a/root/etc/e-smith/events/actions/doraemon-migrate b/root/etc/e-smith/events/actions/doraemon-migrate new file mode 100755 index 0000000..f4b9ca2 --- /dev/null +++ b/root/etc/e-smith/events/actions/doraemon-migrate @@ -0,0 +1,56 @@ +#!/usr/bin/perl + +# +# Copyright (C) 2013 Nethesis S.r.l. +# http://www.nethesis.it - support@nethesis.it +# +# This script is part of NethServer. +# +# NethServer is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, +# or any later version. +# +# NethServer is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with NethServer. If not, see . +# + +# TODO: manage migration + +use esmith::DB::db; +use esmith::event; +use strict; + +my $event = shift; +my $sourceDir = shift; +my $esmithDbDir = '/home/e-smith/db'; +my $errors = 0; +if( ! -d $sourceDir) { + die("Could not find dir $sourceDir"); +} + +my $srcConfigDb = esmith::DB::db->open_ro(join('', $sourceDir, $esmithDbDir, '/configuration')) || die("Could not open source configuration database in $sourceDir \n"); + +my $dstConfigDb = esmith::DB::db->open('configuration') || die("Could not open destination account db\n"); + + +my $service = 'httpd-admin'; +my $old = $srcConfigDb->get($service); +my $new = $dstConfigDb->get($service) || $dstConfigDb->new_record($service); +$new->set_prop('ValidFrom', $old->prop('ValidFrom') || ''); +$old = $srcConfigDb->get('modSSL'); +$new->set_prop('SSLCipherSuite', $old->prop('CipherSuite') || 'ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM'); + +# +# Apply configuration +# +if( ! esmith::event::event_signal('nethserver-httpd-admin-update')) { + exit(1); +} + +exit 0; diff --git a/root/etc/e-smith/events/doraemon-update/services2adjust/doraemon b/root/etc/e-smith/events/doraemon-update/services2adjust/doraemon new file mode 120000 index 0000000..b7dc720 --- /dev/null +++ b/root/etc/e-smith/events/doraemon-update/services2adjust/doraemon @@ -0,0 +1 @@ +restart \ No newline at end of file diff --git a/root/etc/e-smith/events/doraemon-update/templates2expand/etc/httpd/doraemon/httpd.conf b/root/etc/e-smith/events/doraemon-update/templates2expand/etc/httpd/doraemon/httpd.conf new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/e-smith/events/doraemon-update/templates2expand/etc/init/doraemon.conf b/root/etc/e-smith/events/doraemon-update/templates2expand/etc/init/doraemon.conf new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/e-smith/events/migration-import/S99doraemon-migrate b/root/etc/e-smith/events/migration-import/S99doraemon-migrate new file mode 120000 index 0000000..c6ee670 --- /dev/null +++ b/root/etc/e-smith/events/migration-import/S99doraemon-migrate @@ -0,0 +1 @@ +../actions/doraemon-migrate \ No newline at end of file diff --git a/root/etc/e-smith/templates.metadata/etc/init/doraemon.conf b/root/etc/e-smith/templates.metadata/etc/init/doraemon.conf new file mode 100644 index 0000000..5e5de6f --- /dev/null +++ b/root/etc/e-smith/templates.metadata/etc/init/doraemon.conf @@ -0,0 +1,3 @@ +TEMPLATE_PATH='upstart-job' +OUTPUT_FILENAME='/etc/init/doraemon.conf' +MORE_DATA={ name => 'doraemon', description => 'Apache instance that runs the doraemon service', author => 'Paolo Asperti ', daemon_bin => '/usr/sbin/doraemon', daemon_args => '-f /etc/httpd/doraemon/httpd.conf', respawn => 1, 'expect' => 'fork', stop_on => 'stopping network', start_on => 'started network' } diff --git a/root/etc/e-smith/templates/etc/sudoers/50doraemon b/root/etc/e-smith/templates/etc/sudoers/50doraemon new file mode 100644 index 0000000..b456169 --- /dev/null +++ b/root/etc/e-smith/templates/etc/sudoers/50doraemon @@ -0,0 +1,6 @@ +# +# 50doraemon +# +srvmgr ALL=NOPASSWD: /bin/cat /home/amgmt/.ansible/vault.txt + + diff --git a/root/etc/init/doraemon-reload.conf b/root/etc/init/doraemon-reload.conf new file mode 100644 index 0000000..be8a4b0 --- /dev/null +++ b/root/etc/init/doraemon-reload.conf @@ -0,0 +1,12 @@ +# +# doraemon-reload task +# +# Signals an Apache graceful restart for doraemon instance +# + +# service job, runs asynchronously + +script + sleep 5 + exec /usr/sbin/doraemon -f /etc/httpd/doraemon/httpd.conf -k graceful +end script diff --git a/root/etc/sysconfig/doraemon b/root/etc/sysconfig/doraemon deleted file mode 100644 index 007b91f..0000000 --- a/root/etc/sysconfig/doraemon +++ /dev/null @@ -1,8 +0,0 @@ -# -# This file can be used to set additional environment variables for -# the httpd-admin process, or pass additional options to the -# httpd-admin executable. See httpd-admin.service unit. -# - -LANG=C - diff --git a/root/usr/lib/systemd/system/doraemon-reload.service b/root/usr/lib/systemd/system/doraemon-reload.service deleted file mode 100644 index 320c054..0000000 --- a/root/usr/lib/systemd/system/doraemon-reload.service +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Graceful restart of doraemon service -Documentation=https://github.com/bglug-it/doraemon -Requisite=doraemon.service - -[Service] -Type=oneshot -ExecStart=/usr/sbin/httpd -f /etc/httpd/doraemon/httpd.conf -k graceful - diff --git a/root/usr/lib/systemd/system/doraemon-reload.timer b/root/usr/lib/systemd/system/doraemon-reload.timer deleted file mode 100644 index 7531f12..0000000 --- a/root/usr/lib/systemd/system/doraemon-reload.timer +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Delayed graceful restart of doraemon service -Documentation=https://github.com/bglug-it/doraemon -Conflicts=doraemon-reload.service - -[Timer] -OnActiveSec=5 - - diff --git a/root/usr/lib/systemd/system/doraemon.service b/root/usr/lib/systemd/system/doraemon.service deleted file mode 100644 index d4eeb35..0000000 --- a/root/usr/lib/systemd/system/doraemon.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Doraemon httpd instance -Documentation=https://github.com/bglug-it/doraemon -After=network.target remote-fs.target nss-lookup.target - -[Service] -Type=simple -EnvironmentFile=/etc/sysconfig/doraemon -ExecStart=/usr/sbin/httpd -f /etc/httpd/doraemon/httpd.conf -c 'MaxConnectionsPerChild 12' -DFOREGROUND -ExecReload=/usr/sbin/httpd -f /etc/httpd/doraemon/httpd.conf -k graceful -LimitNOFILE=4096 - -[Install] -WantedBy=multi-user.target diff --git a/doraemon/EsmithDatabase.php b/root/usr/share/doraemon/EsmithDatabase.php similarity index 100% rename from doraemon/EsmithDatabase.php rename to root/usr/share/doraemon/EsmithDatabase.php diff --git a/doraemon/index.php b/root/usr/share/doraemon/index.php similarity index 92% rename from doraemon/index.php rename to root/usr/share/doraemon/index.php index 41daa53..069d20f 100644 --- a/doraemon/index.php +++ b/root/usr/share/doraemon/index.php @@ -133,7 +133,7 @@ function ROUTE_hosts() { if (isset($get_params['role'])) { $items = $hosts_db->getAllByProp('Role', $get_params['role']); } else { - $items = $hosts_db->getAll(); + $items = $hosts_db->getAll('remote'); } $results=array(); foreach ($items as $name=>$item) { @@ -170,16 +170,18 @@ function ROUTE_ansible_list() { function ROUTE_vaultpass() { global $config_db; $theFile = $config_db->getProp(CONFIG_KEY,'VaultPassFile'); - $content = trim(file_get_contents($theFile)); + $oArr = array(); + exec('/usr/bin/sudo /bin/cat ' . $theFile, $oArr, $exitCode); + $content = trim(implode("\n", $oArr)); if (false === $content) { echo 'no file'; return; } if (!$client = getClient()) { echo 'no client'; return; } - $key = md5($client['name']); + $key = md5($client['name'], true); $padlenght = 16 - (strlen($content) % 16); - $content_padded = str_repeat('x', $padlenght); + $content_padded = $content . str_repeat('x', $padlenght); $ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $content_padded, MCRYPT_MODE_ECB); echo base64_encode($ciphertext); } @@ -230,7 +232,7 @@ function newHostname($mac, $base, $role) { return; } - $domainName = $config_db->getKeyValue('DomainName'); + $domainName = (string)$config_db->getKeyValue('DomainName'); $digits = $config_db->getProp(CONFIG_KEY,'NamingDigits'); $formatstring = '%s-%0'.$digits.'d'; $nr=0; @@ -238,9 +240,10 @@ function newHostname($mac, $base, $role) { do { $nr++; $hostname = sprintf($formatstring, $base, $nr); - if ($domainName != '') { - $hostname .= '.' . $domainname; - } +# TODO: we'll use the hostname in future, maybe +# if (trim($domainName) != '') { +# $hostname .= '.' . $domainName; +# } } while ($hosts_db->getKey($hostname)); $hosts_db->setKey($hostname, 'remote', array( diff --git a/root/usr/share/nethesis/NethServer/Language/en/NethServer_Module_Doraemon.php b/root/usr/share/nethesis/NethServer/Language/en/NethServer_Module_Doraemon.php new file mode 100644 index 0000000..7fe4d17 --- /dev/null +++ b/root/usr/share/nethesis/NethServer/Language/en/NethServer_Module_Doraemon.php @@ -0,0 +1,12 @@ +loadChildrenDirectory(); + } + +} diff --git a/root/usr/share/nethesis/NethServer/Module/Doraemon/Hosts.php b/root/usr/share/nethesis/NethServer/Module/Doraemon/Hosts.php new file mode 100644 index 0000000..6c753fd --- /dev/null +++ b/root/usr/share/nethesis/NethServer/Module/Doraemon/Hosts.php @@ -0,0 +1,34 @@ +setTableAdapter($this->getPlatform()->getTableAdapter('hosts', 'remote')) + ->setColumns($columns) + // TODO: + // ->addRowAction(new \NethServer\Module\Doraemon\Hosts\Modify('wake')) + // ->addRowAction(new \NethServer\Module\Doraemon\Hosts\Modify('reboot')) + // ->addRowAction(new \NethServer\Module\Doraemon\Hosts\Modify('shutdown')) + ->addRowAction(new \NethServer\Module\Doraemon\Hosts\Modify('update')) + ->addRowAction(new \NethServer\Module\Doraemon\Hosts\Modify('delete')) + ->addTableAction(new \NethServer\Module\Doraemon\Hosts\Modify('create')) + ->addTableAction(new \Nethgui\Controller\Table\Help('Help')) + ; + + parent::initialize(); + } + +} diff --git a/root/usr/share/nethesis/NethServer/Module/Doraemon/Hosts/Modify.php b/root/usr/share/nethesis/NethServer/Module/Doraemon/Hosts/Modify.php new file mode 100644 index 0000000..740b3eb --- /dev/null +++ b/root/usr/share/nethesis/NethServer/Module/Doraemon/Hosts/Modify.php @@ -0,0 +1,55 @@ +setSchema($parameterSchema); + parent::initialize(); + } + + public function validate(\Nethgui\Controller\ValidationReportInterface $report) + { + if ($this->getIdentifier() === 'delete') { + $v = $this->createValidator()->platform('host-delete'); + if ( ! $v->evaluate($this->parameters['hostname'])) { + $report->addValidationError($this, 'Key', $v); + } + } + parent::validate($report); + } + + protected function onParametersSaved($parameters) + { + $actionName = $this->getIdentifier(); + if ($actionName === 'update') { + $actionName = 'modify'; + } + $this->getPlatform()->signalEvent(sprintf('host-%s &', $actionName)); + } + + public function prepareView(\Nethgui\View\ViewInterface $view) + { + parent::prepareView($view); + $templates = array( + 'create' => 'NethServer\Template\Doraemon\Hosts', + 'update' => 'NethServer\Template\Doraemon\Hosts', + 'delete' => 'Nethgui\Template\Table\Delete', + ); + $view->setTemplate($templates[$this->getIdentifier()]); + } + +} \ No newline at end of file diff --git a/root/usr/share/nethesis/NethServer/Template/Doraemon/Hosts.php b/root/usr/share/nethesis/NethServer/Template/Doraemon/Hosts.php new file mode 100644 index 0000000..eccb4a9 --- /dev/null +++ b/root/usr/share/nethesis/NethServer/Template/Doraemon/Hosts.php @@ -0,0 +1,22 @@ +getModule()->getIdentifier() == 'update') { + // disable updating of hostname + // the hostname is the key of the db item, if you change it, bad things happens + $keyFlags = $view::STATE_DISABLED; + $template = 'Update_Host_Header'; +} else { + $keyFlags = 0; + $template = 'Create_Host_Header'; +} + +echo $view->header('hostname')->setAttribute('template', $T($template)); + +echo $view->panel() + ->insert($view->textInput('hostname', $keyFlags)) + ->insert($view->textInput('MacAddress')) + ->insert($view->textInput('Role')) +; + +echo $view->buttonList($view::BUTTON_SUBMIT | $view::BUTTON_CANCEL | $view::BUTTON_HELP);