Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make inter-server-sync to export/import dates in UTC (bsc#1221505) #9681

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/spacewalk/common/suseLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def channelForProduct(product, parent_id=None, org_id=None, user_id=None):
c.name,
c.summary,
c.description,
to_char(c.last_modified, 'YYYYMMDDHH24MISS') last_modified,
TO_CHAR(c.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified,
-- If user_id is null, then the channel is subscribable
rhn_channel.loose_user_role_check(c.id, :user_id, 'subscribe') subscribable
FROM rhnChannel c
Expand Down
3 changes: 2 additions & 1 deletion python/spacewalk/satellite_tools/diskImportLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from spacewalk.server.importlib import supportInformationImport, suseProductsImport


# pylint: disable-next=missing-class-docstring
class Backend:
__backend = None

Expand All @@ -41,6 +42,7 @@ def get_backend(self):
return self.__backend

Backend.__backend = SQLBackend()
Backend.__backend.setSessionTimeZoneToUTC()
return Backend.__backend


Expand All @@ -66,7 +68,6 @@ def rpmsPath(obj_id, mountPoint, sources=0):

# pylint: disable=W0232
class diskImportLibContainer:

"""virtual class - redefines endContainerCallback"""

# pylint: disable=E1101,E0203,W0201
Expand Down
34 changes: 17 additions & 17 deletions python/spacewalk/satellite_tools/disk_dumper/dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def get_channels_statement(self):
"""
select c.id channel_id, c.label,
ct.label as checksum_type,
TO_CHAR(c.last_modified, 'YYYYMMDDHH24MISS') last_modified
TO_CHAR(c.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified
from rhnChannel c left outer join rhnChecksumType ct on c.checksum_type_id = ct.id,
rhnChannelFamilyMembers cfm,
(%s
Expand All @@ -140,7 +140,7 @@ def get_packages_statement(self):
# pylint: disable-next=consider-using-f-string
"""
select p.id package_id,
TO_CHAR(p.last_modified, 'YYYYMMDDHH24MISS') last_modified
TO_CHAR(p.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified
from rhnChannelPackage cp, rhnPackage p,
rhnChannelFamilyMembers cfm,
(%s
Expand All @@ -159,7 +159,7 @@ def get_source_packages_statement(self):
# pylint: disable-next=consider-using-f-string
"""
select ps.id package_id,
TO_CHAR(ps.last_modified, 'YYYYMMDDHH24MISS') last_modified
TO_CHAR(ps.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified
from rhnChannelPackage cp, rhnPackage p, rhnPackageSource ps,
rhnChannelFamilyMembers cfm,
(%s
Expand All @@ -181,7 +181,7 @@ def get_errata_statement(self):
# pylint: disable-next=consider-using-f-string
"""
select e.id errata_id,
TO_CHAR(e.last_modified, 'YYYYMMDDHH24MISS') last_modified
TO_CHAR(e.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified
from rhnChannelErrata ce, rhnErrata e,
rhnChannelFamilyMembers cfm,
(%s
Expand Down Expand Up @@ -402,7 +402,7 @@ def dump_channel_packages_short(
_query_get_channel_packages = rhnSQL.Statement(
"""
select cp.package_id,
TO_CHAR(p.last_modified, 'YYYYMMDDHH24MISS') last_modified
TO_CHAR(p.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified
from rhnChannelPackage cp,
rhnPackage p
where cp.channel_id = :channel_id
Expand Down Expand Up @@ -613,7 +613,7 @@ def _validate_channels(self, channel_labels=None):
_query_validate_kickstarts = rhnSQL.Statement(
"""
select kt.label kickstart_label,
TO_CHAR(kt.modified, 'YYYYMMDDHH24MISS') last_modified
TO_CHAR(kt.modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified
from rhnKickstartableTree kt
where kt.channel_id = :channel_id
and kt.org_id is null
Expand Down Expand Up @@ -900,7 +900,7 @@ class ChannelsDumper(exportLib.ChannelsDumper):
c.label, ca.label channel_arch, c.basedir, c.name,
c.summary, c.description, c.gpg_key_url, c.update_tag,
c.installer_updates, ct.label checksum_type,
TO_CHAR(c.last_modified, 'YYYYMMDDHH24MISS') last_modified,
TO_CHAR(c.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified,
pc.label parent_channel, c.channel_access
from rhnChannel c left outer join rhnChannel pc on c.parent_channel = pc.id
left outer join rhnChecksumType ct on c.checksum_type_id = ct.id, rhnChannelArch ca
Expand Down Expand Up @@ -953,7 +953,7 @@ class ChannelsDumperEx(CachedDumper, exportLib.ChannelsDumper):
"""
select c.id, c.label, ca.label channel_arch, c.basedir, c.name,
c.summary, c.description, c.gpg_key_url, c.installer_updates, c.update_tag, c.org_id,
TO_CHAR(c.last_modified, 'YYYYMMDDHH24MISS') last_modified,
TO_CHAR(c.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified,
c.channel_product_id,
pc.label parent_channel,
cp.product channel_product,
Expand Down Expand Up @@ -992,7 +992,7 @@ class ShortPackagesDumper(CachedDumper, exportLib.ShortPackagesDumper):
c.checksum_type,
c.checksum,
p.package_size,
TO_CHAR(p.last_modified, 'YYYYMMDDHH24MISS') as last_modified
TO_CHAR(p.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') as last_modified
from rhnPackage p, rhnPackageName pn, rhnPackageEVR pe,
rhnPackageArch pa, rhnChecksumView c
where p.id = :package_id
Expand Down Expand Up @@ -1027,7 +1027,7 @@ class PackagesDumper(CachedDumper, exportLib.PackagesDumper):
p.payload_size,
p.installed_size,
p.build_host,
TO_CHAR(p.build_time, 'YYYYMMDDHH24MISS') as build_time,
TO_CHAR(p.build_time at time zone 'UTC', 'YYYYMMDDHH24MISS') as build_time,
sr.name as source_rpm,
c.checksum_type,
c.checksum,
Expand All @@ -1039,7 +1039,7 @@ class PackagesDumper(CachedDumper, exportLib.PackagesDumper):
p.header_end,
p.copyright,
p.cookie,
TO_CHAR(p.last_modified, 'YYYYMMDDHH24MISS') as last_modified
TO_CHAR(p.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') as last_modified
from rhnPackage p, rhnPackageName pn, rhnPackageEVR pe,
rhnPackageArch pa, rhnPackageGroup pg, rhnSourceRPM sr,
rhnChecksumView c
Expand Down Expand Up @@ -1068,15 +1068,15 @@ class SourcePackagesDumper(CachedDumper, exportLib.SourcePackagesDumper):
ps.rpm_version,
ps.payload_size,
ps.build_host,
TO_CHAR(ps.build_time, 'YYYYMMDDHH24MISS') build_time,
TO_CHAR(ps.build_time at time zone 'UTC', 'YYYYMMDDHH24MISS') build_time,
sig.checksum sigchecksum,
sig.checksum_type sigchecksum_type,
ps.vendor,
ps.cookie,
ps.package_size,
c.checksum_type,
c.checksum,
TO_CHAR(ps.last_modified, 'YYYYMMDDHH24MISS') last_modified
TO_CHAR(ps.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified
from rhnPackageSource ps, rhnPackageGroup pg, rhnSourceRPM sr,
rhnChecksumView c, rhnChecksumView sig
where ps.id = :package_id
Expand Down Expand Up @@ -1108,9 +1108,9 @@ class ErrataDumper(exportLib.ErrataDumper):
e.synopsis,
e.topic,
e.solution,
TO_CHAR(e.issue_date, 'YYYYMMDDHH24MISS') issue_date,
TO_CHAR(e.update_date, 'YYYYMMDDHH24MISS') update_date,
TO_CHAR(e.last_modified, 'YYYYMMDDHH24MISS') last_modified,
TO_CHAR(e.issue_date at time zone 'UTC', 'YYYYMMDDHH24MISS') issue_date,
TO_CHAR(e.update_date at time zone 'UTC', 'YYYYMMDDHH24MISS') update_date,
TO_CHAR(e.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified,
e.refers_to,
e.notes,
e.errata_from,
Expand Down Expand Up @@ -1139,7 +1139,7 @@ class KickstartableTreesDumper(CachedDumper, exportLib.KickstartableTreesDumper)
ktt.label "kstree-type-label",
kit.name "install-type-name",
kit.label "install-type-label",
TO_CHAR(kt.last_modified, 'YYYYMMDDHH24MISS') "last-modified"
TO_CHAR(kt.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') "last-modified"
from rhnKickstartableTree kt,
rhnKSTreeType ktt,
rhnKSInstallType kit,
Expand Down
14 changes: 6 additions & 8 deletions python/spacewalk/satellite_tools/disk_dumper/iss.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def _getFile(self):


class FileMapper:

"""This class maps dumps to files. In other words, you give it
the type of dump you're doing and it gives you the file to
write it to.
Expand Down Expand Up @@ -261,7 +260,6 @@ def getClonedChannelsFile(self):


class Dumper(dumper.XML_Dumper):

"""This class subclasses the XML_Dumper class. It overrides
the _get_xml_writer method and adds a set_stream method,
which will let it write to a file instead of over the wire.
Expand Down Expand Up @@ -312,7 +310,7 @@ def __init__(
try:
query = """
select ch.id channel_id, label,
TO_CHAR(last_modified, 'YYYYMMDDHH24MISS') last_modified
TO_CHAR(last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified
from rhnChannel ch
where ch.label = :label
"""
Expand Down Expand Up @@ -481,7 +479,7 @@ def __init__(
if self.whole_errata and self.start_date:
query = """
select rp.id package_id,
TO_CHAR(rp.last_modified, 'YYYYMMDDHH24MISS') last_modified
TO_CHAR(rp.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified
from rhnChannelPackage rcp, rhnPackage rp
left join rhnErrataPackage rep on rp.id = rep.package_id
left join rhnErrata re on rep.errata_id = re.id
Expand All @@ -491,7 +489,7 @@ def __init__(
else:
query = """
select rp.id package_id,
TO_CHAR(rp.last_modified, 'YYYYMMDDHH24MISS') last_modified
TO_CHAR(rp.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified
from rhnPackage rp, rhnChannelPackage rcp
where rcp.channel_id = :channel_id
and rcp.package_id = rp.id
Expand Down Expand Up @@ -677,7 +675,7 @@ def __init__(
try:
query = """
select kt.id kstree_id, kt.label kickstart_label,
TO_CHAR(kt.last_modified, 'YYYYMMDDHH24MISS') last_modified
TO_CHAR(kt.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified
from rhnKickstartableTree kt
where kt.channel_id = :channel_id
"""
Expand Down Expand Up @@ -724,10 +722,10 @@ def __init__(
select rktf.relative_filename "relative-path",
c.checksum_type "checksum-type", c.checksum,
rktf.file_size "file-size",
TO_CHAR(rktf.last_modified, 'YYYYMMDDHH24MISS') "last-modified",
TO_CHAR(rktf.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') "last-modified",
rkt.base_path "base-path",
rkt.label "label",
TO_CHAR(rkt.modified, 'YYYYMMDDHH24MISS') "modified"
TO_CHAR(rkt.modified at time zone 'UTC', 'YYYYMMDDHH24MISS') "modified"
from rhnKSTreeFile rktf, rhnKickstartableTree rkt,
rhnChecksumView c
where rktf.kstree_id = :kstree_id
Expand Down
16 changes: 8 additions & 8 deletions python/spacewalk/satellite_tools/exporter/exportLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def _get_ids(self, query_with_limit, query_with_rhnlimit, query_no_limits):
_query_get_source_package_ids = rhnSQL.Statement(
"""
select distinct ps.id, sr.name source_rpm,
TO_CHAR(ps.last_modified, 'YYYYMMDDHH24MISS') last_modified
TO_CHAR(ps.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified
from rhnChannelPackage cp, rhnPackage p, rhnPackageSource ps,
rhnSourceRPM sr
where cp.channel_id = :channel_id
Expand All @@ -576,7 +576,7 @@ def _get_cursor_source_packages(self):
_query__get_errata_ids = rhnSQL.Statement(
"""
select ce.errata_id as id, e.advisory_name,
TO_CHAR(e.last_modified, 'YYYYMMDDHH24MISS') last_modified
TO_CHAR(e.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') last_modified
from rhnChannelErrata ce, rhnErrata e
where ce.channel_id = :channel_id
and ce.errata_id = e.id
Expand Down Expand Up @@ -680,7 +680,7 @@ def _get_channel_product_details(self):

_query_channel_comps_last_modified = rhnSQL.Statement(
"""
select to_char(last_modified, 'YYYYMMDDHH24MISS') as comps_last_modified
select TO_CHAR(last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') as comps_last_modified
from rhnChannelComps
where channel_id = :channel_id
and comps_type_id = 1
Expand All @@ -696,7 +696,7 @@ def _channel_comps_last_modified(self):

_query_channel_modules_last_modified = rhnSQL.Statement(
"""
select to_char(last_modified, 'YYYYMMDDHH24MISS') as modules_last_modified
select TO_CHAR(last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') as modules_last_modified
from rhnChannelComps
where channel_id = :channel_id
and comps_type_id = 2
Expand Down Expand Up @@ -1300,7 +1300,7 @@ def set_iterator(self):
"""
select
name, text,
TO_CHAR(time, 'YYYYMMDDHH24MISS') as time
TO_CHAR(time at time zone 'UTC', 'YYYYMMDDHH24MISS') as time
from rhnPackageChangeLog
where package_id = :package_id
"""
Expand Down Expand Up @@ -1384,7 +1384,7 @@ def set_iterator(self):
select
pc.name, pf.device, pf.inode, pf.file_mode, pf.username,
pf.groupname, pf.rdev, pf.file_size,
TO_CHAR(mtime, 'YYYYMMDDHH24MISS') mtime,
TO_CHAR(mtime at time zone 'UTC', 'YYYYMMDDHH24MISS') mtime,
c.checksum_type as "checksum-type",
c.checksum, pf.linkto, pf.flags, pf.verifyflags, pf.lang
from rhnPackageFile pf
Expand Down Expand Up @@ -2200,7 +2200,7 @@ def set_iterator(self):
c.checksum_type,
c.checksum,
file_size,
TO_CHAR(last_modified, 'YYYYMMDDHH24MISS') "last-modified"
TO_CHAR(last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') "last-modified"
from rhnKSTreeFile, rhnChecksumView c
where kstree_id = :kstree_id
and checksum_id = c.id
Expand All @@ -2224,7 +2224,7 @@ class KickstartableTreesDumper(BaseSubelementDumper, BaseQueryDumper):
ktt.label "kstree-type-label",
kit.name "install-type-name",
kit.label "install-type-label",
TO_CHAR(kt.last_modified, 'YYYYMMDDHH24MISS') "last-modified"
TO_CHAR(kt.last_modified at time zone 'UTC', 'YYYYMMDDHH24MISS') "last-modified"
from rhnKickstartableTree kt,
rhnKSTreeType ktt,
rhnKSInstallType kit,
Expand Down
Loading
Loading