Branch 'VADER' - monitoring/ProgAGoGo
by Jan Pazdziora
monitoring/ProgAGoGo/gogo.pl | 1 +
1 file changed, 1 insertion(+)
New commits:
commit 7b2dc374f28c04f68c4045520cd4354bfc6c7e59
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Thu Jul 30 17:26:04 2009 +0200
513368 - call setpgrp to prevent kill 0 to propagate to jabberd and tomcat.
(cherry picked from commit 172090659d5a0b6cba91299617794e369672ace4)
diff --git a/monitoring/ProgAGoGo/gogo.pl b/monitoring/ProgAGoGo/gogo.pl
index 825e746..5e02b80 100755
--- a/monitoring/ProgAGoGo/gogo.pl
+++ b/monitoring/ProgAGoGo/gogo.pl
@@ -230,6 +230,7 @@ if (my $nannypid = fork()) {
# ... else, I am the nanny.
+setpgrp(0,0);
# Set up the signal handlers for nice clean exits ...
$SIG{'INT'} = \&sigRelay;
14 years, 9 months
monitoring/ProgAGoGo
by Jan Pazdziora
monitoring/ProgAGoGo/gogo.pl | 1 +
1 file changed, 1 insertion(+)
New commits:
commit 172090659d5a0b6cba91299617794e369672ace4
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Thu Jul 30 17:26:04 2009 +0200
513368 - call setpgrp to prevent kill 0 to propagate to jabberd and tomcat.
diff --git a/monitoring/ProgAGoGo/gogo.pl b/monitoring/ProgAGoGo/gogo.pl
index 825e746..5e02b80 100755
--- a/monitoring/ProgAGoGo/gogo.pl
+++ b/monitoring/ProgAGoGo/gogo.pl
@@ -230,6 +230,7 @@ if (my $nannypid = fork()) {
# ... else, I am the nanny.
+setpgrp(0,0);
# Set up the signal handlers for nice clean exits ...
$SIG{'INT'} = \&sigRelay;
14 years, 9 months
Changes to 'refs/tags/spacewalk-setup-0.6.16-1'
by Devan Goodwin
Tag 'spacewalk-setup-0.6.16-1' created by Devan Goodwin <dgoodwin(a)redhat.com> at 2009-07-30 14:34 +0000
Tagging package [spacewalk-setup] version [0.6.16-1] in directory [spacewalk/setup/].
Changes since spacewalk-setup-0.6.15-1:
Devan Goodwin (2):
More spacewalk-setup SHARED_DIR fixes.
Automatic commit of package [spacewalk-setup] release [0.6.16-1].
---
rel-eng/packages/spacewalk-setup | 2 +-
spacewalk/setup/bin/spacewalk-setup | 10 +++++-----
spacewalk/setup/lib/Spacewalk/Setup.pm | 6 +++---
spacewalk/setup/spacewalk-setup.spec | 4 ++--
4 files changed, 11 insertions(+), 11 deletions(-)
---
14 years, 9 months
rel-eng/packages spacewalk/setup
by Devan Goodwin
rel-eng/packages/spacewalk-setup | 2 +-
spacewalk/setup/spacewalk-setup.spec | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
New commits:
commit db28df036cedc1c6321504bb3df3a92b7aef9533
Author: Devan Goodwin <dgoodwin(a)redhat.com>
Date: Thu Jul 30 11:34:35 2009 -0300
Automatic commit of package [spacewalk-setup] release [0.6.16-1].
diff --git a/rel-eng/packages/spacewalk-setup b/rel-eng/packages/spacewalk-setup
index 9d27e73..27c1349 100644
--- a/rel-eng/packages/spacewalk-setup
+++ b/rel-eng/packages/spacewalk-setup
@@ -1 +1 @@
-0.6.15-1 spacewalk/setup/
+0.6.16-1 spacewalk/setup/
diff --git a/spacewalk/setup/spacewalk-setup.spec b/spacewalk/setup/spacewalk-setup.spec
index beb9a74..fe015c4 100644
--- a/spacewalk/setup/spacewalk-setup.spec
+++ b/spacewalk/setup/spacewalk-setup.spec
@@ -1,5 +1,5 @@
Name: spacewalk-setup
-Version: 0.6.15
+Version: 0.6.16
Release: 1%{?dist}
Summary: Initial setup tools for Red Hat Spacewalk
@@ -101,7 +101,7 @@ rm -rf %{buildroot}
%dir %{_sysconfdir}/pki/spacewalk/jabberd
%changelog
-* Thu Jul 30 2009 Devan Goodwin <dgoodwin(a)redhat.com> 0.6.15-1
+* Thu Jul 30 2009 Devan Goodwin <dgoodwin(a)redhat.com> 0.6.16-1
- Fix spacewalk-setup sudoers setup SHARED_DIR problem.
(dgoodwin(a)redhat.com)
14 years, 9 months
spacewalk/setup
by Devan Goodwin
spacewalk/setup/bin/spacewalk-setup | 10 +++++-----
spacewalk/setup/lib/Spacewalk/Setup.pm | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)
New commits:
commit d13dfec89347525c27df64f9f92196cadb68d878
Author: Devan Goodwin <dgoodwin(a)redhat.com>
Date: Thu Jul 30 11:33:27 2009 -0300
More spacewalk-setup SHARED_DIR fixes.
Was still broken, adjusting all references.
diff --git a/spacewalk/setup/bin/spacewalk-setup b/spacewalk/setup/bin/spacewalk-setup
index d0fd548..ff5ae52 100755
--- a/spacewalk/setup/bin/spacewalk-setup
+++ b/spacewalk/setup/bin/spacewalk-setup
@@ -195,7 +195,7 @@ sub remove_old_jvm {
return unless (($opts{"upgrade"}) and ($product_name =~ /Satellite/));
- my $jvm_list = Spacewalk::Setup::SHARED_DIR . "/setup/old-jvm-list";
+ my $jvm_list = Spacewalk::Setup::SHARED_DIR . "/old-jvm-list";
local *F;
open F, $jvm_list or die "Error opening [$jvm_list]: $!\n";
@@ -288,7 +288,7 @@ sub setup_sudoers {
open FILE, $sudoers_path or die "Error reading [$sudoers_path]: $!\n";
} else {
# otherwise start with our own file
- my $init_sudoers_path = Spacewalk::Setup::SHARED_DIR . '/setup/sudoers.base';
+ my $init_sudoers_path = Spacewalk::Setup::SHARED_DIR . '/sudoers.base';
open FILE, $init_sudoers_path
or die "Error reading [$init_sudoers_path]: $!\n";
$sudoers_content_orig = '';
@@ -302,7 +302,7 @@ sub setup_sudoers {
# The sudoers.clear file has regular expressions for clearing
# old configuration
- if (open FILE, Spacewalk::Setup::SHARED_DIR . '/setup/sudoers.clear') {
+ if (open FILE, Spacewalk::Setup::SHARED_DIR . '/sudoers.clear') {
while (defined(my $regexp = <FILE>)) {
chomp $regexp;
$sudoers_content =~ s!$regexp!!igm;
@@ -314,7 +314,7 @@ sub setup_sudoers {
# need to add to sudoers. The first line of each file helps us
# detect that the part is already present, and potentially
# modify it to the latest versions we need.
- for my $file (glob Spacewalk::Setup::SHARED_DIR . '/setup/sudoers.[0-9]') {
+ for my $file (glob Spacewalk::Setup::SHARED_DIR . '/sudoers.[0-9]') {
open FILE, $file or die "Error reading [$file]: $!\n";
my $regexp = <FILE>;
chomp $regexp;
@@ -472,7 +472,7 @@ sub setup_ssl_vhost {
exit;
}
- for my $file (glob Spacewalk::Setup::SHARED_DIR . '/setup/ssl.conf.[0-9]') {
+ for my $file (glob Spacewalk::Setup::SHARED_DIR . '/ssl.conf.[0-9]') {
open FILE, $file or die "Error reading [$file]: $!\n";
my $regexp = <FILE>;
chomp $regexp;
diff --git a/spacewalk/setup/lib/Spacewalk/Setup.pm b/spacewalk/setup/lib/Spacewalk/Setup.pm
index 510a47e..08601d0 100644
--- a/spacewalk/setup/lib/Spacewalk/Setup.pm
+++ b/spacewalk/setup/lib/Spacewalk/Setup.pm
@@ -34,13 +34,13 @@ our $VERSION = '0.6';
use constant SATELLITE_SYSCONFIG => "/etc/sysconfig/rhn-satellite";
-use constant SHARED_DIR => "/usr/share/spacewalk";
+use constant SHARED_DIR => "/usr/share/spacewalk/setup";
use constant POSTGRESQL_SCHEMA_FILE => File::Spec->catfile("/etc", "sysconfig",
'rhn', 'postgres', 'main.sql');
use constant DEFAULT_ANSWER_FILE_GLOB =>
- SHARED_DIR . '/setup/defaults.d/*.conf';
+ SHARED_DIR . '/defaults.d/*.conf';
use constant DEFAULT_RHN_CONF_LOCATION =>
'/etc/rhn/rhn.conf';
@@ -940,7 +940,7 @@ EOQ
if (not $opts->{"skip-db-diskspace-check"}) {
system_or_exit(['python', SHARED_DIR .
- '/setup/embedded_diskspace_check.py'], 14,
+ '/embedded_diskspace_check.py'], 14,
'There is not enough space available for the embedded database.');
}
else {
14 years, 9 months
Changes to 'refs/tags/spacewalk-setup-0.6.15-1'
by Devan Goodwin
Tag 'spacewalk-setup-0.6.15-1' created by Devan Goodwin <dgoodwin(a)redhat.com> at 2009-07-30 14:20 +0000
Tagging package [spacewalk-setup] version [0.6.15-1] in directory [spacewalk/setup/].
Changes since spacewalk-config-0.6.13-1:
Devan Goodwin (3):
Re-order Oracle upgrade script.
Fix spacewalk-setup SHARED_DIR problems from pgsql merge.
Automatic commit of package [spacewalk-setup] release [0.6.15-1].
Partha Aji (1):
51455, 513683, 514291, 513539 - Fixed a bunch of bugs related to KS provisioning.
---
java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java | 11
java/code/src/com/redhat/rhn/frontend/action/kickstart/ScheduleKickstartWizardAction.java | 24 -
java/code/src/com/redhat/rhn/frontend/action/kickstart/ssm/SsmKSScheduleAction.java | 5
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 7
java/code/src/com/redhat/rhn/manager/kickstart/KickstartManager.java | 8
java/code/src/com/redhat/rhn/manager/kickstart/KickstartScheduleCommand.java | 26 -
java/code/src/com/redhat/rhn/manager/kickstart/SSMScheduleCommand.java | 12
java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerSystemCreateCommand.java | 166 +++-------
java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerVirtualSystemCommand.java | 26 -
java/code/src/org/cobbler/Network.java | 149 ++++++++
java/code/src/org/cobbler/SystemRecord.java | 66 +++
java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/advanced.jspf | 7
java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf | 2
java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/network-options.jspf | 32 +
java/code/webapp/WEB-INF/struts-config.xml | 2
rel-eng/packages/spacewalk-setup | 2
schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/998-postgresql-compatability-procs.sql | 56 +--
spacewalk/setup/bin/spacewalk-setup | 8
spacewalk/setup/lib/Spacewalk/Setup.pm | 2
spacewalk/setup/spacewalk-setup.spec | 6
20 files changed, 404 insertions(+), 213 deletions(-)
---
14 years, 9 months
rel-eng/packages spacewalk/setup
by Devan Goodwin
rel-eng/packages/spacewalk-setup | 2 +-
spacewalk/setup/spacewalk-setup.spec | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
New commits:
commit e570321f39aa307133cfd5b4386feafa9220ae5f
Author: Devan Goodwin <dgoodwin(a)redhat.com>
Date: Thu Jul 30 11:20:24 2009 -0300
Automatic commit of package [spacewalk-setup] release [0.6.15-1].
diff --git a/rel-eng/packages/spacewalk-setup b/rel-eng/packages/spacewalk-setup
index 654669c..9d27e73 100644
--- a/rel-eng/packages/spacewalk-setup
+++ b/rel-eng/packages/spacewalk-setup
@@ -1 +1 @@
-0.6.14-1 spacewalk/setup/
+0.6.15-1 spacewalk/setup/
diff --git a/spacewalk/setup/spacewalk-setup.spec b/spacewalk/setup/spacewalk-setup.spec
index 3c27edb..beb9a74 100644
--- a/spacewalk/setup/spacewalk-setup.spec
+++ b/spacewalk/setup/spacewalk-setup.spec
@@ -1,5 +1,5 @@
Name: spacewalk-setup
-Version: 0.6.14
+Version: 0.6.15
Release: 1%{?dist}
Summary: Initial setup tools for Red Hat Spacewalk
@@ -101,6 +101,10 @@ rm -rf %{buildroot}
%dir %{_sysconfdir}/pki/spacewalk/jabberd
%changelog
+* Thu Jul 30 2009 Devan Goodwin <dgoodwin(a)redhat.com> 0.6.15-1
+- Fix spacewalk-setup sudoers setup SHARED_DIR problem.
+ (dgoodwin(a)redhat.com)
+
* Tue Jul 28 2009 Devan Goodwin <dgoodwin(a)redhat.com> 0.6.14-1
- Fix rhn.conf population of Hibernate dialect/driver/url settings.
(dgoodwin(a)redhat.com)
14 years, 9 months
spacewalk/setup
by Devan Goodwin
spacewalk/setup/bin/spacewalk-setup | 8 ++++----
spacewalk/setup/lib/Spacewalk/Setup.pm | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
New commits:
commit 079021621c3b6b2cc653b13c6dfa7729d590f740
Author: Devan Goodwin <dgoodwin(a)redhat.com>
Date: Thu Jul 30 11:16:41 2009 -0300
Fix spacewalk-setup SHARED_DIR problems from pgsql merge.
Some of the path changes were lost, possibly during merges, resulting in
incorrect sudo'ers setup during installation. (would only affect webui
restarts)
diff --git a/spacewalk/setup/bin/spacewalk-setup b/spacewalk/setup/bin/spacewalk-setup
index 9fc9ce3..d0fd548 100755
--- a/spacewalk/setup/bin/spacewalk-setup
+++ b/spacewalk/setup/bin/spacewalk-setup
@@ -195,7 +195,7 @@ sub remove_old_jvm {
return unless (($opts{"upgrade"}) and ($product_name =~ /Satellite/));
- my $jvm_list = Spacewalk::Setup::SHARED_DIR . "/old-jvm-list";
+ my $jvm_list = Spacewalk::Setup::SHARED_DIR . "/setup/old-jvm-list";
local *F;
open F, $jvm_list or die "Error opening [$jvm_list]: $!\n";
@@ -288,7 +288,7 @@ sub setup_sudoers {
open FILE, $sudoers_path or die "Error reading [$sudoers_path]: $!\n";
} else {
# otherwise start with our own file
- my $init_sudoers_path = Spacewalk::Setup::SHARED_DIR . '/sudoers.base';
+ my $init_sudoers_path = Spacewalk::Setup::SHARED_DIR . '/setup/sudoers.base';
open FILE, $init_sudoers_path
or die "Error reading [$init_sudoers_path]: $!\n";
$sudoers_content_orig = '';
@@ -302,7 +302,7 @@ sub setup_sudoers {
# The sudoers.clear file has regular expressions for clearing
# old configuration
- if (open FILE, Spacewalk::Setup::SHARED_DIR . '/sudoers.clear') {
+ if (open FILE, Spacewalk::Setup::SHARED_DIR . '/setup/sudoers.clear') {
while (defined(my $regexp = <FILE>)) {
chomp $regexp;
$sudoers_content =~ s!$regexp!!igm;
@@ -314,7 +314,7 @@ sub setup_sudoers {
# need to add to sudoers. The first line of each file helps us
# detect that the part is already present, and potentially
# modify it to the latest versions we need.
- for my $file (glob Spacewalk::Setup::SHARED_DIR . '/sudoers.[0-9]') {
+ for my $file (glob Spacewalk::Setup::SHARED_DIR . '/setup/sudoers.[0-9]') {
open FILE, $file or die "Error reading [$file]: $!\n";
my $regexp = <FILE>;
chomp $regexp;
diff --git a/spacewalk/setup/lib/Spacewalk/Setup.pm b/spacewalk/setup/lib/Spacewalk/Setup.pm
index b03dd55..510a47e 100644
--- a/spacewalk/setup/lib/Spacewalk/Setup.pm
+++ b/spacewalk/setup/lib/Spacewalk/Setup.pm
@@ -940,7 +940,7 @@ EOQ
if (not $opts->{"skip-db-diskspace-check"}) {
system_or_exit(['python', SHARED_DIR .
- '/embedded_diskspace_check.py'], 14,
+ '/setup/embedded_diskspace_check.py'], 14,
'There is not enough space available for the embedded database.');
}
else {
14 years, 9 months
schema/spacewalk
by Devan Goodwin
schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/998-postgresql-compatability-procs.sql | 56 +++++-----
1 file changed, 28 insertions(+), 28 deletions(-)
New commits:
commit 7a846f41e44fee82f9f37ca39a5ac9f3a23d85c0
Author: Devan Goodwin <dgoodwin(a)redhat.com>
Date: Thu Jul 30 09:44:31 2009 -0300
Re-order Oracle upgrade script.
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/998-postgresql-compatability-procs.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/998-postgresql-compatability-procs.sql
index 23674ae..52f1fd1 100644
--- a/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/998-postgresql-compatability-procs.sql
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/998-postgresql-compatability-procs.sql
@@ -2,34 +2,6 @@
--- Add stored procedures for PostgreSQL compatability.
---
-CREATE OR REPLACE VIEW
-rhnServerOutdatedPackages
-(
- server_id,
- package_name_id,
- package_evr_id,
- package_nvre,
- errata_id,
- errata_advisory
-)
-AS
-SELECT DISTINCT SNPC.server_id,
- P.name_id,
- P.evr_id,
- PN.name || '-' || evr_t_as_vre_simple( PE.evr ),
- E.id,
- E.advisory
- FROM rhnPackageName PN,
- rhnPackageEVR PE,
- rhnPackage P,
- rhnServerNeededPackageCache SNPC
- left outer join
- rhnErrata E
- on SNPC.errata_id = E.id
- WHERE SNPC.package_id = P.id
- AND P.name_id = PN.id
- AND P.evr_id = PE.id;
-
create or replace function evr_t_as_vre( a evr_t )
return varchar2
is
@@ -61,5 +33,33 @@ begin
end;
+CREATE OR REPLACE VIEW
+rhnServerOutdatedPackages
+(
+ server_id,
+ package_name_id,
+ package_evr_id,
+ package_nvre,
+ errata_id,
+ errata_advisory
+)
+AS
+SELECT DISTINCT SNPC.server_id,
+ P.name_id,
+ P.evr_id,
+ PN.name || '-' || evr_t_as_vre_simple( PE.evr ),
+ E.id,
+ E.advisory
+ FROM rhnPackageName PN,
+ rhnPackageEVR PE,
+ rhnPackage P,
+ rhnServerNeededPackageCache SNPC
+ left outer join
+ rhnErrata E
+ on SNPC.errata_id = E.id
+ WHERE SNPC.package_id = P.id
+ AND P.name_id = PN.id
+ AND P.evr_id = PE.id;
+
14 years, 9 months
Branch 'VADER' - java/code
by Partha Aji
java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java | 11
java/code/src/com/redhat/rhn/frontend/action/kickstart/ScheduleKickstartWizardAction.java | 15
java/code/src/com/redhat/rhn/frontend/action/kickstart/ssm/SsmKSScheduleAction.java | 5
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 7
java/code/src/com/redhat/rhn/manager/kickstart/KickstartManager.java | 8
java/code/src/com/redhat/rhn/manager/kickstart/KickstartScheduleCommand.java | 26 -
java/code/src/com/redhat/rhn/manager/kickstart/SSMScheduleCommand.java | 12
java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerSystemCreateCommand.java | 169 +++-------
java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerVirtualSystemCommand.java | 26 -
java/code/src/org/cobbler/Network.java | 149 ++++++++
java/code/src/org/cobbler/SystemRecord.java | 66 +++
java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/advanced.jspf | 7
java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf | 2
java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/network-options.jspf | 24 -
java/code/webapp/WEB-INF/struts-config.xml | 2
15 files changed, 358 insertions(+), 171 deletions(-)
New commits:
commit db9c4dd562570ce3644948aedd213ec0636839f1
Author: Partha Aji <paji(a)redhat.com>
Date: Wed Jul 29 16:42:08 2009 -0400
51455, 513683, 514291, 513539 - Fixed a bunch of bugs related to KS provisioning.
diff --git a/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java b/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java
index 42dba00..69d93db 100644
--- a/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java
+++ b/java/code/src/com/redhat/rhn/domain/server/NetworkInterface.java
@@ -210,4 +210,15 @@ public class NetworkInterface extends BaseDomainHelper implements
return isIpValid() && isMacValid();
}
+ /**
+ * true if the network card has a public ip address
+ * and can thus useful in the cases of KSing
+ * via ip address
+ * @return true if the NIC has a public ip address.
+ */
+ public boolean isPublic() {
+ return isValid() && !(getIpaddr().equals("127.0.0.1") ||
+ getIpaddr().equals("0.0.0.0"));
+ }
+
}
diff --git a/java/code/src/com/redhat/rhn/frontend/action/kickstart/ScheduleKickstartWizardAction.java b/java/code/src/com/redhat/rhn/frontend/action/kickstart/ScheduleKickstartWizardAction.java
index 02850f9..498fbc2 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/kickstart/ScheduleKickstartWizardAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/kickstart/ScheduleKickstartWizardAction.java
@@ -96,7 +96,7 @@ public class ScheduleKickstartWizardAction extends RhnWizardAction {
public static final String HOST_SID = "hostSid";
public static final String VIRT_HOST_IS_REGISTERED = "virtHostIsRegistered";
public static final String TARGET_PROFILE_TYPE = "targetProfileType";
- public static final String NETWORK_TYPE_DHCP = "networkTypeDhcp";
+ public static final String NETWORK_TYPE = "networkType";
public static final String NETWORK_INTERFACE = "networkInterface";
public static final String NETWORK_INTERFACES = "networkInterfaces";
/**
@@ -192,10 +192,6 @@ public class ScheduleKickstartWizardAction extends RhnWizardAction {
}
}
context.getRequest().setAttribute(NETWORK_INTERFACES, nics);
- if (form.get(NETWORK_TYPE_DHCP) == null) {
- form.set(NETWORK_TYPE_DHCP, Boolean.TRUE);
- }
-
if (StringUtils.isBlank(form.getString(NETWORK_INTERFACE))) {
String defaultInterface = ConfigDefaults.get().
getDefaultKickstartNetworkInterface();
@@ -209,8 +205,7 @@ public class ScheduleKickstartWizardAction extends RhnWizardAction {
form.set(NETWORK_INTERFACE, server.
findPrimaryNetworkInterface().getName());
}
-
- }
+ }
}
/**
@@ -372,7 +367,7 @@ public class ScheduleKickstartWizardAction extends RhnWizardAction {
if (cmd.getServer().getCobblerId() != null) {
SystemRecord rec = SystemRecord.
lookupById(con, cmd.getServer().getCobblerId());
- if (rec != null && profile.getName().equals(rec.getProfile())) {
+ if (rec != null && profile.getName().equals(rec.getProfile().getName())) {
if (StringUtils.isBlank(form.getString(KERNEL_PARAMS_TYPE))) {
form.set(KERNEL_PARAMS_TYPE, KERNEL_PARAMS_CUSTOM);
form.set(KERNEL_PARAMS, rec.getKernelOptionsString());
@@ -419,8 +414,8 @@ public class ScheduleKickstartWizardAction extends RhnWizardAction {
KickstartHelper helper = new KickstartHelper(ctx.getRequest());
KickstartScheduleCommand cmd = getScheduleCommand(form, ctx,
scheduleTime, helper.getKickstartHost());
-
- cmd.setNetworkDevice(Boolean.TRUE.equals(form.get(NETWORK_TYPE_DHCP)),
+
+ cmd.setNetworkDevice(form.getString(NETWORK_TYPE),
form.getString(NETWORK_INTERFACE));
cmd.setKernelOptions(parseKernelOptions(form, ctx.getRequest(),
form.getString(RequestContext.COBBLER_ID), false));
diff --git a/java/code/src/com/redhat/rhn/frontend/action/kickstart/ssm/SsmKSScheduleAction.java b/java/code/src/com/redhat/rhn/frontend/action/kickstart/ssm/SsmKSScheduleAction.java
index dff1085..dffe2aa 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/kickstart/ssm/SsmKSScheduleAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/kickstart/ssm/SsmKSScheduleAction.java
@@ -156,7 +156,9 @@ public class SsmKSScheduleAction extends RhnAction implements Listable {
ScheduleKickstartWizardAction.POST_KERNEL_PARAMS_TYPE));
com.setCustomPostKernelParams(dynaForm.getString(
ScheduleKickstartWizardAction.POST_KERNEL_PARAMS));
-
+ com.setNetworkDevice(dynaForm.getString(ScheduleKickstartWizardAction.NETWORK_TYPE),
+ dynaForm.getString(
+ ScheduleKickstartWizardAction.NETWORK_INTERFACE));
List<ValidatorError> errors = com.store();
return com.getScheduledActions();
}
@@ -166,7 +168,6 @@ public class SsmKSScheduleAction extends RhnAction implements Listable {
* {@inheritDoc}
*/
public List getResult(RequestContext ctx) {
-
if (isIP(ctx.getRequest())) {
return Collections.EMPTY_LIST;
}
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
index 8af5c1a..2081dec 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
@@ -10094,6 +10094,13 @@ Please note that some manual configuration of these scripts may still be require
</context-group>
</trans-unit>
+ <trans-unit id="kickstart.netconn.dhcp.jsp.link">
+ <source>DHCP using first available interface</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/kickstart/KickstartSystemDetailsEdit</context>
+ </context-group>
+ </trans-unit>
+
<trans-unit id="kickstart.selinux.enforce.policy.jsp.label">
<source>Enforcing - SELinux policy enforced</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/manager/kickstart/KickstartManager.java b/java/code/src/com/redhat/rhn/manager/kickstart/KickstartManager.java
index 4d8a5f8..e78edba 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/KickstartManager.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/KickstartManager.java
@@ -140,7 +140,7 @@ public class KickstartManager extends BaseManager {
* A kickstart that corresponds to it
*/
NetworkInterface nic = server.getNetworkInterface("eth0");
- if (nic != null && isPublicIpAddress(nic.getIpaddr())) {
+ if (nic != null && nic.isPublic()) {
IpAddress ip = new IpAddress(nic.getIpaddr());
ks = findProfileForIpAddress(ip, server.getOrg());
}
@@ -149,7 +149,7 @@ public class KickstartManager extends BaseManager {
*/
if (ks == null) {
for (NetworkInterface tmp : server.getNetworkInterfaces()) {
- if (isPublicIpAddress(tmp.getIpaddr())) {
+ if (tmp.isPublic()) {
IpAddress ip = new IpAddress(tmp.getIpaddr());
ks = findProfileForIpAddress(ip, server.getOrg());
if (ks != null) {
@@ -161,10 +161,6 @@ public class KickstartManager extends BaseManager {
return ks;
}
- private boolean isPublicIpAddress(String ip) {
- return !(ip.equals("127.0.0.1") || ip.equals("0.0.0.0") || ip.equals(""));
- }
-
/**
* Finds the profile which is a best fit.
* @param clientIpIn IpAddress to search ip ranges for
diff --git a/java/code/src/com/redhat/rhn/manager/kickstart/KickstartScheduleCommand.java b/java/code/src/com/redhat/rhn/manager/kickstart/KickstartScheduleCommand.java
index 942fdbd..5217dcb 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/KickstartScheduleCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/KickstartScheduleCommand.java
@@ -110,6 +110,7 @@ public class KickstartScheduleCommand extends BaseSystemOperation {
private static Logger log = Logger.getLogger(KickstartScheduleCommand.class);
public static final String DHCP_NETWORK_TYPE = "dhcp";
+ public static final String LINK_NETWORK_TYPE = "link";
public static final String STATIC_NETWORK_TYPE = "static";
// up2date is required to be 2.9.0
public static final String UP2DATE_VERSION = "2.9.0";
@@ -576,9 +577,7 @@ public class KickstartScheduleCommand extends BaseSystemOperation {
cmd.setKernelOptions(getExtraOptions());
cmd.setPostKernelOptions(postKernelOptions);
cmd.setScheduledAction(kickstartAction);
- if (!isDhcp) {
- cmd.setStaticNetwork(networkInterface);
- }
+ cmd.setNetworkInfo(isDhcp, networkInterface);
ValidatorError cobblerError = cmd.store();
if (cobblerError != null) {
return cobblerError;
@@ -592,9 +591,7 @@ public class KickstartScheduleCommand extends BaseSystemOperation {
cmd.setKernelOptions(kernelOptions);
cmd.setPostKernelOptions(postKernelOptions);
cmd.setScheduledAction(kickstartAction);
- if (!isDhcp) {
- cmd.setStaticNetwork(networkInterface);
- }
+ cmd.setNetworkInfo(isDhcp, networkInterface);
ValidatorError cobblerError = cmd.store();
if (cobblerError != null) {
return cobblerError;
@@ -947,7 +944,7 @@ public class KickstartScheduleCommand extends BaseSystemOperation {
static:146.108.30.184, static:auto, static:eth0
*/
if (!StringUtils.isBlank(networkInterface)) {
- if (isDhcp) {
+ if (isDhcp && !LINK_NETWORK_TYPE.equals(networkInterface)) {
// Get rid of the dhcp:
String params = " ksdevice=" + networkInterface;
if (!kOptions.contains("ksdevice")) {
@@ -1392,12 +1389,19 @@ public class KickstartScheduleCommand extends BaseSystemOperation {
}
/**
- * @param dhcp true if this is a dc
+ * @param networkType dhcp/static/link one of em.
* @param networkInterfaceIn The staticDevice to set.
*/
- public void setNetworkDevice(boolean dhcp, String networkInterfaceIn) {
- isDhcp = dhcp;
- networkInterface = networkInterfaceIn;
+ public void setNetworkDevice(String networkType, String networkInterfaceIn) {
+ isDhcp = networkType.equals(DHCP_NETWORK_TYPE) ||
+ networkType.equals(LINK_NETWORK_TYPE);
+ if (networkType.equals(LINK_NETWORK_TYPE)) {
+ networkInterface = LINK_NETWORK_TYPE;
+ }
+ else {
+ networkInterface = networkInterfaceIn;
+ }
+
}
/**
diff --git a/java/code/src/com/redhat/rhn/manager/kickstart/SSMScheduleCommand.java b/java/code/src/com/redhat/rhn/manager/kickstart/SSMScheduleCommand.java
index d14e1d0..90e4a4a 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/SSMScheduleCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/SSMScheduleCommand.java
@@ -53,7 +53,7 @@ public class SSMScheduleCommand {
private Long serverProfileId;
private Server proxy;
- private boolean isDhcp = true;
+ private String networkType;
private String networkInterface;
private List<Action> scheduledActions = new ArrayList<Action>();
private String kernelParamType;
@@ -208,7 +208,7 @@ public class SSMScheduleCommand {
com.setProfileId(packageProfileId);
com.setServerProfileId(serverProfileId);
com.setProxy(proxy);
- com.setNetworkDevice(isDhcp, networkInterface);
+ com.setNetworkDevice(networkType, networkInterface);
if (proxy == null) {
com.setKickstartServerName(ConfigDefaults.get().getCobblerHost());
}
@@ -264,11 +264,11 @@ public class SSMScheduleCommand {
}
/**
- * @param dhcp true if this is a dc
- * @param networkInterfaceIn The staticDevice to set.
+ * @param networkTypeIn could be one of dhcp, static or links
+ * @param networkInterfaceIn The network interface to set.
*/
- public void setNetworkDevice(boolean dhcp, String networkInterfaceIn) {
- isDhcp = dhcp;
+ public void setNetworkDevice(String networkTypeIn, String networkInterfaceIn) {
+ networkType = networkTypeIn;
networkInterface = networkInterfaceIn;
}
diff --git a/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerSystemCreateCommand.java b/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerSystemCreateCommand.java
index 00b7abe..8d48ca8 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerSystemCreateCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerSystemCreateCommand.java
@@ -23,15 +23,17 @@ import com.redhat.rhn.domain.token.ActivationKey;
import com.redhat.rhn.domain.token.ActivationKeyFactory;
import com.redhat.rhn.domain.token.Token;
import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.manager.kickstart.KickstartFormatter;
import com.redhat.rhn.manager.kickstart.KickstartUrlHelper;
import com.redhat.rhn.manager.token.ActivationKeyManager;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
+import org.cobbler.Network;
+import org.cobbler.Profile;
import org.cobbler.SystemRecord;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
@@ -55,13 +57,15 @@ public class CobblerSystemCreateCommand extends CobblerCommand {
private String kickstartHost;
private String kernelOptions;
private String postKernelOptions;
- private String staticNetwork;
-
+ private String networkInterface;
+ private boolean isDhcp;
/**
- * @param staticNetworkIn The staticNetwork to set.
+ * @param dhcp true if the network type is dhcp
+ * @param networkInterfaceIn The name of the network interface
*/
- public void setStaticNetwork(String staticNetworkIn) {
- staticNetwork = staticNetworkIn;
+ public void setNetworkInfo(boolean dhcp, String networkInterfaceIn) {
+ isDhcp = dhcp;
+ networkInterface = networkInterfaceIn;
}
/**
@@ -132,31 +136,28 @@ public class CobblerSystemCreateCommand extends CobblerCommand {
profileName = nameIn;
}
- protected String lookupExisting() {
- String sysname = null;
+ protected SystemRecord lookupExisting() {
if (server.getCobblerId() != null) {
SystemRecord rec;
rec = SystemRecord.lookupById(CobblerXMLRPCHelper.getConnection(user),
server.getCobblerId());
if (rec != null) {
- sysname = rec.getName();
+ return rec;
}
}
//lookup by ID failed, so lets try by mac
- if (sysname == null) {
- Map sysmap = getSystemMapByMac();
- if (sysmap != null) {
- log.debug("getSystemHandleByMAC.found match.");
- sysname = (String) sysmap.get("name");
+
+ Map sysmap = getSystemMapByMac();
+ if (sysmap != null) {
+ log.debug("getSystemHandleByMAC.found match.");
+ String uid = (String) sysmap.get("uid");
+ SystemRecord rec;
+ rec = SystemRecord.lookupById(CobblerXMLRPCHelper.getConnection(user),
+ server.getCobblerId());
+ if (rec != null) {
+ return rec;
}
}
- if (sysname != null) {
- String handle = (String) invokeXMLRPC("get_system_handle",
- sysname, xmlRpcToken);
- log.debug("getSystemHandleByMAC.returning handle: " + handle);
- return handle;
- }
-
return null;
}
@@ -200,7 +201,6 @@ public class CobblerSystemCreateCommand extends CobblerCommand {
}
}
return null;
-
}
@@ -209,58 +209,44 @@ public class CobblerSystemCreateCommand extends CobblerCommand {
* @return ValidatorError if the store failed.
*/
public ValidatorError store() {
- String handle = null;
+ Profile profile = Profile.lookupByName(getCobblerConnection(), profileName);
// First lookup by MAC addr
- handle = lookupExisting();
- if (handle == null) {
+ SystemRecord rec = lookupExisting();
+ if (rec == null) {
// Next try by name
- try {
- handle = (String) invokeXMLRPC("get_system_handle",
- getCobblerSystemRecordName(), xmlRpcToken);
- log.debug("Did we find handle by name: " + handle);
- }
- catch (RuntimeException e) {
- log.debug("No system by that name either. create a new one");
- }
- }
- // Else, lets make a new system
- if (handle == null) {
- handle = (String) invokeXMLRPC("new_system", xmlRpcToken);
- log.debug("handle: " + handle);
- invokeXMLRPC("modify_system", handle, "name", getCobblerSystemRecordName(),
- xmlRpcToken);
+ rec = SystemRecord.lookupByName(getCobblerConnection(user),
+ getCobblerSystemRecordName());
}
- if (this.server.getNetworkInterfaces() != null &&
- !this.server.getNetworkInterfaces().isEmpty()) {
- processNetworkInterfaces(handle, xmlRpcToken, server);
+ // Else, lets make a new system
+ if (rec == null) {
+ rec = SystemRecord.create(getCobblerConnection(),
+ getCobblerSystemRecordName(),
+ profile);
}
-
- Object[] args = new String[]{handle, "profile",
- profileName, xmlRpcToken};
- invokeXMLRPC("modify_system", Arrays.asList(args));
+ processNetworkInterfaces(rec, server);
+ rec.setProfile(profile);
if (this.activationKeys == null || this.activationKeys.length() == 0) {
log.error("This cobbler profile does not " +
"have a redhat_management_key set ");
}
else {
- invokeXMLRPC("modify_system", handle, "redhat_management_key",
- this.activationKeys, xmlRpcToken);
+ rec.setRedHatManagementKey(activationKeys);
}
-
-
if (!StringUtils.isBlank(getKickstartHost())) {
- invokeXMLRPC("modify_system", handle, "server",
- getKickstartHost(), xmlRpcToken);
+ rec.setServer(getKickstartHost());
}
else {
- invokeXMLRPC("modify_system", handle, "server",
- "", xmlRpcToken);
+ rec.setServer("");
}
// Setup the kickstart metadata so the URLs and activation key are setup
- Map ksmeta = new HashMap();
+ Map<String, Object> ksmeta = rec.getKsMeta();
+ if (ksmeta == null) {
+ ksmeta = new HashMap<String, Object>();
+ }
+
if (!StringUtils.isBlank(mediaPath)) {
ksmeta.put(KickstartUrlHelper.COBBLER_MEDIA_VARIABLE,
this.mediaPath);
@@ -269,35 +255,14 @@ public class CobblerSystemCreateCommand extends CobblerCommand {
ksmeta.put(SystemRecord.REDHAT_MGMT_SERVER,
getKickstartHost());
}
-
- args = new Object[]{handle, "ksmeta",
- ksmeta, xmlRpcToken};
- invokeXMLRPC("modify_system", Arrays.asList(args));
-
- invokeXMLRPC("save_system", handle, xmlRpcToken);
- Map cSystem = getSystemMapByMac();
- // Virt system records have no mac/interfaces setup so we search on name
- if (cSystem == null) {
- cSystem = getSystemMapByName();
- }
- server.setCobblerId((String)cSystem.get("uid"));
- SystemRecord record = SystemRecord.lookupById(getCobblerConnection(),
- server.getCobblerId());
- record.setKernelOptions(kernelOptions);
- record.setKernelPostOptions(postKernelOptions);
-
- record.save();
+ ksmeta.remove(KickstartFormatter.STATIC_NETWORK_VAR);
+ rec.setKsMeta(ksmeta);
+ rec.setKernelOptions(kernelOptions);
+ rec.setKernelPostOptions(postKernelOptions);
+ rec.save();
+ server.setCobblerId(rec.getId());
return null;
}
-
- private Map getSystemMapByName() {
- List < String > args = new ArrayList();
- args.add(getCobblerSystemRecordName());
- args.add(xmlRpcToken);
- Map retval = (Map) invokeXMLRPC("get_system", args);
- return retval;
- }
-
/**
* Get the cobbler system record name for this system.
* @return String name of cobbler system record.
@@ -308,31 +273,25 @@ public class CobblerSystemCreateCommand extends CobblerCommand {
this.server.getOrg().getId();
}
- protected void processNetworkInterfaces(String handleIn,
- String xmlRpcTokenIn,
- Server serverIn) {
- Map inet = new HashMap();
- for (NetworkInterface n : serverIn.getNetworkInterfaces()) {
- if (n.isValid()) {
- inet.put("macaddress-" + n.getName(), n.getHwaddr());
- if (!StringUtils.isBlank(n.getIpaddr())) {
- inet.put("ipaddress-" + n.getName(), n.getIpaddr());
- }
- if (!StringUtils.isBlank(n.getNetmask())) {
- inet.put("subnet-" + n.getName(), n.getNetmask());
- }
- if (!StringUtils.isBlank(staticNetwork) &&
- n.getName().equals(staticNetwork)) {
- inet.put("static-" + n.getName(), Boolean.TRUE);
+ protected void processNetworkInterfaces(SystemRecord rec,
+ Server serverIn) {
+ List <Network> nics = new LinkedList<Network>();
+ if (serverIn.getNetworkInterfaces() != null) {
+ for (NetworkInterface n : serverIn.getNetworkInterfaces()) {
+ if (n.isPublic()) {
+ Network net = new Network(n.getName());
+ net.setIpAddress(n.getIpaddr());
+ net.setMacAddress(n.getHwaddr());
+ net.setNetmask(n.getNetmask());
+ if (!StringUtils.isBlank(networkInterface) &&
+ n.getName().equals(networkInterface)) {
+ net.setStaticNetwork(!isDhcp);
+ }
+ nics.add(net);
}
}
}
- log.debug("Networks: " + inet);
-
- Object[] args = new Object[]{handleIn, "modify-interface",
- inet, xmlRpcTokenIn};
- invokeXMLRPC("modify_system", Arrays.asList(args));
-
+ rec.setNetworkInterfaces(nics);
}
/**
diff --git a/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerVirtualSystemCommand.java b/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerVirtualSystemCommand.java
index 0c265ae..825bd2f 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerVirtualSystemCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerVirtualSystemCommand.java
@@ -22,12 +22,12 @@ import com.redhat.rhn.domain.server.Server;
import com.redhat.rhn.domain.user.User;
import org.apache.log4j.Logger;
+import org.cobbler.Network;
import org.cobbler.SystemRecord;
-import java.util.Arrays;
import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.LinkedList;
+import java.util.List;
/**
@@ -95,21 +95,18 @@ public class CobblerVirtualSystemCommand extends CobblerSystemCreateCommand {
}
@Override
- protected void processNetworkInterfaces(String handleIn,
- String xmlRpcTokenIn, Server serverIn) {
+ protected void processNetworkInterfaces(SystemRecord rec, Server serverIn) {
log.debug("processNetworkInterfaces called.");
-
String newMac = (String) invokeXMLRPC("get_random_mac", Collections.EMPTY_LIST);
- Map inet = new HashMap();
- inet.put("macaddress-" + "eth0", newMac);
-
- Object[] args = new Object[]{handleIn, "modify-interface",
- inet, xmlRpcTokenIn};
- invokeXMLRPC("modify_system", Arrays.asList(args));
+ Network net = new Network("eth0");
+ net.setMacAddress(newMac);
+ List<Network> nics = new LinkedList<Network>();
+ nics.add(net);
+ rec.setNetworkInterfaces(nics);
}
- protected String lookupExisting() {
+ protected SystemRecord lookupExisting() {
log.debug("lookupExisting called.");
SystemRecord rec = SystemRecord.lookupByName(
@@ -118,8 +115,7 @@ public class CobblerVirtualSystemCommand extends CobblerSystemCreateCommand {
return null;
}
else {
- return (String) invokeXMLRPC("get_system_handle",
- rec.getName(), xmlRpcToken);
+ return rec;
}
}
diff --git a/java/code/src/org/cobbler/Network.java b/java/code/src/org/cobbler/Network.java
new file mode 100644
index 0000000..40e971a
--- /dev/null
+++ b/java/code/src/org/cobbler/Network.java
@@ -0,0 +1,149 @@
+/**
+ * Copyright (c) 2009 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package org.cobbler;
+
+import org.apache.commons.lang.StringUtils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * Network
+ * @version $Rev$
+ */
+public class Network {
+ private static final String SUBNET = "subnet";
+ private static final String DNS_NAME = "dns_name";
+ private static final String IP_ADDRESS = "ip_address";
+ private static final String STATIC = "static";
+ private static final String MAC_ADDRESS = "mac_address";
+
+ private String name;
+ private String subnet;
+ private String ipAddress;
+ private boolean isStatic;
+ private String macAddress;
+ /**
+ * Constructor to create a new network interface
+ * @param nameIn the name of the network
+ */
+ public Network(String nameIn) {
+ name = nameIn;
+ }
+
+ /**
+ * Intentionally given default/package scope
+ * returns a nicely formatted map that can be used by
+ * the system record to set it in xmlrpc.
+ * @return a map representation of the interface
+ */
+ Map<String, Object> toMap() {
+ Map<String, Object> inet = new HashMap<String, Object>();
+ addToMap(inet, "macaddress-" + name, macAddress);
+ addToMap(inet, "subnet-" + name, subnet);
+ addToMap(inet, "ipaddress-" + name, ipAddress);
+ addToMap(inet, "macaddress-" + name, macAddress);
+ addToMap(inet, "static-" + name, isStatic);
+ return inet;
+ }
+
+ private void addToMap(Map<String, Object> inet, String key, Object value) {
+ if (value != null || (value instanceof String &&
+ !StringUtils.isBlank((String)value))) {
+ inet.put(key, value);
+ }
+ }
+
+ /**
+ * Given a interface name and map generated by the system record
+ * this method creates a new Network object.
+ * @param name the name of the interface
+ * @param ifaceInfo the interface information
+ * @return the netwrok object
+ */
+ static Network load(String name, Map<String, Object> ifaceInfo) {
+ Network net = new Network(name);
+ net.setMacAddress((String)ifaceInfo.get(MAC_ADDRESS));
+ net.setNetmask((String)ifaceInfo.get(SUBNET));
+ net.setIpAddress((String)ifaceInfo.get(IP_ADDRESS));
+ net.setStaticNetwork(ifaceInfo.containsKey(STATIC) &&
+ Boolean.TRUE.equals(ifaceInfo.get(STATIC)));
+ return net;
+ }
+
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return Returns the subnet.
+ */
+ public String getSubnet() {
+ return subnet;
+ }
+
+ /**
+ * @param subnetIn The subnet to set.
+ */
+ public void setNetmask(String subnetIn) {
+ subnet = subnetIn;
+ }
+
+ /**
+ * @return Returns the ipAddress.
+ */
+ public String getIpAddress() {
+ return ipAddress;
+ }
+
+ /**
+ * @param ipAddressIn The ipAddress to set.
+ */
+ public void setIpAddress(String ipAddressIn) {
+ ipAddress = ipAddressIn;
+ }
+
+ /**
+ * @return Returns the isStatic.
+ */
+ public boolean isStaticNetwork() {
+ return isStatic;
+ }
+
+ /**
+ * @param staticIn The isStatic to set.
+ */
+ public void setStaticNetwork(boolean staticIn) {
+ isStatic = staticIn;
+ }
+
+ /**
+ * @return Returns the macAddress.
+ */
+ public String getMacAddress() {
+ return macAddress;
+ }
+
+ /**
+ * @param macAddressIn The macAddress to set.
+ */
+ public void setMacAddress(String macAddressIn) {
+ macAddress = macAddressIn;
+ }
+}
diff --git a/java/code/src/org/cobbler/SystemRecord.java b/java/code/src/org/cobbler/SystemRecord.java
index 234ad40..8448735 100644
--- a/java/code/src/org/cobbler/SystemRecord.java
+++ b/java/code/src/org/cobbler/SystemRecord.java
@@ -16,6 +16,7 @@
package org.cobbler;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -31,6 +32,7 @@ public class SystemRecord extends CobblerObject {
private static final String NAME_SERVERS = "name_servers";
private static final String GATEWAY = "gateway";
private static final String PROFILE = "profile";
+ private static final String SERVER = "server";
private static final String VIRT_BRIDGE = "virt_bridge";
private static final String VIRT_CPUS = "virt_cpus";
private static final String VIRT_TYPE = "virt_type";
@@ -39,6 +41,8 @@ public class SystemRecord extends CobblerObject {
private static final String VIRT_RAM = "virt_ram";
private static final String NETBOOT_ENABLED = "netboot_enabled";
public static final String REDHAT_MGMT_SERVER = "redhat_management_server";
+ private static final String SET_INTERFACES = "modify-interface";
+ private static final String GET_INTERFACES = "interface";
private SystemRecord(CobblerConnection clientIn) {
client = clientIn;
@@ -48,13 +52,16 @@ public class SystemRecord extends CobblerObject {
* Create a new system record in cobbler
* @param client the xmlrpc client
* @param name the system record name
+ * @param profile the profile to be associated to this system
* @return the newly created system record
*/
public static SystemRecord create(CobblerConnection client,
- String name) {
+ String name,
+ Profile profile) {
SystemRecord sys = new SystemRecord(client);
sys.handle = (String) client.invokeTokenMethod("new_system");
sys.modify(NAME, name);
+ sys.setProfile(profile);
sys.save();
sys = lookupByName(client, name);
return sys;
@@ -199,8 +206,8 @@ public class SystemRecord extends CobblerObject {
/**
* @return the Cobbler Profile name
*/
- public String getProfile() {
- return (String)dataMap.get(PROFILE);
+ public Profile getProfile() {
+ return Profile.lookupByName(client, (String)dataMap.get(PROFILE));
}
/**
@@ -244,6 +251,7 @@ public class SystemRecord extends CobblerObject {
public int getVirtRam() {
return (Integer)dataMap.get(VIRT_RAM);
}
+
/**
* true if netboot enabled is true
* false other wise
@@ -323,4 +331,56 @@ public class SystemRecord extends CobblerObject {
public void setHostName(String hostname) {
modify(HOSTNAME, hostname);
}
+
+ /**
+ * Associates a profile to this system record
+ * @param profile the profile to associate
+ */
+ public void setProfile(Profile profile) {
+ setProfile(profile.getName());
+ }
+
+ /**
+ * Associates a profile to this system record
+ * @param profileName the name of the profile
+ */
+ public void setProfile(String profileName) {
+ modify(PROFILE, profileName);
+ }
+
+ /**
+ * Sets the cobbler server host information for this system
+ * @param server the server host name.
+ */
+ public void setServer(String server) {
+ modify(SERVER, server);
+ }
+
+ /**
+ * Sets the network interfaces available to this system
+ * @param interfaces a list of network interfaces
+ */
+ public void setNetworkInterfaces(List<Network> interfaces) {
+ Map<String, Object> ifaces = new HashMap<String, Object>();
+ for (Network net : interfaces) {
+ ifaces.putAll(net.toMap());
+ }
+ modify(SET_INTERFACES, ifaces);
+ }
+
+ /**
+ * @return a list of network interfaces associated to this system
+ */
+ public List<Network> getNetworkInterfaces() {
+ reload();
+ List<Network> networks = new LinkedList<Network>();
+ Map<String, Map<String, Object>> interfaces = (Map<String, Map<String, Object>>)
+ dataMap.get(GET_INTERFACES);
+ if (interfaces != null) {
+ for (String name : interfaces.keySet()) {
+ networks.add(Network.load(name, interfaces.get(name)));
+ }
+ }
+ return networks;
+ }
}
diff --git a/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/advanced.jspf b/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/advanced.jspf
index 8bbc685..f893301 100644
--- a/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/advanced.jspf
+++ b/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/advanced.jspf
@@ -27,6 +27,9 @@ function setStep(stepName) {
<h2><img src="/img/icon_kickstart_session-medium.gif" /><bean:message key="kickstart.schedule.heading4.jsp" /></h2>
<c:set var="form" value="${kickstartScheduleWizardForm.map}"/>
<html:form method="POST" action="${actionUrl}" styleId="wizard-form">
+<c:if test="${empty regularKS}">
+ <c:set var="noStatic" value="true"/>
+</c:if>
<html:hidden property="wizardStep" value="third" styleId="wizard-step" />
<html:hidden property="scheduleAsap" />
<html:hidden property="date_year" />
@@ -40,9 +43,7 @@ function setStep(stepName) {
<html:hidden property="guestName" />
<html:hidden property="proxyHost" />
<table class="details">
- <c:if test="${not empty regularKS}">
- <%@ include file="/WEB-INF/pages/common/fragments/kickstart/schedule/network-options.jspf" %>
- </c:if>
+ <%@ include file="/WEB-INF/pages/common/fragments/kickstart/schedule/network-options.jspf" %>
<%@ include file="/WEB-INF/pages/common/fragments/kickstart/schedule/kernel-options.jspf" %>
<c:if test="${empty requestScope.cobblerOnlyProfile}" >
<%@ include file="/WEB-INF/pages/common/fragments/kickstart/schedule/profile-sync.jspf" %>
diff --git a/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf b/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf
index 544f130..0a61892 100644
--- a/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf
+++ b/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf
@@ -11,7 +11,7 @@
<input type="hidden" name="kernelParamsType" value="${form.kernelParamsType}" />
<input type="hidden" name="kernelParams" value="${form.kernelParams}" />
- <input type="hidden" name="networkTypeDhcp" value="${form.networkTypeDhcp}" />
+ <input type="hidden" name="networkType" value="${form.networkType}" />
<input type="hidden" name="networkInterface" value="${form.networkInterface}" />
<!-- Store useful id fields-->
diff --git a/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/network-options.jspf b/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/network-options.jspf
index db56262..23c2458 100644
--- a/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/network-options.jspf
+++ b/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/network-options.jspf
@@ -5,20 +5,20 @@
<tr>
<th><bean:message key="kickstart.netconn.jsp.label" />:</th>
<td>
- <input type="radio" name="networkTypeDhcp" value="true"
+ <input type="radio" name="networkType" value="dhcp"
onclick="form.dhcpNetworkId.disabled = false; form.staticNetworkId.disabled = true;"
- <c:if test="${form.networkTypeDhcp or empty form.networkTypeDhcp}">checked="checked"</c:if>
+ <c:if test="${form.networkType == 'dhcp'}">checked="checked"</c:if>
/>
<bean:message key="kickstart.netconn.dhcp.jsp.label"/>
<c:choose>
<c:when test="${empty requestScope.networkInterfaces}">
<input type="text" name="networkInterface" id="dhcpNetworkId" size="4" maxlength="10"
- <c:if test="${not form.networkTypeDhcp}">disabled="true"</c:if>
+ <c:if test="${form.networkType ne 'dhcp'}">disabled="true"</c:if>
value="${form.networkInterface}"/>
</c:when>
<c:otherwise>
<select name="networkInterface" id="dhcpNetworkId"
- <c:if test="${not form.networkTypeDhcp}">disabled="true"</c:if>
+ <c:if test="${form.networkType ne 'dhcp'}">disabled="true"</c:if>
>
<c:forEach var="nic" items="${requestScope.networkInterfaces}">
<option
@@ -29,20 +29,21 @@
</c:otherwise>
</c:choose>
<br />
- <input type="radio" name="networkTypeDhcp" value="false"
+ <c:if test="${empty noStatic}">
+ <input type="radio" name="networkType" value="static"
onclick="form.staticNetworkId.disabled = false;form.dhcpNetworkId.disabled = true;"
- <c:if test="${not form.networkTypeDhcp}">checked="checked"</c:if>
+ <c:if test="${not form.networkType}">checked="checked"</c:if>
/>
<bean:message key="kickstart.netconn.static.jsp.label"/>
<c:choose>
<c:when test="${empty requestScope.networkInterfaces}">
<input type="text" name="networkInterface" id="staticNetworkId" size="4" maxlength="10"
- <c:if test="${form.networkTypeDhcp}">disabled="true"</c:if>
+ <c:if test="${form.networkType ne 'static'}">disabled="true"</c:if>
value="${form.networkInterface}"/>
</c:when>
<c:otherwise>
<select name="networkInterface" id="staticNetworkId"
- <c:if test="${form.networkTypeDhcp}">disabled="true"</c:if>
+ <c:if test="${form.networkType ne 'static'}">disabled="true"</c:if>
>
<c:forEach var="nic" items="${requestScope.networkInterfaces}">
<option
@@ -52,5 +53,12 @@
</select>
</c:otherwise>
</c:choose>
+ <br />
+ </c:if>
+ <input type="radio" name="networkType" value="link"
+ onclick="form.staticNetworkId.disabled = true;form.dhcpNetworkId.disabled = true;"
+ <c:if test="${form.networkType == 'link' or empty form.networkType}">checked="checked"</c:if>
+ />
+ <bean:message key="kickstart.netconn.dhcp.jsp.link"/>
</td>
</tr>
diff --git a/java/code/webapp/WEB-INF/struts-config.xml b/java/code/webapp/WEB-INF/struts-config.xml
index a7966a9..25e88f0 100644
--- a/java/code/webapp/WEB-INF/struts-config.xml
+++ b/java/code/webapp/WEB-INF/struts-config.xml
@@ -728,7 +728,7 @@
<form-property name="nextAction" type="java.lang.String" />
<form-property name="proxyHost" type="java.lang.String" />
<!-- Advanced Options Page -->
- <form-property name="networkTypeDhcp" type="java.lang.Boolean" />
+ <form-property name="networkType" type="java.lang.String" />
<form-property name="networkInterface" type="java.lang.String" />
<form-property name="kernelParamsType" type="java.lang.String" />
<form-property name="kernelParams" type="java.lang.String" />
14 years, 9 months