4 commits - client/rhel rel-eng/packages
by Miroslav Suchý
client/rhel/rhn-client-tools/rhn-client-tools.spec | 7
client/rhel/rhn-client-tools/src/up2date_client/hardware.py | 97 +++++++-----
client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py | 48 +----
rel-eng/packages/rhn-client-tools | 2
4 files changed, 74 insertions(+), 80 deletions(-)
New commits:
commit e93a24c12abf7bade17038fea000f21928567e83
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Dec 14 17:13:58 2009 +0100
Automatic commit of package [rhn-client-tools] release [0.8.1-1].
diff --git a/client/rhel/rhn-client-tools/rhn-client-tools.spec b/client/rhel/rhn-client-tools/rhn-client-tools.spec
index 37aa6ca..e2cb36c 100644
--- a/client/rhel/rhn-client-tools/rhn-client-tools.spec
+++ b/client/rhel/rhn-client-tools/rhn-client-tools.spec
@@ -4,7 +4,7 @@ Group: System Environment/Base
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
URL: https://fedorahosted.org/spacewalk
Name: rhn-client-tools
-Version: 0.8.0
+Version: 0.8.1
Release: 1%{?dist}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%if 0%{?suse_version: %{suse_version} > 1000}
@@ -227,6 +227,9 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/applications/rhn_register.desktop
%changelog
+* Mon Dec 14 2009 Miroslav Suchý <msuchy(a)redhat.com> 0.8.1-1
+- 546312 - do not depend on hald for rhnreg_ks
+
* Tue Dec 1 2009 Miroslav Suchý <msuchy(a)redhat.com> 0.7.11-1
- 541262 - fix networkRetries logic (mzazrivec(a)redhat.com)
diff --git a/rel-eng/packages/rhn-client-tools b/rel-eng/packages/rhn-client-tools
index 6c56fc0..e89f54c 100644
--- a/rel-eng/packages/rhn-client-tools
+++ b/rel-eng/packages/rhn-client-tools
@@ -1 +1 @@
-0.7.11-1 client/rhel/rhn-client-tools/
+0.8.1-1 client/rhel/rhn-client-tools/
commit 3f7cb87a0956eb3ad433b709bb753fffd990beea
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Dec 14 16:38:54 2009 +0100
546312 - use dmidecode instead of hal
also remove dead code refering to rhel4
in rhel4 is used up2date, there is no rhn-client-tools
diff --git a/client/rhel/rhn-client-tools/rhn-client-tools.spec b/client/rhel/rhn-client-tools/rhn-client-tools.spec
index f94d6e8..37aa6ca 100644
--- a/client/rhel/rhn-client-tools/rhn-client-tools.spec
+++ b/client/rhel/rhn-client-tools/rhn-client-tools.spec
@@ -22,6 +22,8 @@ Requires: sh-utils
Requires: dbus-python
Requires: hal >= 0.5.8.1-52
Requires: newt
+Requires: python-dmidecode
+Requires: libxml2-python
Conflicts: up2date < 5.0.0
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py
index 1f5d208..2b6d9cc 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py
@@ -24,6 +24,8 @@ _ = gettext.gettext
from haltree import HalTree, HalDevice
import dbus
+import dmidecode
+import libxml2
import up2dateLog
#PCI DEVICE DEFINES
@@ -99,6 +101,55 @@ try:
except ImportError:
locale = None
+# this does not change, we can cache it
+_dmi_data = None
+_dmi_not_available = 0
+
+def _initialize_dmi_data():
+ """ Initialize _dmi_data unless it already exist and returns it """
+ if _dmi_data is None:
+ if _dmi_not_available:
+ # do not try to initialize it again and again if not available
+ return None
+ else :
+ dmixml = dmidecode.dmidecodeXML()
+ dmixml = _dmi_data.SetResultType(dmidecode.DMIXML_DOC)
+ # Get all the DMI data and prepare a XPath context
+ try:
+ data = dmixml.QuerySection('all')
+ except:
+ # DMI decode FAIL, this can happend e.g in PV guest
+ _dmi_not_available = 1
+ return None
+ _dmi_data = data.xpathNewContext();
+ return _dmi_data
+
+def get_dmi_data(path):
+ """ Fetch DMI data from given section using given path.
+ If data could not be retrieved, returns empty string.
+ General method and should not be used outside of this module.
+ """
+ dmi_data = _initialize_dmi_data()
+ if dmi_data is None:
+ return ''
+ data = dmi_data.xpathEval(path)
+ if data != []:
+ return data[0].content
+ else:
+ # The path do not exist
+ return ''
+
+def dmi_vendor();
+ """ Return Vendor from dmidecode bios information.
+ If this value could not be fetch, returns empty string.
+ """
+ return get_dmi_data('/dmidecode/BIOSInfo/Vendor')
+
+def dmi_system_uuid();
+ """ Return UUID from dmidecode system information.
+ If this value could not be fetch, returns empty string.
+ """
+ return get_dmi_data('/dmidecode/SystemInfo/SystemUUID')
# read_hal()
#
@@ -825,24 +876,8 @@ def read_dmi():
system = product + " " + version
dmidict["system"] = system
- is_pv_guest = 0
- # check to see if this a PV Guest
- if os.access("/dev/xvc0", os.R_OK):
- is_pv_guest = 1
-
# BaseBoard Information
- # bz#432426 To Do: try to avoid system calls and probing hardware to
- # get baseboard and chassis information
- if not is_pv_guest:
- # only probe dmidecode if its not a PV xen guest.
- # As PV guests will *never* be provided SMBIOS data.
- f = os.popen("/usr/sbin/dmidecode --string=baseboard-manufacturer")
- vendor = f.readline().strip()
- f.close()
- dmidict["board"] = vendor
- else:
- dmidict["board"] = ''
-
+ dmidict["board"] = get_dmi_data('/dmidecode/BaseBoardInfo/Manufacturer')
# Bios Information
vendor = get_device_property(computer, "system.firmware.vendor")
@@ -857,33 +892,17 @@ def read_dmi():
# Chassis Information
# The hairy part is figuring out if there is an asset tag/serial number of importance
- asset = ""
- if not is_pv_guest:
- # only probe dmidecode if its not a PV xen guest.
- # As PV guests will *never* be provided SMBIOS data.
- f = os.popen("/usr/sbin/dmidecode --string=chassis-serial-number")
- chassis_serial = f.readline().strip()
- f.close()
-
- f = os.popen("/usr/sbin/dmidecode --string=chassis-asset-tag")
- chassis_tag = f.readline().strip()
- f.close()
-
- f = os.popen("/usr/sbin/dmidecode --string=baseboard-serial-number")
- board_serial = f.readline().strip()
- f.close()
- else:
- chassis_serial = chassis_tag = board_serial = ''
+ chassis_serial = get_dmi_data('/dmidecode/SystemInfo/SerialNumber')
+ chassis_tag = get_dmi_data('/dmidecode/ChassisInfo/AssetTag')
+ board_serial = get_dmi_data('/dmidecode/BaseBoardInfo/SerialNumber')
system_serial = get_device_property(computer, "smbios.system.serial")
- asset = "(%s: %s) (%s: %s) (%s: %s) (%s: %s)" % ("chassis", chassis_serial,
+ dmidict["asset"] = "(%s: %s) (%s: %s) (%s: %s) (%s: %s)" % ("chassis", chassis_serial,
"chassis", chassis_tag,
"board", board_serial,
"system", system_serial)
- dmidict["asset"] = asset
-
# Clean up empty entries
for k in dmidict.keys()[:]:
if dmidict[k] is None:
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
index a802012..709392d 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
@@ -27,13 +27,6 @@ except ImportError:
rpclib = __import__("xmlrpclib")
try:
- import dmi
-except ImportError:
- # If we couldn't import a DMI module, we'll use HAL instead.
- dmi = None
- import dbus
-
-try:
from virtualization import support
except ImportError:
support = None
@@ -253,34 +246,14 @@ def get_fully_virt_info():
This function looks in the SMBIOS area to determine if this is a
fully-virt guest. It returns a (uuid, virt_type) tuple.
"""
- try:
- # For RHEL4 systems and lower, we'll try to use DMI.
- if dmi is not None:
- dmi_registry = dmi.DMI()
- vendor = dmi_registry['system']['vendor']
- if vendor.lower() == "xen":
- uuid = dmi_registry['system']['serial']
- uuid = uuid.lower().replace('-', '')
- virt_type = "fully"
- return (uuid, virt_type)
- else:
- # For RHEL5 systems and higher, we'll use HAL.
- bus = dbus.SystemBus()
- device_obj = \
- bus.get_object('org.freedesktop.Hal',
- '/org/freedesktop/Hal/devices/computer')
- device = dbus.Interface(device_obj, 'org.freedesktop.Hal.Device')
- vendor = device.GetPropertyString('smbios.bios.vendor')
- if vendor.lower() == "xen":
- uuid = device.GetPropertyString('smbios.system.uuid')
- uuid = uuid.lower().replace('-', '')
- virt_type = "fully"
- return (uuid, virt_type)
- except:
- # Failed. Must not be fully-virt.
- pass
-
- return (None, None)
+ vendor = hardware.dmi_vendor()
+ uuid = hardware.dmi_system_uuid()
+ if vendor.lower() == "xen":
+ uuid = uuid.lower().replace('-', '')
+ virt_type = "fully"
+ return (uuid, virt_type)
+ else:
+ return (None, None)
def _is_host_uuid(uuid):
uuid = eval('0x%s' % uuid)
commit f1c4b326894e8dd7f1758ee59741a7b780c9046a
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Dec 11 13:46:11 2009 +0100
no need to call hal on non-intel machine when the information is not used
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py
index c898775..1f5d208 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py
@@ -801,8 +801,6 @@ def get_hal_computer():
# Read DMI information via hal.
def read_dmi():
- computer = get_hal_computer()
-
dmidict = {}
dmidict["class"] = "DMI"
@@ -811,6 +809,8 @@ def read_dmi():
if not (uname[0] == "i" and uname[-2:] == "86") and not (uname == "x86_64"):
return dmidict
+ computer = get_hal_computer()
+
# System Information
vendor = get_device_property(computer, "system.hardware.vendor")
if vendor:
commit 975651d53abbe77b402e0d25e03ecb4c81a40ca9
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Dec 10 17:25:35 2009 +0100
546312 - reverting revision 186347
get_hal_smbios has try/except inside of itself,
there is no need to wrap it again
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
index 974b4ba..a802012 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
@@ -422,10 +422,7 @@ def registerSystem(username = None, password = None,
auth_dict["password"] = password
if cfg['supportsSMBIOS']:
- try:
- auth_dict["smbios"] = hardware.get_hal_smbios()
- except:
- log.log_debug("Cannot Acquire hardware information")
+ auth_dict["smbios"] = hardware.get_hal_smbios()
s = rhnserver.RhnServer()
if packages == None:
14 years, 4 months
client/rhel
by Milan Zazrivec
client/rhel/rhn-client-tools/src/up2date_client/up2dateLog.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 2ba0d243493030359fdba9480bc11f5ad4996620
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Mon Dec 14 16:53:55 2009 +0100
503146 - use stdout whether it's an actual tty or not
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/up2dateLog.py b/client/rhel/rhn-client-tools/src/up2date_client/up2dateLog.py
index f30bf45..661cd5c 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/up2dateLog.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/up2dateLog.py
@@ -32,7 +32,7 @@ class Log:
s = ""
for i in args:
s = s + "%s" % (i,)
- if self.cfg["debug"] > 1 and self.cfg["isatty"]:
+ if self.cfg["debug"] > 1:
print s
self.write_log(s)
14 years, 4 months
Changes to 'refs/tags/spacewalk-backend-0.8.11-1'
by Michael Mraka
Tag 'spacewalk-backend-0.8.11-1' created by Michael Mraka <michael.mraka(a)redhat.com> at 2009-12-14 15:40 +0000
Tagging package [spacewalk-backend] version [0.8.11-1] in directory [backend/].
Changes since spacewalk-reports-0.7.0-1:
Jan Pazdziora (34):
rhn-xml-checker not used anywhere, removing, as well as xml_checker.
rhn-edit-errata-form not used anywhere, removing, as well as errata_edit.
rhn-errata-editor-channel-options not used anywhere, removing, as well as errata_channel_options.
Package Sniglets::Actions is not used anywhere, removing as dead code.
rhn-appinstall-progress not used anywhere, removing that appinstall_progress does not exist anyway.
Package Sniglets::MonitoringConfig is not used anywhere, removing as dead code.
edit_template_string.xml is not used anywhere, removing as dead code.
rhn-render-form not used anywhere, removing, as well as render_form and prepare_form.
Package Sniglets::Debug is not used anywhere, removing as dead code.
Package Sniglets::Template is not used anywhere, removing as dead code.
rhn-package-name not used anywhere, removing.
rhn-download-privileges not used anywhere, removing, as well as download_privileges.
rhn-display-server-note not used anywhere, removing, as well as display_server_note.
rhn-channel-relationships not used anywhere, removing, as well as channel_relationships.
public-attempted-errata not used anywhere, removing, as well as public_attempted_errata.
rhn-system-probe-creation-form not used anywhere, removing, as well as system_probe_creation_form.
rhn-system-probe-edit-form not used anywhere, removing, as well as system_probe_edit_form.
rhn-cert-text not used anywhere, removing, as well as cert_text.
Previous removals made download_cert and create_cert_text unused, removing as dead code.
rhn-org-entitlement-name not used anywhere, removing, as well as org_entitlement_name.
rhn-search-bar not used anywhere, removing, as well as search_bar.
rhn-errata-search-form not used anywhere, removing, as well as errata_search_form.
rhn-package-search-form not used anywhere, removing, as well as package_search_form.
rhn-system-search-form not used anywhere, removing, as well as system_search_form.
rhn-if-searched not used anywhere, removing, as well as if_searched.
Package Sniglets::ProbeReport is not used anywhere, removing as dead code.
rhn-verify-channel-family not used anywhere, removing, as well as verify_channel_family.
Removal of verify_channel_family makes verify_org_family and verify_family_permissions unused, removing as dead code.
rhn-if-packages-deleted-from-channels not used anywhere, removing, as well as if_packages_deleted_from_channels.
rhn-show-all-errata-checkbox not used anywhere, removing, as well as show_all_errata_checkbox.
rhn-date-pickbox not used anywhere, removing as dead register.
rhn-latest-config-actions not used anywhere, removing, as well as latest_config_actions.
rhn-debug not used anywhere, removing, as well as debug_dump.
rhn-country-select not used anywhere, removing, as well as country_select.
Michael Mraka (7):
fixed spacewalk-backend-libs packaging error
fixed import of kickstart trees nad packages (satellite-sync)
fixed 'packages.channelPackageSubscriptionBySession': caught <type 'exceptions.KeyError'> : 'md5sum'
spacewalk-report moved out of backend (see 6e3b9f87e)
spacewalk-report moved out of backend (see 6e3b9f87e)
fixed NameError: global name 'md5sum_exists' is not defined
Automatic commit of package [spacewalk-backend] release [0.8.11-1].
Milan Zazrivec (1):
516207 - drop extraneous 'Why Register' windows from rhn_register (TUI)
---
backend/satellite_tools/Makefile | 10
backend/satellite_tools/satsync.py | 12
backend/server/handlers/app/packages.py | 24
backend/setup.py | 2
backend/spacewalk-backend.spec | 4
client/rhel/rhn-client-tools/src/up2date_client/tui.py | 2
rel-eng/packages/spacewalk-backend | 2
web/html/forms/edit_template_string.xml | 13
web/modules/rhn/RHN/DB/ChannelEditor.pm | 96 --
web/modules/sniglets/Sniglets/Actions.pm | 129 ---
web/modules/sniglets/Sniglets/AppInstall.pm | 1
web/modules/sniglets/Sniglets/Channel.pm | 53 -
web/modules/sniglets/Sniglets/ChannelEditor.pm | 48 -
web/modules/sniglets/Sniglets/Debug.pm | 52 -
web/modules/sniglets/Sniglets/ErrataEditor.pm | 187 -----
web/modules/sniglets/Sniglets/Forms.pm | 66 -
web/modules/sniglets/Sniglets/MonitoringConfig.pm | 119 ---
web/modules/sniglets/Sniglets/Org.pm | 127 ---
web/modules/sniglets/Sniglets/Packages.pm | 20
web/modules/sniglets/Sniglets/ProbeReport.pm | 586 -----------------
web/modules/sniglets/Sniglets/Probes.pm | 38 -
web/modules/sniglets/Sniglets/PublicErrata.pm | 10
web/modules/sniglets/Sniglets/Search.pm | 157 ----
web/modules/sniglets/Sniglets/ServerActions.pm | 53 -
web/modules/sniglets/Sniglets/ServerNotes.pm | 19
web/modules/sniglets/Sniglets/Sets.pm | 57 -
web/modules/sniglets/Sniglets/Template.pm | 68 -
web/modules/sniglets/Sniglets/Utils.pm | 47 -
28 files changed, 29 insertions(+), 1973 deletions(-)
---
14 years, 4 months
backend/spacewalk-backend.spec rel-eng/packages
by Michael Mraka
backend/spacewalk-backend.spec | 4 ++--
rel-eng/packages/spacewalk-backend | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 39df493c484564cbb6d4cc98dd3df45499057e25
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Dec 14 16:40:15 2009 +0100
Automatic commit of package [spacewalk-backend] release [0.8.11-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 639bfea..c112d99 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -8,7 +8,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2
-Version: 0.8.10
+Version: 0.8.11
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -596,7 +596,7 @@ rm -f %{rhnconf}/rhnSecret.py*
* Mon Dec 14 2009 Jan Pazdziora 0.8.10-1
- reporting: add column total to the entitlements report
-* Mon Dec 14 2009 Michael Mraka <michael.mraka(a)redhat.com> 0.8.9-1
+* Mon Dec 14 2009 Michael Mraka <michael.mraka(a)redhat.com> 0.8.11-1
- fixed satellite-sync errata import
* Fri Dec 11 2009 Michael Mraka <michael.mraka(a)redhat.com> 0.8.8-1
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index 2b81d8f..0f60e84 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-0.8.10-1 backend/
+0.8.11-1 backend/
14 years, 4 months
2 commits - backend/satellite_tools backend/server
by Michael Mraka
backend/satellite_tools/Makefile | 8 --------
backend/server/handlers/app/packages.py | 2 +-
2 files changed, 1 insertion(+), 9 deletions(-)
New commits:
commit ab8ea8b080a06429cb187237824b69dee09641bf
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Dec 14 16:39:20 2009 +0100
fixed NameError: global name 'md5sum_exists' is not defined
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index 7e448ac..4e5bf62 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -365,7 +365,7 @@ class Packages(RPC_Base):
if package['epoch'] != '':
pkg_epoch = package['epoch']
- if md5sum_exists:
+ if checksum_exists:
h.execute(pkg_name=package['name'], \
pkg_epoch=pkg_epoch, \
pkg_version=package['version'], \
commit 84b7a9e54e32d5dd5f02e1906985788a03e03e80
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Dec 14 16:29:38 2009 +0100
spacewalk-report moved out of backend (see 6e3b9f87e)
diff --git a/backend/satellite_tools/Makefile b/backend/satellite_tools/Makefile
index 5f3d4ff..352109e 100644
--- a/backend/satellite_tools/Makefile
+++ b/backend/satellite_tools/Makefile
@@ -19,12 +19,6 @@ SCRIPTS = satellite-sync spacewalk-debug\
rhn-ssl-dbstore update-packages rhn-db-stats rhn-schema-stats \
spacewalk-repo-sync
-SPACEWALK_SUBDIRS = reports reports/data
-
-SPACEWALK_FILES = reports
-
-SPACEWALK_REPORT_FILES = reports/data
-
# check if we can build man pages
DOCBOOK = $(wildcard /usr/bin/docbook2man)
@@ -46,8 +40,6 @@ include $(TOP)/Makefile.defs
all :: $(SCRIPTS)
install :: $(SCRIPTS) $(PREFIX)/$(BINDIR)
$(INSTALL_BIN) $(SCRIPTS) $(PREFIX)/$(BINDIR)
- $(INSTALL_DIR) $(addprefix $(PREFIX)$(SPACEWALK_ROOT)/, $(SPACEWALK_SUBDIRS))
- $(INSTALL_DATA) $(SPACEWALK_REPORT_FILES)/* $(PREFIX)$(SPACEWALK_ROOT)/reports/data
ifneq ($(DOCBOOK),)
# install man pages
14 years, 4 months
4 commits - backend/satellite_tools backend/server backend/setup.py
by Michael Mraka
backend/satellite_tools/Makefile | 2 +-
backend/satellite_tools/satsync.py | 12 +++++++++---
backend/server/handlers/app/packages.py | 22 ++++++++++++++--------
backend/setup.py | 2 +-
4 files changed, 25 insertions(+), 13 deletions(-)
New commits:
commit 4e287ce0f5eee91c095ee132afd266755595ee2a
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Dec 14 16:24:23 2009 +0100
spacewalk-report moved out of backend (see 6e3b9f87e)
diff --git a/backend/satellite_tools/Makefile b/backend/satellite_tools/Makefile
index fb22c4b..5f3d4ff 100644
--- a/backend/satellite_tools/Makefile
+++ b/backend/satellite_tools/Makefile
@@ -17,7 +17,7 @@ FILES = __init__ connection diskImportLib messages \
SCRIPTS = satellite-sync spacewalk-debug\
rhn-schema-version rhn-satellite-activate rhn-charsets \
rhn-ssl-dbstore update-packages rhn-db-stats rhn-schema-stats \
- spacewalk-repo-sync spacewalk-report
+ spacewalk-repo-sync
SPACEWALK_SUBDIRS = reports reports/data
commit 8fb26d450dfd854f66044de0e0d97dae97f5ca81
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Dec 14 15:14:09 2009 +0100
fixed 'packages.channelPackageSubscriptionBySession': caught <type 'exceptions.KeyError'> : 'md5sum'
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index 86cbdc6..7e448ac 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -349,14 +349,18 @@ class Packages(RPC_Base):
if package['arch'] == 'src' or package['arch'] == 'nosrc':
# Source package - no reason to continue
continue
- _md5sum_sql_filter = ""
- md5sum_exists = 0
- if package.has_key('md5sum') and CFG.ENABLE_NVREA:
- md5sum_exists = 1
- _md5sum_sql_filter = """and c.checksum = :md5sum"""
+ _checksum_sql_filter = ""
+ checksum_exists = 0
+ if 'md5sum' in package: # for old rhnpush compatibility
+ package['checksum'] = ('md5', package['md5sum'])
+
+ if package.has_key('checksum') and CFG.ENABLE_NVREA:
+ checksum_exists = 1
+ _checksum_sql_filter = """and c.checksum = :checksum
+ and c.checksum_type = :checksum_type"""
h = rhnSQL.prepare(self._get_pkg_info_query % \
- _md5sum_sql_filter)
+ _checksum_sql_filter)
pkg_epoch = None
if package['epoch'] != '':
pkg_epoch = package['epoch']
@@ -366,7 +370,9 @@ class Packages(RPC_Base):
pkg_epoch=pkg_epoch, \
pkg_version=package['version'], \
pkg_rel=package['release'],pkg_arch=package['arch'], \
- orgid = org_id, md5sum = package['md5sum'] )
+ orgid = org_id, \
+ checksum_type = package['checksum'][0], \
+ checksum = package['checksum'][1])
else:
h.execute(pkg_name=package['name'], \
pkg_epoch=pkg_epoch, \
@@ -376,7 +382,7 @@ class Packages(RPC_Base):
row = h.fetchone_dict()
- package['md5sum'] = row['md5sum']
+ package['checksum'] = (row['checksum_type'], row['checksum'])
package['org_id'] = org_id
package['channels'] = channelList
batch.append(IncompletePackage().populate(package))
commit a036d4b387913d9dcc1a4be2d9589fd3c3f469a9
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Dec 14 14:44:37 2009 +0100
fixed import of kickstart trees nad packages (satellite-sync)
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index 230d32c..17ff868 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -1423,10 +1423,13 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
relative_path = f['relative_path']
dest_path = os.path.join(base_path, relative_path)
timestamp = rhnLib.timestamp(f['last_modified'])
- md5sum = f['md5sum']
+ if 'md5sum' in f: # old pre-sha256 kickstart export
+ checksum = ('md5', f['md5sum'])
+ else:
+ checksum = (f['checksum_type'], f['checksum'])
file_size = f['file_size']
(errcode, ret_path) = self._verify_file(dest_path,
- timestamp, file_size, ('md5', md5sum)) # FIXME sha256
+ timestamp, file_size, checksum)
if errcode != 0:
# Have to download it
val = (kt_label, base_path, relative_path,
@@ -1674,7 +1677,10 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
# Populate the package key info
if len(self.pkg_header_info) > 0:
for data in self.pkg_header_info:
- checksum = ('md5', data['md5sum']) # FIXME sha256
+ if 'md5sum' in data: # old pre-sha256 package export
+ checksum = ('md5', data['md5sum'])
+ else:
+ checksum = (data['checksum_type'], data['checksum'])
server_packages.processPackageKeyAssociations(data['header'], \
checksum)
return self._link_channel_packages()
commit 52405c8fce62b4e7eaf6d69ed1ea59f33bc288e7
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Dec 14 14:20:22 2009 +0100
fixed spacewalk-backend-libs packaging error
diff --git a/backend/setup.py b/backend/setup.py
index ecb8896..f07abf8 100644
--- a/backend/setup.py
+++ b/backend/setup.py
@@ -12,6 +12,6 @@ setup(name = os.environ["PYTHON_MODULE_NAME"],
long_description = """A collection of python modules used by the
Spacewalk (http://spacewalk.redhat.com) software.""",
url = 'http://spacewalk.redhat.com',
- packages = ["spacewalk/common"],
+ packages = ["spacewalk", "spacewalk/common"],
license = "GPL",
)
14 years, 4 months
4 commits - web/modules
by Jan Pazdziora
web/modules/sniglets/Sniglets/ServerActions.pm | 53 -------------------------
web/modules/sniglets/Sniglets/Utils.pm | 47 ----------------------
2 files changed, 100 deletions(-)
New commits:
commit 0eadbef5f7f782bf120e0828e77f809263bd121f
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 15:14:09 2009 +0100
rhn-country-select not used anywhere, removing, as well as country_select.
diff --git a/web/modules/sniglets/Sniglets/Utils.pm b/web/modules/sniglets/Sniglets/Utils.pm
index a9cf16f..1108b56 100644
--- a/web/modules/sniglets/Sniglets/Utils.pm
+++ b/web/modules/sniglets/Sniglets/Utils.pm
@@ -23,7 +23,6 @@ sub register_tags {
my $class = shift;
my $pxt = shift;
- $pxt->register_tag("rhn-country-select", \&country_select);
$pxt->register_tag("rhn-bugzilla-link", \&rhn_bugzilla_link);
$pxt->register_tag("rhn-redirect", \&rhn_redirect);
}
@@ -90,18 +89,4 @@ EOC
}
}
-sub country_select {
- my $pxt = shift;
- my %params = @_;
-
- my $var_name = $params{var_name};
- my $var_value = $params{var_value};
- my $var_lang = $params{var_lang};
- my $allow_empty = $params{allow_empty};
-
-# warn "var name == $var_name, var value == $var_value";
-
- return PXT::Utils->country_selectbox($var_name, $var_lang, $var_value, undef, $allow_empty);
-}
-
1;
commit 73e5a13e5adf1da25b8b4d4103765caf5d9442bc
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 15:13:21 2009 +0100
rhn-debug not used anywhere, removing, as well as debug_dump.
diff --git a/web/modules/sniglets/Sniglets/Utils.pm b/web/modules/sniglets/Sniglets/Utils.pm
index b59358c..a9cf16f 100644
--- a/web/modules/sniglets/Sniglets/Utils.pm
+++ b/web/modules/sniglets/Sniglets/Utils.pm
@@ -23,7 +23,6 @@ sub register_tags {
my $class = shift;
my $pxt = shift;
- $pxt->register_tag("rhn-debug", \&debug_dump);
$pxt->register_tag("rhn-country-select", \&country_select);
$pxt->register_tag("rhn-bugzilla-link", \&rhn_bugzilla_link);
$pxt->register_tag("rhn-redirect", \&rhn_redirect);
@@ -105,35 +104,4 @@ sub country_select {
return PXT::Utils->country_selectbox($var_name, $var_lang, $var_value, undef, $allow_empty);
}
-sub debug_dump {
- my $pxt = shift;
-
- my $ret = '';
-
- if ( $pxt->user() ) {
- return $ret unless ( $pxt->user->login =~ /^rhn7/ );
- } else {
- # This needs to be uncommented later
- return '';
- }
-
-
- $ret .= "<p><ul>\n";
- foreach my $p ($pxt->param) {
- $ret .= "<li>$p: " . $pxt->param($p) . "<br>\n";
- }
- $ret .= "</li></p>\n<br>\n<br>\n";
-
- if ($pxt->user) {
- $ret .= "<strong>You are currently logged in.</strong><br>\n";
- $ret .= "Username: " . $pxt->user->login . "<br>\n";
- $ret .= "User id: " . $pxt->session->uid . "<br>\n";
- }
-
-# $ret .= "Session id: " . $pxt->session->key . "<br>\n";
- $ret .= "Session dump: <pre>" . Data::Dumper->Dump([ $pxt->session ]) . "</pre>\n";
-
- return $ret;
-}
-
1;
commit 71c36a004ad9ae0dc8cf3f4ec9b28fff068be7fa
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 15:12:17 2009 +0100
rhn-latest-config-actions not used anywhere, removing, as well as latest_config_actions.
diff --git a/web/modules/sniglets/Sniglets/ServerActions.pm b/web/modules/sniglets/Sniglets/ServerActions.pm
index 2cabaa7..a1f3369 100644
--- a/web/modules/sniglets/Sniglets/ServerActions.pm
+++ b/web/modules/sniglets/Sniglets/ServerActions.pm
@@ -42,7 +42,6 @@ sub register_tags {
$pxt->register_tag('rhn-schedule-action-interface' => \&schedule_action_interface, 2);
$pxt->register_tag('rhn-reschedule-form-if-failed-action' => \&reschedule_form_if_failed_action);
- $pxt->register_tag('rhn-latest-config-actions' => \&latest_config_actions);
$pxt->register_tag('rhn-package-event-result' => \&package_event_result);
}
@@ -443,57 +442,6 @@ my %config_actions = ('configfiles.verify' => 'verification',
'configfiles.upload' => 'upload',
'configfiles.deploy' => 'deploy');
-sub latest_config_actions {
- my $pxt = shift;
- my %attr = @_;
-
- my $type = $attr{type};
-
- die "Invalid type"
- unless grep { $_ eq $type } keys %config_actions;
-
- my @actions = RHN::Server->get_latest_actions(-server_id => $pxt->param('sid'), -type => $type);
-
- my $template = $attr{__block__};
- my $html;
-
- my $sid = $pxt->param('sid');
-
- my $upload_namespace_id = RHN::ConfigChannel->vivify_server_config_channel($sid, 'server_import');
-
- foreach my $row (@actions) {
- my %subst;
- $subst{action_type_name} = $config_actions{$attr{type}};
- $subst{action_type_name} =~ s/^(.)/\U$1/;
- $subst{action_status} = $row->{STATUS};
- $subst{action_status} =~ s/^(.)/\L$1/;
- $subst{action_time} = $pxt->user->convert_time($row->{LAST_MODIFIED});
-
- my $link_text = $row->{STATUS} eq 'Completed' ? 'View Results' : 'View Status';
-
- if ( (grep { $type eq $_ } qw/configfiles.verify configfiles.deploy/)
- or ($row->{STATUS} ne 'Completed') ) {
- $subst{results_link} =
- PXT::HTML->link(sprintf('/network/systems/details/history/event.pxt?sid=%d&hid=%d', $sid, $row->{ID}),
- $link_text);
- }
- elsif ( $type eq 'configfiles.upload' ) {
- $subst{results_link} =
- PXT::HTML->link(sprintf('/rhn/systems/details/configuration/ViewModifyLocalPaths.do?sid=%d',
- $sid), $link_text);
- }
- elsif ( $type eq 'configfiles.diff') {
- $subst{results_link} =
- PXT::HTML->link(sprintf('/network/systems/details/history/event.pxt?sid=%d&hid=%d',
- $sid, $row->{ID}), $link_text);
- }
-
- $html .= PXT::Utils->perform_substitutions($template, \%subst);
- }
-
- return $html;
-}
-
sub schedule_config_action_cb {
my $pxt = shift;
my $sid = $pxt->param('sid');
commit fce16cfe6e9fafe8c43fa341d77cda014d1836f5
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 15:11:24 2009 +0100
rhn-date-pickbox not used anywhere, removing as dead register.
diff --git a/web/modules/sniglets/Sniglets/ServerActions.pm b/web/modules/sniglets/Sniglets/ServerActions.pm
index f8a1ee2..2cabaa7 100644
--- a/web/modules/sniglets/Sniglets/ServerActions.pm
+++ b/web/modules/sniglets/Sniglets/ServerActions.pm
@@ -41,7 +41,6 @@ sub register_tags {
$pxt->register_tag('rhn-raw-script-output' => \&raw_script_output);
$pxt->register_tag('rhn-schedule-action-interface' => \&schedule_action_interface, 2);
- $pxt->register_tag('rhn-date-pickbox' => \&date_pickbox, 1);
$pxt->register_tag('rhn-reschedule-form-if-failed-action' => \&reschedule_form_if_failed_action);
$pxt->register_tag('rhn-latest-config-actions' => \&latest_config_actions);
14 years, 4 months
5 commits - web/modules
by Jan Pazdziora
web/modules/rhn/RHN/DB/ChannelEditor.pm | 96 ----
web/modules/sniglets/Sniglets/ChannelEditor.pm | 48 --
web/modules/sniglets/Sniglets/ProbeReport.pm | 586 -------------------------
3 files changed, 730 deletions(-)
New commits:
commit e127e202b2dc3504816ed959a7e9e356285d24fc
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 15:08:04 2009 +0100
rhn-show-all-errata-checkbox not used anywhere, removing, as well as show_all_errata_checkbox.
diff --git a/web/modules/sniglets/Sniglets/ChannelEditor.pm b/web/modules/sniglets/Sniglets/ChannelEditor.pm
index 6c1f149..bfc32e5 100644
--- a/web/modules/sniglets/Sniglets/ChannelEditor.pm
+++ b/web/modules/sniglets/Sniglets/ChannelEditor.pm
@@ -34,7 +34,6 @@ sub register_tags {
$pxt->register_tag('rhn-channel-edit-form' => \&channel_edit_form);
$pxt->register_tag('rhn-channel-select-options' => \&channel_select_options);
$pxt->register_tag('rhn-if-package-list-modified' => \&if_package_list_modified);
- $pxt->register_tag('rhn-show-all-errata-checkbox' => \&show_all_errata_checkbox);
$pxt->register_tag('rhn-if-var' => \&if_var, -5);
$pxt->register_tag('rhn-clone-channel-form' => \&clone_channel_form);
@@ -821,15 +820,6 @@ sub if_var {
return $block;
}
-sub show_all_errata_checkbox {
- my $pxt = shift;
- my %attr = @_;
-
- return PXT::HTML->checkbox(-name => 'show_all_errata',
- -value => 1,
- -checked => $pxt->dirty_param('show_all_errata') ? 1 : 0);
-}
-
sub channel_sync_prompt {
my $pxt = shift;
my %params = @_;
commit 5a1819a223fd557b8629640d1905234968ce87f1
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 15:07:19 2009 +0100
rhn-if-packages-deleted-from-channels not used anywhere, removing, as well as if_packages_deleted_from_channels.
diff --git a/web/modules/sniglets/Sniglets/ChannelEditor.pm b/web/modules/sniglets/Sniglets/ChannelEditor.pm
index a4c4937..6c1f149 100644
--- a/web/modules/sniglets/Sniglets/ChannelEditor.pm
+++ b/web/modules/sniglets/Sniglets/ChannelEditor.pm
@@ -34,7 +34,6 @@ sub register_tags {
$pxt->register_tag('rhn-channel-edit-form' => \&channel_edit_form);
$pxt->register_tag('rhn-channel-select-options' => \&channel_select_options);
$pxt->register_tag('rhn-if-package-list-modified' => \&if_package_list_modified);
- $pxt->register_tag('rhn-if-packages-deleted-from-channels' => \&if_packages_deleted_from_channels);
$pxt->register_tag('rhn-show-all-errata-checkbox' => \&show_all_errata_checkbox);
$pxt->register_tag('rhn-if-var' => \&if_var, -5);
$pxt->register_tag('rhn-clone-channel-form' => \&clone_channel_form);
@@ -811,27 +810,6 @@ sub if_package_list_modified {
return '';
}
-sub if_packages_deleted_from_channels {
- my $pxt = shift;
- my %params = @_;
-
- my $block = $params{__block__};
-
- my $package_list_edited = $pxt->session->get('package_list_edited');
-
- my @channels = keys %{$package_list_edited};
-
- foreach my $cid (@channels) {
- my $edited = $package_list_edited->{$cid} || 0;
-
- if ((time - $edited) < 3600) {
- return $block;
- }
- }
-
- return '';
-}
-
sub if_var {
my $pxt = shift;
my %attr = @_;
commit b407b0269417db5800a4db2698e74fe58771f346
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 15:06:15 2009 +0100
Removal of verify_channel_family makes verify_org_family and verify_family_permissions unused, removing as dead code.
diff --git a/web/modules/rhn/RHN/DB/ChannelEditor.pm b/web/modules/rhn/RHN/DB/ChannelEditor.pm
index 57118c9..57e65f0 100644
--- a/web/modules/rhn/RHN/DB/ChannelEditor.pm
+++ b/web/modules/rhn/RHN/DB/ChannelEditor.pm
@@ -597,102 +597,6 @@ EOQ
$dbh->commit;
}
-#checks that org has a channelfamily associated with it. If not, creates one.
-sub verify_org_family {
-
- my $class = shift;
- my $org = shift or return;
-
- my $dbh = RHN::DB->connect();
-
- my $query =<<EOQ;
- SELECT CF.id
- FROM rhnChannelFamily CF
- WHERE CF.org_id = ?
-ORDER BY CF.id
-EOQ
-
- my $sth = $dbh->prepare($query);
-
- $sth->execute($org->id);
-
- my @cf_ids;
-
- while (my ($data) = $sth->fetchrow) {
- push @cf_ids, $data;
- }
-
- unless (@cf_ids) { #make a channelfamily for this org
-
- $query =<<EOQ;
-INSERT INTO rhnChannelFamily
- (id, name, label, org_id, product_url)
- VALUES (rhn_channel_family_id_seq.nextval, ?, ?, ?, ?)
-EOQ
-
- $sth = $dbh->prepare($query);
- $sth->execute($org->name . " (" . $org->id . ") " . "Channel Family", "private-channel-family-".$org->id, $org->id, "org_channel_family.pxt");
-
- $dbh->commit;
-
- }
-
- return;
-
-}
-
-#checks that org has a channelfamilypermission for it's channelfamily
-#grants them if it does not.
-#Takes an org object, and returns the rhnChannelFamily.id(s) added, if any.
-sub verify_family_permissions {
-
- my $class = shift;
- my $org = shift or return;
-
- my $dbh = RHN::DB->connect();
-
- my $query =<<EOQ;
- SELECT CF.id
- FROM rhnChannelFamily CF
- WHERE CF.org_id = ?
-AND NOT EXISTS (
- SELECT 1
- FROM rhnChannelFamilyPermissions CFP
- WHERE CFP.org_id = CF.org_id
- AND CFP.channel_family_id = CF.id)
-ORDER BY CF.id
-EOQ
-
- my $sth = $dbh->prepare($query);
-
- $sth->execute($org->id);
-
- my @cf_ids;
-
- while (my ($data) = $sth->fetchrow) {
- push @cf_ids, $data;
- }
-
- return unless @cf_ids;
-
- $query = <<EOQ;
-INSERT INTO rhnPrivateChannelFamily
- (channel_family_id, org_id, max_members, current_members)
- VALUES (?, ?, NULL, 0)
-EOQ
-
- $sth = $dbh->prepare($query);
-
- foreach my $cf_id (@cf_ids) {
- $sth->execute($cf_id, $org->id);
- }
-
- $dbh->commit;
-
- return @cf_ids;
-
-}
-
#pick the 'most likely' parent for a cloned channel by:
# 1) See if the org owns a clone of the original channel's parent
# 2) Otherwise, pick the actual parent of the original channel
commit 3a3295166cdc76be9dd844ad669e94e1dad8060c
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 15:04:44 2009 +0100
rhn-verify-channel-family not used anywhere, removing, as well as verify_channel_family.
diff --git a/web/modules/sniglets/Sniglets/ChannelEditor.pm b/web/modules/sniglets/Sniglets/ChannelEditor.pm
index 922751d..a4c4937 100644
--- a/web/modules/sniglets/Sniglets/ChannelEditor.pm
+++ b/web/modules/sniglets/Sniglets/ChannelEditor.pm
@@ -32,7 +32,6 @@ sub register_tags {
my $pxt = shift;
$pxt->register_tag('rhn-channel-edit-form' => \&channel_edit_form);
- $pxt->register_tag('rhn-verify-channel-family' => \&verify_channel_family);
$pxt->register_tag('rhn-channel-select-options' => \&channel_select_options);
$pxt->register_tag('rhn-if-package-list-modified' => \&if_package_list_modified);
$pxt->register_tag('rhn-if-packages-deleted-from-channels' => \&if_packages_deleted_from_channels);
@@ -676,21 +675,6 @@ sub channel_edit_form {
return $block;
}
-#ensure that the org that the logged-in use represents has a channelfamily,
-#and has permission to access that channelfamily.
-sub verify_channel_family {
-
- my $pxt = shift;
-
- my $org = $pxt->user->org or return;
-
- RHN::ChannelEditor->verify_org_family($org);
- RHN::ChannelEditor->verify_family_permissions($org);
-
- return;
-
-}
-
#output a list of channels to select packages from, including 'no channels', and 'any channel'
sub channel_select_options {
my $pxt = shift;
commit 04fdaeea5707378a4317dc60c7dd63a1fcc2b74e
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 15:02:52 2009 +0100
Package Sniglets::ProbeReport is not used anywhere, removing as dead code.
diff --git a/web/modules/sniglets/Sniglets/ProbeReport.pm b/web/modules/sniglets/Sniglets/ProbeReport.pm
deleted file mode 100644
index af8ebba..0000000
--- a/web/modules/sniglets/Sniglets/ProbeReport.pm
+++ /dev/null
@@ -1,586 +0,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-use strict;
-
-package Sniglets::ProbeReport;
-
-use Data::Dumper;
-use URI::Escape;
-
-use RHN::DataSource;
-use RHN::Date;
-use RHN::SCDB;
-use RHN::TSDB;
-
-use Moon::Chart;
-use Moon::Dataset::Coordinate;
-use Moon::Dataset::Function;
-use Moon::Chart::TimeAxes;
-
-use Sniglets::ServerActions;
-
-use PXT::HTML;
-use PXT::Handlers;
-
-
-my $MAX_DISPLAY_ROWS = 100; # Max # of event logs rows to display
-
-
-###################
-sub register_tags {
-###################
- my $class = shift;
- my $pxt = shift;
-
- $pxt->register_tag('rhn-probe-current-state', \&probe_current_state);
- $pxt->register_tag('rhn-probe-report-setup', \&report_setup);
- $pxt->register_tag('rhn-probe-metrics-multiple', \&probe_metrics_multiple);
- $pxt->register_tag('rhn-probe-report', \&probe_report);
- $pxt->register_tag('rhn-probe-tsdb-graph', \&tsdb_graph);
-}
-
-
-
-########################
-sub register_callbacks {
-########################
- my $class = shift;
- my $pxt = shift;
-
-}
-
-
-
-#########################
-sub probe_current_state {
-#########################
- my $pxt = shift;
- my %params = @_;
- my $block = $params{__block__};
- my $probe_id = $pxt->param('probe_id');
- my($html, $data);
-
-
- # Collect probe data from the database (REQUIRED)
- $data = RHN::DataSource::Simple->new(
- -querybase => 'probe_queries',
- -mode => 'probe',
- )->execute_full(-probe_id => $probe_id);
-
- my $probe = $data->[0];
-
- die("ERROR: No probe record for probe $probe_id!") unless ($probe);
-
- # Collect probe state data from the database (OPTIONAL)
- $data = RHN::DataSource::Simple->new(
- -querybase => 'probe_queries',
- -mode => 'probe_state',
- )->execute_full(-probe_id => $probe_id);
-
- my $pstate = $data->[0];
-
- unless ($pstate) {
- $pstate = {
- STATE => 'PENDING',
- OUTPUT => '(No probe state)',
- LAST_CHECK => '',
- };
- }
-
- if ($pstate->{'LAST_CHECK'}) {
- my $timestamp = new RHN::Date(-string => $pstate->{'LAST_CHECK'}, user => $pxt->user);
- my $css_class = '';
-
- if ($pstate->{'STATE'} eq 'CRITICAL') {
- $css_class = 'class="probe-status-critical"';
- }
- elsif ($pstate->{'STATE'} eq 'UNKNOWN') {
- $css_class = 'class="probe-status-unknown"';
- }
-
- # Display the probe state
- $html .= "<table class=\"details\">\n";
-
- $html .= "<tr>\n";
- $html .= "<th>Probe:</th>\n";
- $html .= "<td>" . $probe->{'DESCRIPTION'} . "</td>\n";
- $html .= "</tr>\n";
-
- $html .= "<tr>\n";
- $html .= "<th>Status:</th>\n";
- $html .= sprintf("<td $css_class>%s - %s</td>\n", $pstate->{'STATE'},
- $pstate->{'OUTPUT'});
- $html .= "</tr>\n";
-
- $html .= "<tr>\n";
- $html .= "<th>Last check:</th>\n";
- $html .= "<td>" . $timestamp->long_date_with_zone($pxt->user) . "</td>\n";
- $html .= "</tr>\n";
-
- $html .= "</table>\n";
-
- }
- else {
- $html .= "<table class=\"details\">\n";
-
- $html .= "<tr>\n";
- $html .= "<th>NO CURRENT STATE FOUND</th>\n";
- $html .= "</tr>\n";
- $html .= "</table>\n";
-
- }
-
- return $html;
-}
-
-
-
-##################
-sub report_setup {
-##################
- my $pxt = shift;
- my %params = @_;
- my $block = $params{__block__};
- my $probe_id = $pxt->param('probe_id');
- my $submitted = $pxt->dirty_param('doit');
- my $html = '';
-
- # Create the various widgets
- my $start_widget = &Sniglets::ServerActions::date_pickbox($pxt,
- preserve => 1,
- prefix => 'start_',
- years => '0,-1,-2',
- );
-
- my $end_widget = &Sniglets::ServerActions::date_pickbox($pxt,
- preserve => 1,
- prefix => 'end_',
- years => '0,-1,-2',
- );
-
- # This will be undef if there are no metrics
- my $metrics_widget = &probe_metrics_multiple($pxt);
-
- my $graph_checked = $submitted ? $pxt->dirty_param('show_graph') : 1;
- my $graph_checkbox = PXT::HTML->checkbox(
- -checked => $graph_checked,
- -name => 'show_graph',
- );
-
- my $log_checked = $submitted ? $pxt->dirty_param('show_events') : 1;
- my $log_checkbox = PXT::HTML->checkbox(
- -checked => $log_checked,
- -name => 'show_events',
- );
-
- my $submit = PXT::HTML->submit(
- -name => "doit",
- -value => "Generate report",
- ) . "\n";
-
- my $old_min_y = $pxt->dirty_param('min_y');
- my $min_y_widget = PXT::HTML->text(
- -name => "min_y",
- -size => 5,
- -value => $old_min_y,
- ) . "\n";
-
- my $old_max_y = $pxt->dirty_param('max_y');
- my $max_y_widget = PXT::HTML->text(
- -name => "max_y",
- -size => 5,
- -value => $old_max_y,
- ) . "\n";
-
-
- # Display the probe report setup area
- $html .= "<table class=\"details\">\n";
-
- $html .= "<tr>\n";
- $html .= "<th>Start date:</th>\n";
- $html .= "<td>$start_widget</td>\n";
-
- $html .= "<td> </td>\n";
-
- if ($metrics_widget) {
- $html .= "<th rowspan='2'>Metrics:</th>\n";
- $html .= "<td rowspan='2'>$metrics_widget</td>\n";
- }
-
- $html .= "</tr>\n";
-
- $html .= "<tr>\n";
- $html .= "<th>End date:</th>\n";
- $html .= "<td>$end_widget</td>\n";
- $html .= "</tr>\n";
-
-
- if ($metrics_widget) {
- $html .= "<tr>\n";
- $html .= "<th>Show graph:</th>\n";
- $html .= "<td>$graph_checkbox</td>\n";
-
- if ($pxt->dirty_param('show_graph')) {
- $html .= "<td> </td>\n";
- $html .= "<th>Minimum Y value</th>\n";
- $html .= "<td>$min_y_widget</td>\n";
- }
- $html .= "</tr>\n";
- }
-
- $html .= "<tr>\n";
- $html .= "<th>Show event log:</th>\n";
- $html .= "<td>$log_checkbox</td>\n";
-
- if ($metrics_widget) {
- if ($pxt->dirty_param('show_graph')) {
- $html .= "<td> </td>\n";
- $html .= "<th>Maximum Y value</th>\n";
- $html .= "<td>$max_y_widget</td>\n";
- }
- }
-
- $html .= "</tr>\n";
-
-
-
- $html .= "<tr>\n";
- $html .= "<td>$submit</td>\n";
- $html .= "</tr>\n";
-
- $html .= "</table>\n";
-
- $html .= &PXT::Handlers::pxt_hidden_handler($pxt, name => "sid") . "\n";
- $html .= &PXT::Handlers::pxt_hidden_handler($pxt, name => "probe_id") . "\n";
-
-
- $html = &PXT::Handlers::pxt_form_handler($pxt,
- __block__ => $html,
- method => 'post',
- );
-
-
- return $html;
-}
-
-
-
-############################
-sub probe_metrics_multiple {
-############################
- my $pxt = shift;
- my %params = @_;
- my $block = $params{__block__};
- my $probe_id = $pxt->param('probe_id');
- my($html, %data);
-
- my @submitted_metrics = $pxt->dirty_param('metrics');
- my %checked; @checked{@submitted_metrics} = (1) x @submitted_metrics;
-
- # Collect probe data from the database
- my $data = RHN::DataSource::Simple->new(
- -querybase => 'probe_queries',
- -mode => 'probe_metrics',
- )->execute_full(-probe_id => $probe_id);
-
- my @metrics;
- foreach my $metric (@$data) {
- push(@metrics, [
- $metric->{'LABEL'},
- $metric->{'METRIC_ID'},
- $checked{$metric->{'METRIC_ID'}},
- ]
- );
- }
-
- if (@metrics) {
-
- return PXT::HTML->select(
- -name => 'metrics',
- -size => 3,
- -multiple => 1,
- -options => \@metrics,
- );
-
- } else {
-
- return undef;
-
- }
-
-}
-
-
-
-##################
-sub probe_report {
-##################
- my $pxt = shift;
- my %params = @_;
- my $org_id = $pxt->user->org_id;
- my $probe_id = $pxt->param('probe_id');
- my $sid = $pxt->param('sid');
- my $min_y = $pxt->dirty_param('min_y');
- my $max_y = $pxt->dirty_param('max_y');
- my $html;
-
- return $html unless ($pxt->dirty_param('doit'));
-
- my $show_graph = $pxt->dirty_param('show_graph');
- my $show_events = $pxt->dirty_param('show_events');
-
- if ($show_events or $show_graph) {
- my $start_date = Sniglets::ServerActions->parse_date_pickbox($pxt,
- prefix => 'start_',
- long_date => 0,
- );
- my $end_date = Sniglets::ServerActions->parse_date_pickbox($pxt,
- prefix => 'end_',
- long_date => 0,
- );
-
- if (not $start_date or not $end_date) {
-
- $pxt->push_message(local_alert => 'Please pick a valid start date.') unless ($start_date);
- $pxt->push_message(local_alert => 'Please pick a valid end date.') unless ($end_date);
-
- } elsif ($start_date >= $end_date) {
-
- $pxt->push_message(local_alert => 'Please select a start date earlier than the end date.');
-
- } else {
-
- if ($show_graph) {
- my @metrics = $pxt->dirty_param('metrics');
- if (@metrics) {
- $html .= &graph_url(
- sid => $sid,
- org_id => $org_id,
- probe_id => $probe_id,
- start => $start_date,
- end => $end_date,
- min_y => $min_y,
- max_y => $max_y,
- metrics => \@metrics,
- ) . "\n";
- } else {
- $pxt->push_message(local_alert => 'Please select one or more metrics to graph.');
- }
- }
-
- if ($show_events) {
- $html .= &event_log(
- pxt => $pxt,
- probe_id => $probe_id,
- start => $start_date,
- end => $end_date,
- );
- }
-
- }
-
-
- } else {
- $html .= "You probably want to select at least one of 'Show graph' ";
- $html .= "or 'Show event log'.";
- }
-
-
-
- return $html;
-}
-
-
-###############
-sub event_log {
-###############
- my %params = @_;
- my $pxt = $params{'pxt'};
- my $html = "<h2>Event log</h2>\n";
-
- my $results = RHN::SCDB->new()->fetch(
- probe_id => $params{'probe_id'},
- start => $params{'start'},
- end => $params{'end'},
- );
-
- if (@$results) {
-
- $html .= "<table class='list' width='96%' align='center'>\n";
- $html .= "<tr>\n";
- $html .= "<th>Timestamp</th>\n";
- $html .= "<th>State</th>\n";
- $html .= "<th>Message</th>\n";
- $html .= "</tr>\n";
-
- for (my $i = 1; $i <= @$results; $i++) {
-
- my $rowstyle = ($i % 2 == 0) ? 'list-row-even' : 'list-row-odd';
-
- if ($i > $MAX_DISPLAY_ROWS) {
- my $left = @$results - $i + 1;
- $html .= "<tr class='$rowstyle'>\n";
- $html .= "<td nowrap='1' colspan='3'>\n";
- $html .= "(... $MAX_DISPLAY_ROWS entries displayed, ";
- $html .= "$left remaining entries not displayed)\n";
- $html .= "</td>\n";
- $html .= "</tr>\n";
- last;
- }
-
- my($time, $state, $escaped) = @{$results->[-$i]};
- my $msg = &uri_unescape($escaped);
- my $timestamp = new RHN::Date(-epoch => $time, user => $pxt->user);
-
- $html .= "<tr class='$rowstyle'>\n";
- $html .= "<td nowrap='1'>" . $timestamp->long_date_with_zone($pxt->user) . "</td>\n";
- $html .= "<td align='center'>$state</td>\n";
- $html .= "<td>$msg</td>\n";
- $html .= "</tr>\n";
-
- }
- $html .= "</table>\n";
-
- } else {
-
- $html .= "No events this period\n";
-
- }
-
- return $html;
-
-}
-
-###############
-sub graph_url {
-###############
- my %p = @_;
- my $metrics = delete($p{'metrics'});
- my $html = "<h2>Time series</h2>\n";
-
- my @params;
- foreach my $key (keys %p) {
- push(@params, "$key=$p{$key}");
- }
-
- foreach my $metric (@$metrics) {
- my $params = join('&', @params, "metric=$metric");
- my $src = "graph.pxt?$params";
- $html .= PXT::HTML->img(-src => $src);
- }
-
- return '<div style="text-align: center">' . $html . '</div>';
-}
-
-
-# Generate a time series graph
-################
-sub tsdb_graph {
-################
- my $pxt = shift;
- my $org_id = $pxt->user->org_id;
- my $probe_id = $pxt->param('probe_id');
- my $metric_id = $pxt->dirty_param('metric');
- my $min_y = $pxt->dirty_param('min_y');
- my $max_y = $pxt->dirty_param('max_y');
-
- # Fetch the dataset from the TSDB
- my $tsdata = RHN::TSDB->new()->fetch(
- org_id => $org_id,
- probe_id => $probe_id,
- metric => $metric_id,
- start => $pxt->dirty_param('start') - 600,
- end => $pxt->dirty_param('end') + 600,
- );
-
- # Fetch metric labels and units
- my $data = RHN::DataSource::Simple->new(
- -querybase => 'probe_queries',
- -mode => 'probe_metric',
- )->execute_full(
- -probe_id => $probe_id,
- -metric_id => $metric_id,
- );
-
-
- my $metric = $data->[0];
- die ("ERROR: No metric '$metric_id' for probe $probe_id") unless ($metric);
-
- my $sd = Moon::Dataset::Coordinate->new(
- -coords => $tsdata,
- -label => $metric->{'LABEL'},
- );
-
- my $no_data_image;
-
- if (@$tsdata) {
- $max_y = $sd->max_y unless (length($max_y));
- $min_y = $sd->min_y unless (length($min_y));
- } else {
- # No data, show prefab image w/ informative text
- $no_data_image = '/var/www/html/img/rhn-no-ts-data.png';
- }
-
- if (abs($max_y - $min_y) < 0.02 * $max_y) {
- $max_y = 2 * $max_y;
- $min_y = 0;
- }
-
-
- my $chart = new Moon::Chart(800, 250);
-
- $chart->add_dataset($sd->label, $sd);
-
- $chart->graph_stencil_min(0.05, 0.2);
-
- $chart->graph_stencil_max(0.97, 0.95);
-
- my $axes = new Moon::Chart::TimeAxes(undef, undef, undef, $pxt->user);
-
- $axes->set_bounds(
- [$pxt->dirty_param('start'), $min_y ],
- [$pxt->dirty_param('end') , $max_y * 1.01]
- );
-
- $chart->set_axes($axes);
-
- my $imgfile;
- if ($no_data_image) {
- $imgfile = $no_data_image;
- }
- else {
- $imgfile = "/tmp/mychart.$$.png";
- $chart->render_to_file($imgfile);
- }
-
- # Send that puppy
- $pxt->manual_content(1);
- $pxt->no_cache(1);
- $pxt->content_type('image/png');
- $pxt->header_out('Content-length' => -s $imgfile);
- $pxt->send_http_header;
-
- open(FILE, $imgfile) or die "Couldn't open $imgfile: $!";
- $pxt->send_fd(*FILE);
- close(FILE);
-
- unlink($imgfile) if not $no_data_image;
-
-
-}
-
-
-1;
14 years, 4 months
6 commits - web/modules
by Jan Pazdziora
web/modules/sniglets/Sniglets/Org.pm | 17 ---
web/modules/sniglets/Sniglets/Search.pm | 157 --------------------------------
2 files changed, 174 deletions(-)
New commits:
commit 29f639b5af0f992fba52be6428e6cedab2b5319c
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 15:00:58 2009 +0100
rhn-if-searched not used anywhere, removing, as well as if_searched.
diff --git a/web/modules/sniglets/Sniglets/Search.pm b/web/modules/sniglets/Sniglets/Search.pm
index e05e82e..f56cc71 100644
--- a/web/modules/sniglets/Sniglets/Search.pm
+++ b/web/modules/sniglets/Sniglets/Search.pm
@@ -28,7 +28,6 @@ sub register_tags {
my $class = shift;
my $pxt = shift;
- $pxt->register_tag('rhn-if-searched' => \&if_searched, -10);
}
sub register_callbacks {
@@ -42,23 +41,6 @@ sub register_callbacks {
$pxt->register_callback('rhn:bar_search_cb' => \&bar_search_cb);
}
-sub if_searched {
- my $pxt = shift;
- my %params = @_;
- my $block = $params{__block__};
-
- if ($pxt->pnotes('searched')) {
- PXT::Debug->log(7, "searched...");
- return $block;
- }
- elsif ($pxt->dirty_param('search_string')) {
- return $block;
- }
-
- PXT::Debug->log(7, "not searched");
- return;
-}
-
sub validate_search_string {
my $class = shift;
my $pxt = shift;
commit cd1234c68bf84c84f4dd8872e1a60f7d2ea432b5
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 15:00:07 2009 +0100
rhn-system-search-form not used anywhere, removing, as well as system_search_form.
diff --git a/web/modules/sniglets/Sniglets/Search.pm b/web/modules/sniglets/Sniglets/Search.pm
index 1f7c031..e05e82e 100644
--- a/web/modules/sniglets/Sniglets/Search.pm
+++ b/web/modules/sniglets/Sniglets/Search.pm
@@ -28,8 +28,6 @@ sub register_tags {
my $class = shift;
my $pxt = shift;
- $pxt->register_tag('rhn-system-search-form' => \&system_search_form);
-
$pxt->register_tag('rhn-if-searched' => \&if_searched, -10);
}
@@ -194,40 +192,6 @@ RHN::SearchTypes->register_type('system', $system_searches);
my @integer_types = qw/search_id search_cpu_mhz_lt search_cpu_mhz_gt search_ram_lt search_ram_gt search_checkin search_registered/;
-sub system_search_form {
- my $pxt = shift;
- my %params = @_;
-
- my $block = $params{__block__};
- my $search_string = $pxt->dirty_param('search_string') || '';
- my $search_set = $pxt->dirty_param('search_set') || 'all';
- my $view_mode = $pxt->dirty_param('view_mode') || 'search_simple';
- my $invert = $pxt->dirty_param('invert') || '';
-
- my $search = RHN::SearchTypes->find_type('system');
-
- my $search_select = $search->render_search_selectbox(pxt => $pxt, search_type => $view_mode);
-
- $search_string = Sniglets::Search->strip_invalid_chars($search_string, $view_mode);
-
- my %subst;
-
- $subst{all_checked} = $search_set eq 'all' ? '1' : '';
- $subst{system_list_checked} = $search_set eq 'system_list' ? '1' : '';
-
- $subst{search_string} = PXT::Utils->escapeHTML($search_string);
- $subst{invert_checked} = $invert ? ' checked="1"' : '';
-
- $subst{search_options} = $search_select;
-
- my $return_block;
- $return_block .= PXT::HTML->form_start(-method => "POST");
- $return_block .= PXT::Utils->perform_substitutions($params{__block__}, \%subst);
- $return_block .= PXT::HTML->form_end;
-
- return $return_block;
-}
-
sub system_search_handler {
my $pxt = shift;
commit cd64eea628367623ab31628df9470a3ebd948e3f
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:59:12 2009 +0100
rhn-package-search-form not used anywhere, removing, as well as package_search_form.
diff --git a/web/modules/sniglets/Sniglets/Search.pm b/web/modules/sniglets/Sniglets/Search.pm
index 7abd1b5..1f7c031 100644
--- a/web/modules/sniglets/Sniglets/Search.pm
+++ b/web/modules/sniglets/Sniglets/Search.pm
@@ -28,7 +28,6 @@ sub register_tags {
my $class = shift;
my $pxt = shift;
- $pxt->register_tag('rhn-package-search-form' => \&package_search_form);
$pxt->register_tag('rhn-system-search-form' => \&system_search_form);
$pxt->register_tag('rhn-if-searched' => \&if_searched, -10);
@@ -291,54 +290,6 @@ $package_searches->set_name('package_search');
RHN::SearchTypes->register_type('package', $package_searches);
-sub package_search_form {
- my $pxt = shift;
- my %params = @_;
-
- my $search = RHN::SearchTypes->find_type('package');
- my $search_select = $search->render_search_selectbox(pxt => $pxt);
-
- my $search_arches;
-
- # sigh, this is lame, but almost nothing in the ListView area
- # understands multivalued formvars, so...
- my %arches;
- $arches{$_} = $pxt->dirty_param($_)
- for qw/channel_arch_ia32 channel_arch_ia64 channel_arch_x86_64/;
- my $no_selected_arched;
- $no_selected_arched = 1
- unless grep { defined $arches{$_} } qw/channel_arch_ia32 channel_arch_ia64 channel_arch_x86_64/;
-
-
- for my $arch (Sniglets::Packages->search_arch_list) {
- my ($label, $name) = @$arch;
-
- $search_arches .= PXT::HTML->checkbox(-name => "channel_arch_$label",
- -value => "channel-$label",
- -checked => $arches{"channel_arch_$label"} ? 1 : 0);
- $search_arches .= "$name ";
- }
-
- my $search_smart_channels;
- $search_smart_channels = PXT::HTML->checkbox(-name => 'search_subscribed_channels',
- -value => 1,
- -checked => ($pxt->dirty_param('search_subscribed_channels') || $no_selected_arched || 0));
- $search_smart_channels .= "Channels relevant to your systems";
-
- my $return_block = '';
- $return_block .= PXT::HTML->form_start(-method => "POST");
- $return_block .= PXT::Utils->perform_substitutions($params{__block__},
- { 'search_options' => $search_select,
- 'search_string' => PXT::Utils->escapeHTML($pxt->dirty_param('search_string') || ''),
- 'search_arches' => $search_arches,
- 'search_smart_channels' => $search_smart_channels,
- }
- );
- $return_block .= PXT::HTML->form_end;
-
- return $return_block;
-}
-
sub package_search_handler {
my $pxt = shift;
commit 67e71d607bbf9f1db471e2d89088e08d864694fb
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:58:23 2009 +0100
rhn-errata-search-form not used anywhere, removing, as well as errata_search_form.
diff --git a/web/modules/sniglets/Sniglets/Search.pm b/web/modules/sniglets/Sniglets/Search.pm
index 90bb323..7abd1b5 100644
--- a/web/modules/sniglets/Sniglets/Search.pm
+++ b/web/modules/sniglets/Sniglets/Search.pm
@@ -28,7 +28,6 @@ sub register_tags {
my $class = shift;
my $pxt = shift;
- $pxt->register_tag('rhn-errata-search-form' => \&errata_search_form);
$pxt->register_tag('rhn-package-search-form' => \&package_search_form);
$pxt->register_tag('rhn-system-search-form' => \&system_search_form);
@@ -266,24 +265,6 @@ $errata_searches->set_name('errata_search');
RHN::SearchTypes->register_type('errata', $errata_searches);
-sub errata_search_form {
- my $pxt = shift;
- my %params = @_;
-
- my $search = RHN::SearchTypes->find_type('errata');
- my $search_select = $search->render_search_selectbox(pxt => $pxt);
-
- my $return_block = '';
- $return_block .= PXT::HTML->form_start(-method => "POST");
- $return_block .= PXT::Utils->perform_substitutions($params{__block__},
- { 'search_options' => $search_select,
- 'search_string' => PXT::Utils->escapeHTML($pxt->dirty_param('search_string') || '') }
- );
- $return_block .= PXT::HTML->form_end;
-
- return $return_block;
-}
-
sub errata_search_handler {
my $pxt = shift;
commit f866fa21c084823bc7facf3605eb2ed290a11d94
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:56:13 2009 +0100
rhn-search-bar not used anywhere, removing, as well as search_bar.
diff --git a/web/modules/sniglets/Sniglets/Search.pm b/web/modules/sniglets/Sniglets/Search.pm
index 1eb01cd..90bb323 100644
--- a/web/modules/sniglets/Sniglets/Search.pm
+++ b/web/modules/sniglets/Sniglets/Search.pm
@@ -28,8 +28,6 @@ sub register_tags {
my $class = shift;
my $pxt = shift;
- $pxt->register_tag('rhn-search-bar' => \&search_bar);
-
$pxt->register_tag('rhn-errata-search-form' => \&errata_search_form);
$pxt->register_tag('rhn-package-search-form' => \&package_search_form);
$pxt->register_tag('rhn-system-search-form' => \&system_search_form);
@@ -394,39 +392,6 @@ sub package_search_handler {
}
}
-# search bar. default to your last search, or systems if you're
-# logged in, or package if you're not. whew.
-sub search_bar {
- my $pxt = shift;
-
- my $default_search = $pxt->session->get('last_search_type');
-
- my @options;
- if ($pxt->user and $pxt->user->org->has_entitlement('sw_mgr_enterprise')) {
- push @options, [ 'Systems', 'systems', 0 ];
- $default_search ||= 'systems';
- }
- $default_search ||= 'packages';
-
- push @options, [ 'Packages', 'packages', 0 ];
- push @options, [ 'Errata', 'errata', 0 ];
-
- for my $option (@options) {
- $option->[2]++ if $option->[1] eq $default_search;
- }
-
- my $ret = '';
- $ret .= PXT::HTML->form_start(-method => 'GET', -action => "/rhn/Search.do");
- $ret .= PXT::HTML->select(-name => 'search_type',
- -options => \@options);
- $ret .= PXT::HTML->text(-name => 'search_string', -length => 40, -size => 20);
- $ret .= PXT::HTML->hidden(-name => 'submitted', -value => 'true');
- $ret .= PXT::HTML->submit_image(-src => '/img/button-search.gif', -border => 0, -align => "top");
- $ret .= PXT::HTML->form_end;
-
- return $ret;
-}
-
sub bar_search_cb {
my $pxt = shift;
commit fc9509f97725a88e37c538ccdc6e46ad6e6a2aee
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:54:22 2009 +0100
rhn-org-entitlement-name not used anywhere, removing, as well as org_entitlement_name.
diff --git a/web/modules/sniglets/Sniglets/Org.pm b/web/modules/sniglets/Sniglets/Org.pm
index ceae42a..98bffa0 100644
--- a/web/modules/sniglets/Sniglets/Org.pm
+++ b/web/modules/sniglets/Sniglets/Org.pm
@@ -29,7 +29,6 @@ sub register_tags {
my $class = shift;
my $pxt = shift;
- $pxt->register_tag('rhn-org-entitlement-name' => \&org_entitlement_name, -5);
}
sub register_callbacks {
@@ -49,22 +48,6 @@ sub reset_form {
reset_and_commit_set($pxt->user->id, 'new_cert_service_set');
}
-sub org_entitlement_name {
- my $pxt = shift;
- my %attr = @_;
-
- my $slot = $attr{type};
-
- throw "No type in call to org_entitlement_name"
- unless $slot;
-
- my $block = $attr{__block__} || '{entitlement}';
-
- $block = PXT::Utils->perform_substitutions($block, { entitlement => $pxt->user->org->slot_name($slot) });
-
- return $block;
-}
-
sub reset_and_commit_set {
my $uid = shift;
my $label = shift;
14 years, 4 months
2 commits - web/modules
by Jan Pazdziora
web/modules/sniglets/Sniglets/Org.pm | 110 -----------------------------------
1 file changed, 110 deletions(-)
New commits:
commit 8e9a7405b366e8626e65f01435cede609cb7548f
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:52:42 2009 +0100
Previous removals made download_cert and create_cert_text unused, removing as dead code.
diff --git a/web/modules/sniglets/Sniglets/Org.pm b/web/modules/sniglets/Sniglets/Org.pm
index 6c7995b..ceae42a 100644
--- a/web/modules/sniglets/Sniglets/Org.pm
+++ b/web/modules/sniglets/Sniglets/Org.pm
@@ -106,66 +106,6 @@ sub get_service_map {
}
-# create the actual cert xml given the cert_info session data
-sub create_cert_text {
- my $pxt = shift;
- my $data = shift;
- my %cert_info = %{$data};
-
- my $cert = new RHN::SatelliteCert;
-
- my $owner = $cert_info{meta_info}->{owner};
- my $issued = $cert_info{meta_info}->{issued};
- my $expires = $cert_info{meta_info}->{expires};
-
- $cert->set_field(product => "RHN-SATELLITE-001");
- $cert->set_field(owner => $owner);
- $cert->set_field(issued => $issued);
- $cert->set_field(expires => $expires);
- $cert->set_field('generation', RHN::SatelliteCert->current_generation());
-
- my $existing_channels = get_channel_family_map($pxt->user->id, 'new_cert_channel_set');
- foreach my $label (sort keys %{$existing_channels}) {
- my $quant = $existing_channels->{$label}->{QUANT};
- if ($quant > 0) {
- $cert->set_channel_family($label, $quant);
- }
- }
-
- my $additional_channels = get_channel_family_map($pxt->user->id, 'new_cert_add_channel_set');
- foreach my $label (sort keys %{$additional_channels}) {
- my $quant = $additional_channels->{$label}->{QUANT};
- if ($quant > 0) {
- $cert->set_channel_family($label, $quant);
- }
- }
-
- my %slot_names = (
- 'enterprise_entitled' => 'slots',
- 'provisioning_entitled' => 'provisioning-slots',
- 'nonlinux_entitled' => 'nonlinux-slots',
- 'monitoring_entitled' => 'monitoring-slots');
-
-
- my $services = get_service_map($pxt->user->id);
- foreach my $label (sort keys %{$services}) {
- my $quant = $services->{$label}->{QUANT};
- # logic per bz #132461 and bz #164662
- if ($label eq 'enterprise_entitled' and $cert_info{'meta_info'}->{'version'} < 4.0) {
- $quant += $services->{'provisioning_entitled'}->{QUANT};
- }
- if ($quant > 0) {
- my $slot_name = $slot_names{$label};
- $cert->set_field($slot_name => $quant);
- }
- }
-
- $cert->set_field("satellite-version" => $cert_info{'meta_info'}->{'version'});
-
- return $cert->to_string();
-}
-
-
sub cert_text_cb {
my $pxt = shift;
@@ -187,23 +127,4 @@ sub cert_text_cb {
}
}
-sub download_cert {
- my $pxt = shift;
- my $data = shift;
- my %cert_info = %{$data};
-
- $pxt->manual_content(1);
- $pxt->content_type('application/octet-stream');
-
- my $filename = $cert_info{'meta_info'}->{'owner'} . ".cert";
- $filename =~s/ /-/g;
- $filename = lc($filename);
-
- $pxt->header_out('Content-disposition', "attachment; filename=" . $filename);
-
- # better mime type to force download of plain text?
- $pxt->send_http_header;
- $pxt->print (create_cert_text($pxt, \%cert_info));
-}
-
1;
commit a6426a7c7afa10de4dc212f4a67711da9cff64d2
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:47:39 2009 +0100
rhn-cert-text not used anywhere, removing, as well as cert_text.
diff --git a/web/modules/sniglets/Sniglets/Org.pm b/web/modules/sniglets/Sniglets/Org.pm
index 1570c78..6c7995b 100644
--- a/web/modules/sniglets/Sniglets/Org.pm
+++ b/web/modules/sniglets/Sniglets/Org.pm
@@ -29,7 +29,6 @@ sub register_tags {
my $class = shift;
my $pxt = shift;
- $pxt->register_tag('rhn-cert-text' => \&cert_text);
$pxt->register_tag('rhn-org-entitlement-name' => \&org_entitlement_name, -5);
}
@@ -107,36 +106,6 @@ sub get_service_map {
}
-# render the page that lets user view cert data
-sub cert_text {
- my $pxt = shift;
- my %params = @_;
- my $block = $params{__block__};
-
- my $support_org_id = $pxt->param('support_org_id');
- my $data = $pxt->session->get('new_cert_info');
- my %cert_info;
- if ($data and $data->{'meta_info'}->{'support_org_id'} eq $support_org_id) {
- %cert_info = %{$data};
- }
- else {
- reset_form($pxt);
- croak "No cert data!";
- }
-
- my %subs;
- $subs{support_org_id} = $support_org_id;
-
- # do the opening and meta info
- my $cert_text = create_cert_text($pxt, \%cert_info);
-
- $cert_text=~s/>/>/g;
- $cert_text=~s/</</g;
- $subs{cert_text} = $cert_text;
- $block = PXT::Utils->perform_substitutions($block, \%subs);
- return $block;
-}
-
# create the actual cert xml given the cert_info session data
sub create_cert_text {
my $pxt = shift;
14 years, 4 months