File spacewalk-reports-git-1247.8675cc4.obscpio of Package spacewalk-reports

07070100000000000041FD00000000000000000000000368EFD66400000000000000000000000000000000000000000000001200000000spacewalk-reports07070100000001000081B400000000000000000000000168EFD664000046AC000000000000000000000000000000000000001A00000000spacewalk-reports/COPYING                    GNU GENERAL PUBLIC LICENSE
                       Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.

                    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

                            NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) year name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
07070100000002000081B400000000000000000000000168EFD6640000032B000000000000000000000000000000000000002200000000spacewalk-reports/Makefile.pythonTHIS_MAKEFILE := $(realpath $(lastword $(MAKEFILE_LIST)))
CURRENT_DIR := $(dir $(THIS_MAKEFILE))
include $(CURRENT_DIR)../rel-eng/Makefile.python

# Docker tests variables
DOCKER_CONTAINER_BASE = uyuni-master
DOCKER_REGISTRY       = registry.mgr.suse.de
DOCKER_RUN_EXPORT     = "PYTHONPATH=$PYTHONPATH"
DOCKER_VOLUMES        = -v "$(CURDIR)/..:/manager"

__pylint ::
	$(call update_pip_env)
	pylint --rcfile=pylintrc $(shell find -name '*.py') > reports/pylint.log || true

docker_pylint ::
	docker run --rm -e $(DOCKER_RUN_EXPORT) $(DOCKER_VOLUMES) $(DOCKER_REGISTRY)/$(DOCKER_CONTAINER_BASE)-pgsql /bin/sh -c "cd /manager/reporting; make -f Makefile.python __pylint"

docker_shell ::
	docker run -t -i --rm -e $(DOCKER_RUN_EXPORT) $(DOCKER_VOLUMES) $(DOCKER_REGISTRY)/$(DOCKER_CONTAINER_BASE)-pgsql /bin/bash
07070100000003000081B400000000000000000000000168EFD66400001397000000000000000000000000000000000000001B00000000spacewalk-reports/pylintrc# reporting package pylint configuration

[MASTER]

# Profiled execution.
profile=no

# Pickle collected data for later comparisons.
persistent=no


[MESSAGES CONTROL]

# Disable the message(s) with the given id(s).


disable=I0011,
	C0302,
	C0111,
	R0801,
	R0902,
	R0903,
	R0904,
	R0912,
	R0913,
	R0914,
	R0915,
	R0921,
	R0922,
	W0142,
	W0403,
	W0603,
	C1001,
	W0121,
	useless-else-on-loop,
	bad-whitespace,
	unpacking-non-sequence,
	superfluous-parens,
	cyclic-import,
	redefined-variable-type,
	no-else-return,

        # Uyuni disabled
	E0203,
	E0611,
	E1101,
	E1102

# list of disabled messages:
#I0011: 62: Locally disabling R0201
#C0302:  1: Too many lines in module (2425)
#C0111:  1: Missing docstring
#R0902: 19:RequestedChannels: Too many instance attributes (9/7)
#R0903:  Too few public methods
#R0904: 26:Transport: Too many public methods (22/20)
#R0912:171:set_slots_from_cert: Too many branches (59/20)
#R0913:101:GETServer.__init__: Too many arguments (11/10)
#R0914:171:set_slots_from_cert: Too many local variables (38/20)
#R0915:171:set_slots_from_cert: Too many statements (169/50)
#W0142:228:MPM_Package.write: Used * or ** magic
#W0403: 28: Relative import 'rhnLog', should be 'backend.common.rhnLog'
#W0603: 72:initLOG: Using the global statement
# for pylint-1.0 we also disable
#C1001: 46, 0: Old-style class defined. (old-style-class)
#W0121: 33,16: Use raise ErrorClass(args) instead of raise ErrorClass, args. (old-raise-syntax)
#W:243, 8: Else clause on loop without a break statement (useless-else-on-loop)
# pylint-1.1 checks
#C:334, 0: No space allowed after bracket (bad-whitespace)
#W:162, 8: Attempting to unpack a non-sequence defined at line 6 of (unpacking-non-sequence)
#C: 37, 0: Unnecessary parens after 'not' keyword (superfluous-parens)
#C:301, 0: Unnecessary parens after 'if' keyword (superfluous-parens)

[REPORTS]

# Set the output format. Available formats are text, parseable, colorized, msvs
# (visual studio) and html
output-format=parseable

# Include message's id in output
include-ids=yes

# Tells whether to display a full report or only the messages
reports=yes

# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details
msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}"

[VARIABLES]

# A regular expression matching names used for dummy variables (i.e. not used).
dummy-variables-rgx=_|dummy


[BASIC]

# Regular expression which should only match correct module names
#module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
module-rgx=([a-zA-Z_][a-zA-Z0-9_]+)$

# Regular expression which should only match correct module level names
const-rgx=(([a-zA-Z_][a-zA-Z0-9_]*)|(__.*__))$

# Regular expression which should only match correct class names
class-rgx=[a-zA-Z_][a-zA-Z0-9_]+$

# Regular expression which should only match correct function names
function-rgx=[a-z_][a-zA-Z0-9_]{,42}$

# Regular expression which should only match correct method names
method-rgx=[a-z_][a-zA-Z0-9_]{,42}$

# Regular expression which should only match correct instance attribute names
attr-rgx=[a-z_][a-zA-Z0-9_]{,30}$

# Regular expression which should only match correct argument names
argument-rgx=[a-z_][a-zA-Z0-9_]{,30}$

# Regular expression which should only match correct variable names
variable-rgx=[a-z_][a-zA-Z0-9_]{,30}$

# Regular expression which should only match correct list comprehension /
# generator expression variable names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$

# Regular expression which should only match correct class sttribute names
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,42}|(__.*__))$

# Good variable names which should always be accepted, separated by a comma
good-names=i,j,k,ex,Run,_

# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata

# List of builtins function names that should not be used, separated by a comma
bad-functions=apply,input


[DESIGN]

# Maximum number of arguments for function / method
max-args=10

# Maximum number of locals for function / method body
max-locals=20

# Maximum number of return / yield for function / method body
max-returns=6

# Maximum number of branch for function / method body
max-branchs=20

# Maximum number of statements in function / method body
max-statements=50

# Maximum number of parents for a class (see R0901).
max-parents=7

# Maximum number of attributes for a class (see R0902).
max-attributes=7

# Minimum number of public methods for a class (see R0903).
min-public-methods=1

# Maximum number of public methods for a class (see R0904).
max-public-methods=20


[CLASSES]


[FORMAT]

# Maximum number of characters on a single line.
max-line-length=120

# Maximum number of lines in a module
max-module-lines=1000

# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string='    '


[MISCELLANEOUS]

# List of note tags to take in consideration, separated by a comma.
notes=
07070100000004000081B400000000000000000000000168EFD66400001E2E000000000000000000000000000000000000001D00000000spacewalk-reports/reports.py# pylint: disable=missing-module-docstring
import os
import re

# pylint: disable-next=unused-import
import sys

from spacewalk.common.rhnConfig import RHNOptions

BASE_REPORT_DEFINITIONS = "/usr/share/spacewalk/reports"


# pylint: disable-next=redefined-builtin
def available_reports(type):
    return os.listdir(os.path.join(BASE_REPORT_DEFINITIONS, type))


# pylint: disable-next=missing-class-docstring,invalid-name
class report:
    # pylint: disable-next=redefined-builtin
    def __init__(self, name, type, params):
        full_path = os.path.join(BASE_REPORT_DEFINITIONS, type, name)
        self.sql = None
        self.description = None
        self.synopsis = None
        self.columns = None
        self.column_indexes = None
        self.column_types = None
        self.column_descriptions = None
        self.multival_column_names = {}
        self.multival_columns_reverted = {}
        self.multival_columns_stop = []
        self.params = {}
        self.params_values = params
        self._load(full_path)

    def _load(self, full_path):
        try:
            # pylint: disable-next=unspecified-encoding
            fd = open(full_path, "r")
        except IOError as e:
            raise spacewalk_unknown_report from e
        tag = None
        value = ""
        # pylint: disable-next=anomalous-backslash-in-string
        re_comment = re.compile("^\s*#")
        # pylint: disable-next=anomalous-backslash-in-string,anomalous-backslash-in-string
        re_tag_name = re.compile("^(\S+):\s*$")

        for line in fd:
            result = re_comment.match(line)
            # pylint: disable-next=singleton-comparison
            if result != None:
                continue

            result = re_tag_name.match(line)
            # pylint: disable-next=singleton-comparison
            if result != None:
                # pylint: disable-next=singleton-comparison
                if tag != None:
                    self._set(tag, value)
                    tag = None
                    value = ""
                tag = result.group(1)
            else:
                value += line

        # pylint: disable-next=singleton-comparison
        if tag != None:
            self._set(tag, value)

        # pylint: disable-next=singleton-comparison
        if self.multival_column_names != None:
            unknown_columns = []

            # pylint: disable-next=consider-using-dict-items
            for c in self.multival_column_names:
                if c in self.column_indexes:
                    c_id = self.column_indexes[c]
                    v = self.multival_column_names[c]
                    # pylint: disable-next=singleton-comparison
                    if v == None:
                        self.multival_columns_stop.append(c_id)
                    elif v in self.column_indexes:
                        v_id = self.column_indexes[v]
                        if v_id in self.multival_columns_reverted:
                            self.multival_columns_reverted[v_id].append(c_id)
                        else:
                            self.multival_columns_reverted[v_id] = [c_id]
                else:
                    unknown_columns.append(c)
            if len(unknown_columns) > 0:
                raise spacewalk_report_unknown_multival_column_exception(
                    unknown_columns
                )

    def _set(self, tag, value):
        if tag == "columns":
            self.columns = []
            self.column_indexes = {}
            self.column_types = {}
            self.column_descriptions = {}
            # pylint: disable-next=anomalous-backslash-in-string,anomalous-backslash-in-string
            lines = filter(None, re.split("\s*\n\s*", value))
            i = 0
            for l in lines:
                description = None
                try:
                    # pylint: disable-next=anomalous-backslash-in-string
                    (c, description) = re.split("\s+", l, 1)
                # pylint: disable-next=bare-except
                except:
                    c = l
                try:
                    (c, t) = re.split(":", c, 1)
                # pylint: disable-next=bare-except
                except:
                    t = "s"
                self.columns.append(c)
                self.column_indexes[c] = i
                self.column_types[c] = t
                # pylint: disable-next=singleton-comparison
                if description != None:
                    self.column_descriptions[c] = description
                i = i + 1
        elif tag == "params":
            # pylint: disable-next=anomalous-backslash-in-string,anomalous-backslash-in-string
            lines = filter(None, re.split("\s*\n\s*", value))
            for l in lines:
                # pylint: disable-next=anomalous-backslash-in-string
                (p, v) = re.split("\s+", l, 1)
                value = v
                if p in self.params_values:
                    value = self.params_values[p]
                else:
                    try:
                        # pylint: disable-next=anomalous-backslash-in-string
                        (component, option) = re.split("\.", v, 1)
                        cfg = RHNOptions(component)
                        cfg.parse()
                        value = str(cfg.get(option))
                    except ValueError:
                        # This wasn't a configuration option, assume the value is the default
                        pass
                self.params[p] = value
        elif tag == "multival_columns":
            # the multival_columns specifies either
            # a "stop" column, usually the first one,
            # or a pair of column names separated by colon,
            # where the first on is column which should be
            # joined together and the second one is column
            # whose value should be used to distinguish if
            # we still have the same entity or not.
            for l in filter(None, re.split("\n", value)):
                # pylint: disable-next=anomalous-backslash-in-string,anomalous-backslash-in-string,anomalous-backslash-in-string,anomalous-backslash-in-string,anomalous-backslash-in-string,anomalous-backslash-in-string
                m = re.match("^\s*(\S+?)(\s*:\s*(\S*)\s*)?$", l)
                # pylint: disable-next=singleton-comparison
                if m == None:
                    continue
                (col, id_col) = (m.group(1), m.group(3))
                # pylint: disable-next=singleton-comparison
                if col != None:
                    self.multival_column_names[col] = id_col
        elif tag == "sql":
            self.sql = value
        elif tag == "synopsis":
            # pylint: disable-next=anomalous-backslash-in-string,anomalous-backslash-in-string,anomalous-backslash-in-string
            self.synopsis = re.sub("^(\s*\n)+\s*|(\s*\n)+$", "", value)
        elif tag == "description":
            self.description = re.sub(
                # pylint: disable-next=anomalous-backslash-in-string
                "(?m)^\s*",
                "    ",
                # pylint: disable-next=anomalous-backslash-in-string,anomalous-backslash-in-string,anomalous-backslash-in-string
                re.sub("^(\s*\n)+\s*|(\s*\n)+$", "", value),
            )
        else:
            raise spacewalk_report_unknown_tag_exception(tag)


# pylint: disable-next=invalid-name
class spacewalk_unknown_report(Exception):
    pass


# pylint: disable-next=invalid-name
class spacewalk_report_unknown_tag_exception(Exception):
    pass


# pylint: disable-next=invalid-name
class spacewalk_report_unknown_multival_column_exception(Exception):
    pass
07070100000005000041FD00000000000000000000000468EFD66400000000000000000000000000000000000000000000001A00000000spacewalk-reports/reports07070100000006000041FD00000000000000000000000268EFD66400000000000000000000000000000000000000000000001F00000000spacewalk-reports/reports/data07070100000007000081B400000000000000000000000168EFD66400000571000000000000000000000000000000000000002700000000spacewalk-reports/reports/data/actions
synopsis:

  Pending/executed/archived/failed action on the management server

description:

  List of all actions performed on all systems

columns:

  mgm_id The id of the management server instance that contains this data
  action_id The id of the action
  earliest The earliest time the action was schedule for execution
  type_name The type of event triggered by the action
  action_name The name of the action
  scheduler The id of the account who scheduled the action
  scheduler_name The username of the account who scheduled the action
  in_progress_systems Number of system where the action is still in progress
  completed_systems Number of system where the action is completed
  failed_systems Number of system where the action is failed
  archived True if the action is archived
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , action_id
                , earliest_action AS earliest
                , event AS type_name
                , action_name
                , scheduler_id AS scheduler
                , scheduler_username AS scheduler_name
                , in_progress_systems
                , completed_systems
                , failed_systems
                , archived
                , synced_date
        FROM ActionsReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, action_id
07070100000008000081B400000000000000000000000168EFD66400000412000000000000000000000000000000000000003000000000spacewalk-reports/reports/data/channel-packages
synopsis:

  Packages in channels

description:

  List of all packages in all channels.

columns:

  mgm_id The id of the management server instance that contains this data
  channel_label The unique label identifying the channel
  channel_name The unique name of the channel
  name The name of the package
  version The version number of the package
  release The release number of the package
  epoch The epoch of the package
  arch The architecture where the package is installable
  full_package_name The full qualified name of the package
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , channel_label
                , channel_name
                , name
                , version
                , release
                , epoch
                , arch
                , full_package_name
                , synced_date
        FROM ChannelPackagesReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, channel_label, name, version, release, epoch, arch
07070100000009000081B400000000000000000000000168EFD6640000034B000000000000000000000000000000000000002800000000spacewalk-reports/reports/data/channels
synopsis:

  Channel report

description:

  List of all channels with number of packages in each channel.

columns:

  mgm_id The id of the management server instance that contains this data
  channel_id The id of the channel
  channel_label The unique label identifying this channel
  channel_name The unique name of the channel
  number_of_packages The number of packages provided by the channel
  organization The organization that owns this data
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , channel_id
                , channel_label
                , channel_name
                , number_of_packages
                , organization
                , synced_date
        FROM ChannelsReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, channel_label
0707010000000A000081B400000000000000000000000168EFD66400000364000000000000000000000000000000000000002F00000000spacewalk-reports/reports/data/cloned-channels
synopsis:

  Cloned Channel report

description:

  List of cloned channels with their original channel.

columns:

  mgm_id The id of the management server instance that contains this data
  original_channel_label The unique label identifying the source channel
  original_channel_name The unique name of the source channel
  new_channel_label The unique label identifying the cloned channel
  new_channel_name The unique name of the cloned channel
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , original_channel_label
                , original_channel_name
                , new_channel_label
                , new_channel_name
                , synced_date
        FROM ClonedChannelsReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, original_channel_label, new_channel_label
0707010000000B000081B400000000000000000000000168EFD664000004B9000000000000000000000000000000000000003000000000spacewalk-reports/reports/data/coco-attestation
synopsis:

  Confidential Compute Attestations Reports

description:

  List the Confidential Compute Attestations performed for each system.

columns:

  mgm_id The id of the management server instance that contains this data
  report_id The id of the report
  system_id The id of the system
  event_id The id of the action that triggered the attestation
  hostname The hostname that identifies the system
  organization The organization that owns this data
  environment_type The type of the environment of the attested system
  report_status The status of the report
  pass The number of passed attestation results
  fail The number of failed attestation results
  create_time When the attestation was started
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
            , report_id
            , system_id
            , action_id AS event_id
            , hostname
            , organization
            , environment_type
            , report_status
            , pass
            , fail
            , create_time
            , synced_date
      FROM CoCoAttestationReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id, event_id
0707010000000C000081B400000000000000000000000168EFD664000004CB000000000000000000000000000000000000003800000000spacewalk-reports/reports/data/coco-attestation-results
synopsis:

  Results of Confidential Compute Attestations

description:

  List the Confidential Compute Attestations results performed for each report and system.

columns:

  mgm_id The id of the management server instance that contains this data
  report_id The id of the report
  result_type_id The id of the result type
  system_id The id of the system
  hostname The hostname that identifies this system
  organization The organization that owns this data
  environment_type The type of the environment of the attested system
  result_type The type of the result
  result_status The status of the result
  description The result description
  attestation_time The time when this result was attested
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
            , report_id
            , result_type_id
            , system_id
            , hostname
            , organization
            , environment_type
            , result_type
            , result_status
            , description
            , attestation_time
            , synced_date
        FROM CoCoAttestationResultReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, report_id, result_type_id
0707010000000D000081B400000000000000000000000168EFD6640000055D000000000000000000000000000000000000002F00000000spacewalk-reports/reports/data/custom-channels
synopsis:

  Custom-channels report

description:

  Channel metadata for all channels owned by an organization

columns:

  mgm_id The id of the management server instance that contains this data
  organization The organization that owns this data
  channel_id The id of the channel
  channel_label The unique label identifying the channel
  name The unique name of the channel
  summary A brief summary of the channel
  description A detailed description of the channel scope and purpose
  parent_channel_label The label of the parent of the channel, if exists
  channel_arch The architecture of the packages hold by the channel
  checksum_type The type of checksum used by the channel
  associated_repo_id_label The list of repositories linked to the channel, separated by ;
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , organization
                , channel_id
                , label AS channel_label
                , name
                , summary
                , description
                , parent_channel_label
                , arch AS channel_arch
                , checksum_type
                , channel_repositories AS associated_repo_id_label
                , synced_date
        FROM CustomChannelsReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, channel_label
0707010000000E000081B400000000000000000000000168EFD66400000325000000000000000000000000000000000000002B00000000spacewalk-reports/reports/data/custom-info
synopsis:

  Display system custom info

description:

  Display all custom info for every system with any info associated

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the system
  organization The organization that owns this data
  system_name The unique descriptive name of the system
  key The name of the custom information
  value The value of the custom information
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , system_id
                , organization
                , system_name
                , key
                , value
                , synced_date
        FROM CustomInfoReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id, key

0707010000000F000081B400000000000000000000000168EFD6640000026B000000000000000000000000000000000000002F00000000spacewalk-reports/reports/data/errata-channels
synopsis:

  List of erratas in channels

description:

  List of all erratas and their relation to channels.

columns:

  mgm_id The id of the management server instance that contains this data
  advisory The unique name of the advisory
  channel_label The unique label identifying the channel
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , advisory_name AS advisory
                , channel_label
                , synced_date
        FROM ErrataChannelsReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, advisory, channel_label
07070100000010000081B400000000000000000000000168EFD664000003CF000000000000000000000000000000000000002B00000000spacewalk-reports/reports/data/errata-list
synopsis:

  Errata out of compliance information - errata details

description:

  Patches out of compliance information with their details.

columns:

  mgm_id The id of the management server instance that contains this data
  advisory The unique name of the advisory
  type The type of patch. Possible values: Product Enhancement Advisory, Security Advisory, Bug Fix Advisory
  cve A list of CVE ids that this patch addresses, separated by ;
  synopsis The brief description of this patch
  systems_affected The number of system affected by this advisory
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , advisory_name AS advisory
                , advisory_type AS type
                , cve
                , synopsis
                , affected_systems AS systems_affected
                , synced_date
        FROM ErrataListReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, advisory
07070100000011000081B400000000000000000000000168EFD6640000043A000000000000000000000000000000000000002E00000000spacewalk-reports/reports/data/errata-systems
synopsis:

  Errata out of compliance information - erratas for systems

description:

  Patches out of compliance information with the details about the system.

columns:

  mgm_id The id of the management server instance that contains this data
  advisory The unique name of this advisory
  system_id The id of the system
  profile_name The unique descriptive name of the system
  hostname The hostname that identifies this system
  ip_address The IPv4 address of the primary network interface of the system
  ipv6_address The list of IPv6 addresses and their scopes of the primary network interface of the system, separated by ;
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , advisory_name AS advisory
                , system_id
                , profile_name
                , hostname
                , ip_address
                , ip6_addresses AS ipv6_address
                , synced_date
        FROM ErrataSystemsReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, advisory, system_id
07070100000012000081B400000000000000000000000168EFD66400000231000000000000000000000000000000000000002B00000000spacewalk-reports/reports/data/host-guestssynopsis:

    Host-Guest mapping

description:

    List all systems, along with their guests

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the host system
  guests The id of the guest system
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , host AS system_id
                , guest AS guests
                , synced_date
        FROM HostGuestsReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id, guests
07070100000013000081B400000000000000000000000168EFD6640000034B000000000000000000000000000000000000003000000000spacewalk-reports/reports/data/inactive-systems
synopsis:

  Inactive systems.

description:

  List of the inactive systems.

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the system
  system_name 'The unique descriptive name of the system
  organization The organization that owns this data
  last_checkin When this system was visible and reachable last time
  synced_date The timestamp of when this data was last refreshed.

params:

  threshold 1 

sql:

  SELECT * FROM (
      SELECT mgm_id
                , system_id
                , system_name
                , organization
                , last_checkin_time AS last_checkin
                , synced_date
        FROM SystemInactivityReport
       WHERE inactivity >= CAST(:threshold || ' days' AS interval)
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id

07070100000014000081B400000000000000000000000168EFD66400000C3C000000000000000000000000000000000000002900000000spacewalk-reports/reports/data/inventory
synopsis:

  Inventory report

description:

  List of all registered systems, together with hardware and software information.

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the system
  profile_name The unique descriptive name of the system
  hostname The hostname that identifies this system
  ip_address The IPv4 address of the primary network interface of the system
  ipv6_address The list of IPv6 addresses and their scopes of the primary network interface of the system, separated by ;
  registered_by The user account who onboarded this system
  registration_time When this system was onboarded
  last_checkin_time When this system was visible and reachable last time
  last_boot_time When this system was booted last time
  kernel_version The version of the kernel installed on this system
  packages_out_of_date The number of packages installed on the system that can be updated
  errata_out_of_date The number of patches that can be applied to the system
  extra_pkg_count The number of packages installed on the system which are not available in the management server
  status The status of the system
  software_channel THe list of software channels the system is subscribed to, separated by ;
  configuration_channel The list of configuration channels the system is subscribed to, separated by ;
  entitlements The list of entitlements of the system, separated by ;
  system_group The list of groups of the system, separated by ;
  organization The organization that owns this data
  virtual_host The id of the host of the system, if any
  architecture The architecture of the system
  is_virtualized True if the system is virtualized
  virt_type The type of virtualization, if the system is virualized
  hardware A brief description of the hardware specification of this system
  minion_id The identifier of the minion, if the system is a Salt Minion
  machine_id The identifier of the machine
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                 , system_id
                 , profile_name
                 , hostname
                 , ip_address
                 , ip6_addresses AS ipv6_address
                 , registered_by
                 , registration_time
                 , last_checkin_time
                 , last_boot_time
                 , kernel_version
                 , packages_out_of_date
                 , errata_out_of_date
                 , extra_pkg_count
                 , status
                 , software_channels AS software_channel
                 , configuration_channels AS configuration_channel
                 , entitlements
                 , system_groups AS system_group
                 , organization
                 , virtual_host
                 , architecture
                 , is_virtualized
                 , virt_type
                 , hardware
                 , minion_id
                 , machine_id
                , synced_date
        FROM InventoryReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id
07070100000015000081B400000000000000000000000168EFD66400000571000000000000000000000000000000000000003400000000spacewalk-reports/reports/data/packages-updates-all
synopsis:

  List of packages which can be updated

description:

  List of packages that can be updated for all systems, showing all available newer versions.

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the system
  organization The organization that owns this data
  package_name The name of the package
  package_epoch The epoch of the installed package
  package_version The version number of the installed package
  package_release The release number of the installed package
  package_arch The architecture of the package installed package
  newer_epoch The epoch of the new package that can be installed
  newer_version The version number of the new package that can be installed
  newer_release The release number of the new package that can be installed
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , system_id
                , organization
                , package_name
                , package_epoch
                , package_version
                , package_release
                , package_arch
                , newer_epoch
                , newer_version
                , newer_release
                , synced_date
        FROM PackagesUpdatesAllReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id, package_name
07070100000016000081B400000000000000000000000168EFD664000005B8000000000000000000000000000000000000003700000000spacewalk-reports/reports/data/packages-updates-newest
synopsis:

  List of packages which can be updated

description:

  List of packages that can be updated for all systems, showing only the newest package version available.

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the system
  organization The organization that owns this data
  package_name The name of the package
  package_epoch The epoch of the installed package
  package_version The version number of the installed package
  package_release The release number of the installed package
  package_arch The architecture of the package installed package
  newest_epoch The epoch of the new package that can be installed
  newest_version The version number of the new package that can be installed
  newest_release The release number of the new package that can be installed
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , system_id
                , organization
                , package_name
                , package_epoch
                , package_version
                , package_release
                , package_arch
                , newer_epoch AS newest_epoch
                , newer_version AS newest_version
                , newer_release AS newest_release
                , synced_date
        FROM PackagesUpdatesNewestReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id, package_name
07070100000017000081B400000000000000000000000168EFD664000002FA000000000000000000000000000000000000003000000000spacewalk-reports/reports/data/proxies-overview
synopsis:

  Proxies report

description:

  List of proxies and the systems registered through them

columns:

  mgm_id The id of the management server instance that contains this data
  proxy_id The id of the proxy system
  proxy_name The unique descriptive name of the proxy
  system_name The unique descriptive name of the system behind the proxy
  system_id The id of the system behind the proxy
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , proxy_id
                , proxy_name
                , system_name
                , system_id
                , synced_date
        FROM ProxyOverviewReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, proxy_name, system_name
07070100000018000081B400000000000000000000000168EFD66400000701000000000000000000000000000000000000002900000000spacewalk-reports/reports/data/scap-scan
synopsis:

  Results of OpenSCAP xccdf eval

description:

  List the SCAP scans performed for each system.

columns:

  mgm_id The id of the management server instance that contains this data
  organization The organization that owns this data
  system_id The id of the system
  hostname The hostname that identifies this system
  ip_address The IPv4 address of the system
  event_id The id of the action that triggered the scan
  testresult_id The id of the security scan
  name The name of the security scan
  benchmark The name of the performed benchmark
  benchmark_version The version of the benchmark
  profile The name of the profile used for the scan
  profile_title The descriptive title of the profile
  end_time When the scan has ended
  pass The number of passed rules
  fail The number of failed rules
  error The number of erroneous rules
  notselected The number of rules not selected for this scan
  informational The number of informational rules
  other The number of rules with other outcomes
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , organization
                , system_id
                , hostname
                , ip_address
                , action_id AS event_id
                , scan_id AS testresult_id
                , name
                , benchmark
                , benchmark_version
                , profile
                , profile_title
                , end_time
                , pass
                , fail
                , error
                , not_selected AS notselected
                , informational
                , other
                , synced_date
        FROM ScapScanReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id, event_id
07070100000019000081B400000000000000000000000168EFD664000003DF000000000000000000000000000000000000003100000000spacewalk-reports/reports/data/scap-scan-results
synopsis:

  Results of OpenSCAP xccdf eval

description:

  List the identifiers and the results of SCAP rules for each scan performed.

columns:

  mgm_id The id of the management server instance that contains this data
  testresult_id The id of the security scan
  ruleresult_id The id of the rule
  idref The reference of the rule
  system The name of the rule system
  system_id The id of the system
  ident The CCE v5 id of this rule
  result The result of the scan for this rule
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , scan_id AS testresult_id
                , rule_id AS ruleresult_id
                , idref
                , rulesystem AS system
                , system_id
                , ident
                , result
                , synced_date
        FROM ScapScanResultReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, testresult_id, ruleresult_id, system, system_id, ident
0707010000001A000081B400000000000000000000000168EFD664000004C1000000000000000000000000000000000000003500000000spacewalk-reports/reports/data/system-extra-packages
synopsis:

  Packages installed on systems that are not available from subscribed channels

description:

  List all packages installed on a system that are not available from any of the channels the system is subscribed to

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the system
  system_name The unique descriptive name of the system
  organization The organization that owns this data
  package_name The name of the package
  package_epoch The epoch of the package
  package_version The version number of the package
  package_release The release number of the package
  package_arch The architecture where this package is installable
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , system_id
                , system_name
                , organization
                , package_name
                , package_epoch
                , package_version
                , package_release
                , package_arch
                , synced_date
        FROM SystemExtraPackagesReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_name, system_id, package_name
0707010000001B000081B400000000000000000000000168EFD664000002DE000000000000000000000000000000000000002D00000000spacewalk-reports/reports/data/system-groups
synopsis:

  System groups

description:

  List of all available system groups

columns:

  mgm_id The id of the management server instance that contains this data
  group_id The id of this system group
  name The unique name of this system group
  current_members The current number of members of this system group
  organization The organization that owns this data
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , system_group_id AS group_id
                , name
                , current_members
                , organization
                , synced_date
        FROM SystemGroupsReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, group_id
0707010000001C000081B400000000000000000000000168EFD664000002DF000000000000000000000000000000000000003500000000spacewalk-reports/reports/data/system-groups-systems
synopsis:

  Systems in system groups

description:

  List of all systems which belongs to any system group

columns:

  mgm_id The id of the management server instance that contains this data
  group_id The id of this system group
  group_name The unique name of this system group
  system_id The id of the system
  system_name The unique descriptive name of the system
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , group_id
                , group_name
                , system_id
                , system_name
                , synced_date
        FROM SystemGroupsSystemsReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, group_id, system_id
0707010000001D000081B400000000000000000000000168EFD66400000B7E000000000000000000000000000000000000002F00000000spacewalk-reports/reports/data/system-hardware
synopsis:

  System Hardware report

description:

  List of all registered systems, together with hardware information.

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the system
  profile_name The unique descriptive name of the system
  hostname The hostname that identifies this system
  machine_id The identifier of the machine
  architecture The architecture of the system

  cpus The total number of CPUs of the system - sometimes called vCPUs
  sockets The total number of CPU Sockets of the system
  cores The number of Cores of a single CPU
  threads The number of Threads of a single Core
  cpu_bogomips The CPU bogomips value
  cpu_cache The CPU cache size in KiB
  cpu_family The CPU family
  cpu_mhz The CPU frequence in MHz
  cpu_stepping The CPU stepping
  cpu_flags The CPU flags
  cpu_model The CPU model
  cpu_version The CPU version
  cpu_vendor The CPU vendor
  memory_size The amount of RAM of the system in MiB
  swap_size The amount of swap space of the system in MiB
  vendor The system vendor
  system Additional information about the system
  product The Product information of the system
  bios_vendor The bios vendor
  bios_version The bios version
  bios_release The bios release date
  asset The assets of the system
  board The board information of the system
  primary_interface The name of the system primary network interface
  hardware_address The MAC address of the network interface
  ip_address The IPv4 address of the primary network interface of the system
  ip6_addresses The list of IPv6 addresses and their scopes of the primary network interface of the system, separated by ;
  is_virtualized True if the system is virtualized
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                 , system_id
                 , profile_name
                 , hostname
                 , machine_id
                 , architecture
                 , cpus
                 , sockets
                 , cores
                 , threads
                 , cpu_bogomips
                 , cpu_cache
                 , cpu_family
                 , cpu_mhz
                 , cpu_stepping
                 , cpu_flags
                 , cpu_model
                 , cpu_version
                 , cpu_vendor
                 , memory_size
                 , swap_size
                 , vendor
                 , system
                 , product
                 , bios_vendor
                 , bios_version
                 , bios_release
                 , asset
                 , board
                 , primary_interface
                 , hardware_address
                 , ip_address
                 , ip6_addresses
                 , is_virtualized
                 , synced_date
        FROM SystemHardwareReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id
0707010000001E000081B400000000000000000000000168EFD664000003B3000000000000000000000000000000000000002E00000000spacewalk-reports/reports/data/system-history
synopsis:

  System event history

description:

  Event history for each system

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the system
  hostname The hostname that identifies this system
  event_id The id of the history event
  time When this event has happened
  status The current status of the event. Possible values Queued, Picked Up, Completed, Failed
  event The type of history event
  event_data Additional information related to the event
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , system_id
                , hostname
                , event_id
                , event_time AS time
                , status
                , event
                , event_data
                , synced_date
        FROM HistoryReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id, event_id

0707010000001F000081B400000000000000000000000168EFD664000003A3000000000000000000000000000000000000003700000000spacewalk-reports/reports/data/system-history-channels
synopsis:

  Channel event history

description:

  Channel event history.

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the system
  event_id The id of the history event
  created_date When this event has happened
  status The current status of the action. Possible values Queued, Picked Up, Completed, Failed
  event The type of history event
  event_data Additional information related to the event triggered by this action
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , system_id
                , history_id AS event_id
                , event_time AS created_date
                , status
                , event
                , event_data
                , synced_date
        FROM SystemHistoryChannelsReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id, event_id
07070100000020000081B400000000000000000000000168EFD664000004A4000000000000000000000000000000000000003C00000000spacewalk-reports/reports/data/system-history-configuration
synopsis:

  Configuration event history

description:

  Configuration event history.

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the system
  event_id The id of the history event
  earliest_action The earliest time this action was schedule for execution
  pickup_date When this action was picked up for execution
  completed_date When this action was completed
  status The current status of the action. Possible values Queued, Picked Up, Completed, Failed
  event The type of event triggered by this action
  event_data Additional information related to the event triggered by this action
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , system_id
                , action_id AS event_id
                , earliest_action
                , pickup_time AS pickup_date
                , completion_time AS completed_date
                , status
                , event
                , event_data
                , synced_date
        FROM SystemHistoryConfigurationReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id, event_id
07070100000021000081B400000000000000000000000168EFD664000003BE000000000000000000000000000000000000003B00000000spacewalk-reports/reports/data/system-history-entitlements
synopsis:

  System entitlement event history

description:

  System entitlement event history.

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the system
  event_id The id of the history event
  created_date When this event has happened
  status The current status of the action. Possible values Queued, Picked Up, Completed, Failed
  event The type of history event
  event_data Additional information related to the event triggered by this action
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , system_id
                , history_id AS event_id
                , event_time AS created_date
                , status
                , event
                , event_data
                , synced_date
        FROM SystemHistoryEntitlementsReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id, event_id

07070100000022000081B400000000000000000000000168EFD6640000048E000000000000000000000000000000000000003500000000spacewalk-reports/reports/data/system-history-errata
synopsis:

  Patch event history

description:

  Patch event history.

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the system
  event_id The id of the history event
  earliest_action The earliest time this action was schedule for execution
  pickup_date When this action was picked up for execution
  completed_date When this action was completed
  status The current status of the action. Possible values Queued, Picked Up, Completed, Failed
  event The type of event triggered by this action
  event_data Additional information related to the event triggered by this action
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , system_id
                , action_id AS event_id
                , earliest_action
                , pickup_time AS pickup_date
                , completion_time AS completed_date
                , status
                , event
                , event_data
                , synced_date
        FROM SystemHistoryErrataReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id, event_id

07070100000023000081B400000000000000000000000168EFD664000004BD000000000000000000000000000000000000003800000000spacewalk-reports/reports/data/system-history-kickstart
synopsis:

  Automatic installations event history.

description:

  Automatic installations event history.

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the system
  event_id The id of the history event
  earliest_action The earliest time this action was schedule for execution
  pickup_date When this action was picked up for execution
  completed_date When this action was completed
  status The current status of the action. Possible values Queued, Picked Up, Completed, Failed
  event The type of event triggered by this action
  event_data Additional information related to the event triggered by this action
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , system_id
                , action_id AS event_id
                , earliest_action
                , pickup_time AS pickup_date
                , completion_time AS completed_date
                , status
                , event
                , event_data
                , synced_date
        FROM SystemHistoryAutoInstallationReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id, event_id

07070100000024000081B400000000000000000000000168EFD66400000493000000000000000000000000000000000000003700000000spacewalk-reports/reports/data/system-history-packages
synopsis:

  Package event history

description:

  Package event history.

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the system
  event_id The id of the history event
  earliest_action The earliest time this action was schedule for execution
  pickup_date When this action was picked up for execution
  completed_date When this action was completed
  status The current status of the action. Possible values Queued, Picked Up, Completed, Failed
  event The type of event triggered by this action
  event_data Additional information related to the event triggered by this action
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , system_id
                , action_id AS event_id
                , earliest_action
                , pickup_time AS pickup_date
                , completion_time AS completed_date
                , status
                , event
                , event_data
                , synced_date
        FROM SystemHistoryPackagesReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id, event_id
07070100000025000081B400000000000000000000000168EFD66400000491000000000000000000000000000000000000003300000000spacewalk-reports/reports/data/system-history-scap
synopsis:

  OpenSCAP event history

description:

  OpenSCAP event history.

columns:

  mgm_id The id of the management server instance that contains this data
  system_id The id of the system
  event_id The id of the history event
  earliest_action The earliest time this action was schedule for execution
  pickup_date When this action was picked up for execution
  completed_date When this action was completed
  status The current status of the action. Possible values Queued, Picked Up, Completed, Failed
  event The type of event triggered by this action
  event_data Additional information related to the event triggered by this action
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , system_id
                , action_id AS event_id
                , earliest_action
                , pickup_time AS pickup_date
                , completion_time AS completed_date
                , status
                , event
                , event_data
                , synced_date
        FROM SystemHistoryScapReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, system_id, event_id
07070100000026000081B400000000000000000000000168EFD66400000542000000000000000000000000000000000000002500000000spacewalk-reports/reports/data/users
synopsis:

  Users in the system

description:

  List of all users for all organizations, with their details and roles.

columns:

  mgm_id The id of the management server instance that contains this data
  organization The organization that owns this data
  user_id The id of the user account
  username The username used to login
  last_name The person last name(s)
  first_name The person first name(s)
  position The descriptive role of this user within the organization
  email The email address associated with this account
  role List of roles assigned to the user, separated by ;
  creation_time When this user account was created
  last_login_time When this user account logged in for the last time
  active Current status of the user. Possible values: enabled, disabled
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , organization
                , account_id AS user_id
                , username
                , last_name
                , first_name
                , position
                , email
                , roles AS role
                , creation_time
                , last_login_time
                , status AS active
                , synced_date
        FROM AccountsReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, user_id
07070100000027000081B400000000000000000000000168EFD6640000055E000000000000000000000000000000000000002900000000spacewalk-reports/reports/data/users-md5
synopsis:

  Users in the system

description:

  List of all users for all organizations using MD5 encrypted passwords.

columns:

  mgm_id The id of the management server instance that contains this data
  organization The organization that owns this data
  user_id The id of the user account
  username The username used to login
  last_name The person last name(s)
  first_name The person first name(s)
  position The descriptive role of this user within the organization
  email The email address associated with this account
  role List of roles assigned to the user, separated by ;
  creation_time When this user account was created
  last_login_time When this user account logged in for the last time
  active Current status of the user. Possible values: enabled, disabled
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , organization
                , account_id AS user_id
                , username
                , last_name
                , first_name
                , position
                , email
                , roles AS role
                , creation_time
                , last_login_time
                , status AS active
                , synced_date
        FROM AccountsReport
       WHERE md5_encryption
  ) X
  -- where placeholder
  ORDER BY mgm_id, user_id
07070100000028000081B400000000000000000000000168EFD664000003C4000000000000000000000000000000000000002D00000000spacewalk-reports/reports/data/users-systems
synopsis:

  Systems administered by individual users

description:

  List of systems that users can administer.

columns:

  mgm_id The id of the management server instance that contains this data
  organization The organization that owns this data
  user_id The id of the user account
  username The username used to login
  system_id The id of the system
  group The name of the group the user belongs to that grants access to the system
  admin_access true, if the user has administrative role
  synced_date The timestamp of when this data was last refreshed.

sql:

  SELECT * FROM (
      SELECT mgm_id
                , organization
                , account_id AS user_id
                , username
                , system_id
                , group_name AS group
                , is_admin AS admin_access
                , synced_date
        FROM AccountsSystemsReport
  ) X
  -- where placeholder
  ORDER BY mgm_id, organization, user_id, system_id
07070100000029000041FD00000000000000000000000268EFD66400000000000000000000000000000000000000000000002100000000spacewalk-reports/reports/legacy0707010000002A000081B400000000000000000000000168EFD66400000574000000000000000000000000000000000000002900000000spacewalk-reports/reports/legacy/actions
synopsis:

  Pending/executed/archived/failed action on Spacewalk/Satellite server

description:

  List of all actions on Spacewalk/Satellite

columns:

  id  Action id
  earliest Earliest date of the action execution
  type_name Type of the action
  action_name Name of the action
  scheduler Id of the scheduler
  scheduler_name Scheduler name
  in_progress_systems In progress systems
  completed_systems Completed systems
  failed_systems  Failed systems
  archived Archived action yes/no

multival_columns:

  id
  in_progress_systems : in_progress_systems
  completed_systems : completed_systems
  failed_systems : failed_systems


sql:

  SELECT * FROM (
  SELECT uao.id AS id,
    uao.earliest_action AS earliest,
    uao.type_name,
    (CASE uao.action_name WHEN NULL THEN uao.type_name ELSE uao.action_name END) AS action_name,
    uao.scheduler,
    wc.login AS scheduler_name,
    CASE WHEN SA.status IN (0,1) THEN S.name ELSE NULL END AS in_progress_systems,
    CASE WHEN SA.status = 2 then S.name ELSE NULL END AS completed_systems,
    CASE WHEN SA.status = 3 then S.name ELSE NULL END AS failed_systems,
    CASE WHEN uao.archived = 0 THEN 'no' ELSE 'yes' END AS archived
   FROM  rhnUserActionOverview uao JOIN rhnServerAction SA
    ON uao.id = SA.action_id JOIN rhnServer S
    ON S.id = SA.server_id LEFT JOIN web_contact wc
    ON uao.scheduler = wc.id)
  X
  ORDER BY id
0707010000002B000081B400000000000000000000000168EFD66400000CE6000000000000000000000000000000000000003100000000spacewalk-reports/reports/legacy/activation-keys
synopsis:

    Activation-keys defined on the system, and their associated data

description:

    Lists all activation-keys and entitlements, channels, config-channels, server-groups, and packages associated with them

columns:

        org_id            The organization that owns the key
        token             The token for a key
        note              Description of this key
        usage_limit       What is the key's usage-limit?
        is_disabled       Is the key disabled?
        deploys_configs   Does this key require config-files be deployed?
        entitlement       Entitlements the key assigns
        channel_label     Channels that the key subscribes a system to
        base_channel_id   Base channel id the key subscribes a system to
        child_channel_id  Child channel ids the key subscribes a system to
        cfg_channel_pos   "cfg-channel-label | position" for each cfg-channel in this key
        server_group      Server-groups that the key places the server into
        server_group_id   IDs of Server-groups that the key places the server into
        package_name      Packages that the key deploys to the system

multival_columns:

        org_id
        token
        entitlement     : entitlement
        channel_label   : channel_label
        base_channel_id : base_channel_id
        child_channel_id : child_channel_id
        cfg_channel_pos : cfg_channel_pos
        server_group    : server_group
        server_group_id : server_group_id
        package_name    : package_name

sql:

    select * from (
      select rt.org_id,
             ak.token,
             rt.note note,
             rt.usage_limit usage_limit,
             rt.disabled is_disabled,
             rt.deploy_configs deploys_configs,
             sgt.label entitlement,
             rc.label channel_label,
             CASE WHEN rc.parent_channel IS NULL THEN rc.id ELSE NULL END AS base_channel_id,
             CASE WHEN rc.parent_channel IS NULL THEN NULL ELSE rc.id END AS child_channel_id,
             rcc.label || '|' || rtcc.position cfg_channel_pos,
             sg.name server_group,
             sg.id server_group_id,
             pn.name package_name
      from rhnactivationkey ak
           inner join rhnregtoken rt ON rt.id = ak.reg_token_id
           left outer join rhnregtokenentitlement rte on rte.reg_token_id = rt.id
           left outer join rhnservergrouptype sgt on sgt.id = rte.server_group_type_id
           left outer join rhnregtokenchannels rtc on rtc.token_id = rt.id
           left outer join rhnchannel rc on rc.id = rtc.channel_id
           left outer join rhnregtokenconfigchannels rtcc on rtcc.token_id = rt.id
           left outer join rhnconfigchannel rcc on rcc.id = rtcc.config_channel_id
           left outer join rhnregtokengroups rtg on rtg.token_id = rt.id
           left outer join rhnservergroup sg on sg.id = rtg.server_group_id
           left outer join rhnregtokenpackages rtp on rtp.token_id = rt.id
           left outer join rhnpackagename pn on pn.id = rtp.name_id
           where ak.ks_session_id is null
           and ak.token not like 're-%'
    ) X
    -- where placeholder
    order by org_id, token, note, entitlement, base_channel_id, child_channel_id, cfg_channel_pos, server_group_id, package_name

0707010000002C000081B400000000000000000000000168EFD6640000032D000000000000000000000000000000000000003A00000000spacewalk-reports/reports/legacy/activation-keys-channels
synopsis:

    Activation-keys and their associated software channels

description:

    Lists all activation-keys and various entities associated with each key

columns:

        org_id       The organization that owns the key
        token        The actual token for this key
        channel      Channels the key subscribes a system to

multival_columns:

        token
        channel : channel

sql:

    select * from (
      select rt.org_id,
             ak.token, 
             rc.label channel
      from rhnactivationkey ak
           inner join rhnregtoken rt ON rt.id = ak.reg_token_id
           left outer join rhnregtokenchannels rtc on rtc.token_id = rt.id
           left outer join rhnchannel rc on rc.id = rtc.channel_id
    ) X
    -- where placeholder
    order by org_id, token, channel

0707010000002D000081B400000000000000000000000168EFD66400000387000000000000000000000000000000000000003800000000spacewalk-reports/reports/legacy/activation-keys-config
synopsis:

    Activation-keys and their associated config channels

description:

    Lists all activation-keys and any config-channels they apply, along with ordering

columns:

        org_id       The organization that owns the key
        token        The actual token for this key
        channel_pos  "cfg-channel-label | position" for each cfg-channel in this key

multival_columns:

        token
        channel_pos : channel_pos

sql:

    select * from (
      select rt.org_id,
             ak.token, 
             rc.label || '|' || rtc.position channel_pos
      from rhnactivationkey ak
           inner join rhnregtoken rt ON rt.id = ak.reg_token_id
           left outer join rhnregtokenconfigchannels rtc on rtc.token_id = rt.id
           left outer join rhnconfigchannel rc on rc.id = rtc.config_channel_id
    ) X
    -- where placeholder
    order by org_id, token, channel_pos

0707010000002E000081B400000000000000000000000168EFD66400000389000000000000000000000000000000000000003800000000spacewalk-reports/reports/legacy/activation-keys-groups
synopsis:

    Activation-keys and the server-groups they are associated with

description:

    Lists all activation-keys and the server-groups they associate their system with

columns:

        org_id               The organization that owns the key
        token                The actual token for this key
        server_group_name    Server-groups the key places the server into

multival_columns:

        token
        server_group_name : server_group_name

sql:

    select * from (
      select rt.org_id, 
             ak.token,
             sg.name server_group_name
      from rhnactivationkey ak
           inner join rhnregtoken rt ON rt.id = ak.reg_token_id
           left outer join rhnregtokengroups rtg on rtg.token_id = rt.id
           left outer join rhnservergroup sg on sg.id = rtg.server_group_id
    ) X
    -- where placeholder
    order by org_id, token, server_group_name

0707010000002F000081B400000000000000000000000168EFD6640000033B000000000000000000000000000000000000003A00000000spacewalk-reports/reports/legacy/activation-keys-packages
synopsis:

    Activation-keys and the packages they deploy

description:

    Lists all activation-keys and the packages they arrange to deploy

columns:

        org_id           The organization that owns the key
        token            The actual token for this key
        package_name     packages the key deploys to te system


multival_columns:

        token
        package_name : package_name

sql:

    select * from (
      select rt.org_id,
             ak.token,
             pn.name package_name
      from rhnactivationkey ak
           inner join rhnregtoken rt ON rt.id = ak.reg_token_id
           left outer join rhnregtokenpackages rtp on rtp.token_id = rt.id
           left outer join rhnpackagename pn on pn.id = rtp.name_id
    ) X
    -- where placeholder
    order by org_id, token, package_name

07070100000030000081B400000000000000000000000168EFD664000004C9000000000000000000000000000000000000003200000000spacewalk-reports/reports/legacy/channel-packages
synopsis:

	Packages in channels

description:

	List of packages in channels in the server.

columns:

	channel_label		Channel label
	channel_name		Channel name
	name		Name of package
	version		Version of package
	release		Release of package
	epoch		Epoch of package (if available)
	arch		Architecture of the package
	full_package_name	Full package name

sql:

	select * from (
	select rhnchannel.label channel_label, rhnchannel.name channel_name,
		rhnpackagename.name,
		rhnpackageevr.version, rhnpackageevr.release, rhnpackageevr.epoch,
		rhnpackagearch.label arch,
		case when rhnpackageevr.epoch is not null then rhnpackageevr.epoch || ':' else '' end ||
		rhnpackagename.name || '-' || rhnpackageevr.version || '-' || rhnpackageevr.release || '.' || rhnpackagearch.label full_package_name
	from rhnchannel, rhnchannelpackage, rhnpackage, rhnpackagename, rhnpackageevr, rhnpackagearch
	where rhnchannel.id = rhnchannelpackage.channel_id
		and rhnchannelpackage.package_id = rhnpackage.id
		and rhnpackage.name_id = rhnpackagename.id
		and rhnpackage.evr_id = rhnpackageevr.id
		and rhnpackage.package_arch_id = rhnpackagearch.id
	) X
	-- where placeholder
	order by channel_label, name, version, release, epoch, arch

07070100000031000081B400000000000000000000000168EFD66400000372000000000000000000000000000000000000002A00000000spacewalk-reports/reports/legacy/channels
synopsis:

    Channel report

description:

    List of channels in the server with number of packages in each channel.

columns:

    channel_id:i            Channel identifier
    channel_label           Channel label
    channel_name            Channel name
    number_of_packages:i    Number of packages in the channel
    org_id:i                Id of owning organization

sql:

    select * from (
        select rhnchannel.id channel_id, rhnchannel.label channel_label, rhnchannel.name channel_name,
               count(rhnchannelpackage.channel_id) number_of_packages,
               rhnchannel.org_id
          from rhnchannel
               left outer join rhnchannelpackage on rhnchannel.id = rhnchannelpackage.channel_id
        group by rhnchannel.org_id, rhnchannel.id, rhnchannel.label, rhnchannel.name
    ) X
    -- where placeholder
    order by channel_label

07070100000032000081B400000000000000000000000168EFD664000002B1000000000000000000000000000000000000003100000000spacewalk-reports/reports/legacy/cloned-channels
synopsis:

        Cloned Channel report

description:

        List of cloned channels in the server with their original channel.

columns:

        original_channel_label  Original channel label
        original_channel_name   Original channel name
        new_channel_label       Channel label
        new_channel_name        Channel name

sql:

        select oc.label original_channel_label,
               oc.name original_channel_name,
               nc.label new_channel_label,
               nc.name new_channel_name
        from   rhnchannelcloned cc,
               rhnchannel oc,
               rhnchannel nc
        where  cc.original_id = oc.id
          and  cc.id = nc.id
07070100000033000081B400000000000000000000000168EFD66400000A48000000000000000000000000000000000000002E00000000spacewalk-reports/reports/legacy/config-files
synopsis:

   Dump of all config-files in the system

description:

    List all configuration-file revisions for all organizations, including
    file contents and file information

    (See spacewalk.configchannel.lookupFileInfo(chan-label, path, revision) )


columns:

    org_id        Organization identifier
    channel_id    ID of the configuration channel containing the file
    channel       Configuration channel containing the file
    channel_type  Config-channel type (normal, local_override, server_import)
    path          Path of the config-file
    file_type     Filetype of the cfg-file (file, directory, symlink)
    file_id       File-id of the cfg-file
    revision      Revision of this cfg-file in this channel
    is_binary     true if file is binary (base64-enc) or false if text
    contents      Actual content of this version of this cfg-file in this channel
    delim_start   Sequence used to delimit start-of-macro
    delim_end     Sequence used to delimit end-of-macro
    username      Username file is to be owned-by
    groupname     Groupname of file's grou-owner
    filemode      Filemode of the deployed file
    symbolic_link Path to be linked-to if filetype == symlink
    selinux_ctx   selinux context of delpoyed file


sql:

    select * from (
        select cchan.org_id,
               cchan.id as channel_id,
               cchan.label as channel,
               cct.label as channel_type,
               cfn.path,
               cft.label as file_type,
               cf.id file_id,
               crev.revision,
               cc.is_binary,
               cc.contents,
               cc.delim_start,
               cc.delim_end,
               cfi.username,
               cfi.groupname,
               cfi.filemode,
               cfn2.path as symbolic_link,
               cfi.selinux_ctx
          from rhnconfigfile cf
               inner join rhnconfigchannel cchan on cchan.id = cf.config_channel_id
               inner join rhnconfigchanneltype cct on cct.id = cchan.confchan_type_id
               inner join rhnconfigfilename cfn on cf.config_file_name_id = cfn.id
               inner join rhnconfigrevision crev on crev.config_file_id = cf.id
               left outer join rhnconfigcontent cc on cc.id = crev.config_content_id
               inner join rhnconfiginfo cfi on cfi.id = crev.config_info_id
               inner join rhnconfigfiletype cft on cft.id = crev.config_file_type_id
               left outer join rhnconfigfilename cfn2 on cfn2.id = cfi.symlink_target_filename_id
     ) X
 -- where placeholder
 order by org_id, channel, path, revision desc
07070100000034000081B400000000000000000000000168EFD664000010CF000000000000000000000000000000000000003500000000spacewalk-reports/reports/legacy/config-files-latest
synopsis:

   Dump of most recent version of all config-files in the system

description:

    List only the latest revision of all configuration-files for all organizations, including
    file contents and file information

    (See spacewalk.configchannel.lookupFileInfo(chan-label, [paths]) )

columns:

    org_id        Organization identifier
    channel_id    ID of the Configuration channel containing the file
    channel       Configuration channel containing the file
    channel_type  Config-channel type (normal, local_override, server_import)
    path          Path of the config-file
    file_type     Filetype of the cfg-file (file, directory, symlink)
    file_id       File-id of the cfg-file
    revision      Revision of this cfg-file in this channel
    is_binary     true if file is binary (base64-enc) or false if text
    contents      Actual content of this version of this cfg-file in this channel
    delim_start   Sequence used to delimit start-of-macro
    delim_end     Sequence used to delimit end-of-macro
    username      Username file is to be owned-by
    groupname     Groupname of file's grou-owner
    filemode      Filemode of the deployed file
    symbolic_link Path to be linked-to if filetype == symlink
    selinux_ctx   selinux context of delpoyed file

sql:

    select * from (
        select T1.* from (
            select cchan.org_id,
                   cchan.id as channel_id,
                   cchan.label as channel,
                   cct.label as channel_type,
                   cfn.path,
                   cft.label as file_type,
                   cf.id file_id,
                   crev.revision,
                   cc.is_binary,
                   cc.contents,
                   cc.delim_start,
                   cc.delim_end,
                   cfi.username,
                   cfi.groupname,
                   cfi.filemode,
                   cfn2.path as symbolic_link,
                   cfi.selinux_ctx
              from rhnconfigfile cf
                   inner join rhnconfigchannel cchan on cchan.id = cf.config_channel_id
                   inner join rhnconfigchanneltype cct on cct.id = cchan.confchan_type_id
                   inner join rhnconfigfilename cfn on cf.config_file_name_id = cfn.id
                   inner join rhnconfigrevision crev on crev.config_file_id = cf.id
                   left outer join rhnconfigcontent cc on cc.id = crev.config_content_id
                   inner join rhnconfiginfo cfi on cfi.id = crev.config_info_id
                   inner join rhnconfigfiletype cft on cft.id = crev.config_file_type_id
                   left outer join rhnconfigfilename cfn2 on cfn2.id = cfi.symlink_target_filename_id
        ) T1
        left outer join (
            select cchan.org_id,
                   cchan.id as channel_id,
                   cchan.label as channel,
                   cct.label as channel_type,
                   cfn.path,
                   cft.label as file_type,
                   cf.id file_id,
                   crev.revision,
                   cc.is_binary,
                   cc.contents,
                   cc.delim_start,
                   cc.delim_end,
                   cfi.username,
                   cfi.groupname,
                   cfi.filemode,
                   cfn2.path as symbolic_link,
                   cfi.selinux_ctx
              from rhnconfigfile cf
                   inner join rhnconfigchannel cchan on cchan.id = cf.config_channel_id
                   inner join rhnconfigchanneltype cct on cct.id = cchan.confchan_type_id
                   inner join rhnconfigfilename cfn on cf.config_file_name_id = cfn.id
                   inner join rhnconfigrevision crev on crev.config_file_id = cf.id
                   left outer join rhnconfigcontent cc on cc.id = crev.config_content_id
                   inner join rhnconfiginfo cfi on cfi.id = crev.config_info_id
                   inner join rhnconfigfiletype cft on cft.id = crev.config_file_type_id
                   left outer join rhnconfigfilename cfn2 on cfn2.id = cfi.symlink_target_filename_id
       ) T2 on (t1.file_id = t2.file_id and t1.revision < t2.revision)
       where t2.file_id is null
     ) X
 -- where placeholder
 order by org_id, channel, path, revision desc
07070100000035000081B400000000000000000000000168EFD66400000629000000000000000000000000000000000000003100000000spacewalk-reports/reports/legacy/custom-channels
synopsis:

    Custom-channels report

description:

    Channel-meta-data for all channels owned by specific Satellite orgs

columns:

    org_id:i                Organization id of owning organization
    id:i                    Channel id
    channel_label           Channel label
    name                    Channel name
    summary                 Channel summary
    description             Channel description
    parent_channel_label    Label of parent-channel (if this is a child channel)
    channel_arch            Channel architecture label
    checksum_type           Checksum-type label
    associated_repo_id_label Label of any repos associated with this channel

multival_columns:

    id
    associated_repo_id_label : associated_repo_id_label

sql:

    select * from (
        select c.org_id, c.id, c.label as channel_label, c.name, c.summary, c.description,
               pc.label as parent_channel_label, ca.label as channel_arch, cst.label as checksum_type,
               cs.id || '|' || cs.label as associated_repo_id_label
          from rhnchannel c
               left outer join rhnchannel pc on pc.id = c.parent_channel
               left outer join rhnchannelarch ca on ca.id = c.channel_arch_id
               left outer join rhnchecksumtype cst on cst.id = c.checksum_type_id
               left outer join rhnchannelcontentsource ccs on ccs.channel_id = c.id
               left outer join rhncontentsource cs on cs.id = ccs.source_id
         where c.org_id is not null
    ) X
    -- where placeholder
    order by org_id, channel_label

07070100000036000081B400000000000000000000000168EFD664000002B0000000000000000000000000000000000000002D00000000spacewalk-reports/reports/legacy/custom-info
synopsis:

	Display system custom info

description:

  Display custom info for all systems in Spacewalk with any custom info associated

columns:

	server_id	Server id
	org_id	Organization id
	server_name	Server name
	key	Custom info key
	value	Custom info value

sql:

	select * from (
	select rhnServer.id as server_id,
	rhnServer.org_id as org_id,
	rhnServer.name as server_name,
	rhnCustomDataKey.label as key,
	rhnServerCustomDataValue.value as value
	from rhnServer join rhnServerCustomDataValue on rhnServer.id=rhnServerCustomDataValue.server_id join rhnCustomDataKey on rhnServerCustomDataValue.key_id=rhnCustomDataKey.id
	) X
	-- where placeholder
	order by org_id, server_id

07070100000037000081B400000000000000000000000168EFD6640000025F000000000000000000000000000000000000003100000000spacewalk-reports/reports/legacy/errata-channels
synopsis:

	List of erratas in channels

description:

	List of all erratas and their relation to channels.

columns:

	advisory	Advisory / errata identifier
	channel_label	Channel label

sql:


	select advisory, channel_label
	from (	
	select rhnErrata.advisory_name as advisory,
		rhnErrata.id as errata_id,
		rhnChannel.label as channel_label,
		rhnChannel.id as channel_id
	from rhnErrata, rhnChannelErrata, rhnChannel
	where rhnErrata.id = rhnChannelErrata.errata_id
		and rhnChannelErrata.channel_id = rhnChannel.id
	) X
	-- where placeholder
	order by advisory, errata_id, channel_label, channel_id
07070100000038000081B400000000000000000000000168EFD664000004B6000000000000000000000000000000000000002D00000000spacewalk-reports/reports/legacy/errata-list
synopsis:

	Errata out of compliance information - errata details

description:

	List of erratas that are applicable to at least one registered
	system, together with basic info about the errata. Also see
	errata-systems report to get list of systems that are affected.

columns:

	advisory	Advisory / errata identifier
	type		Advisory type (Enhancement, Bug Fix, Security)
	cve		List of CVE names (Common Vulnerabilities and Exposures Identifiers) addressed by the errata
	synopsis	Synopsis of the errata
	systems_affected:i	Number of systems to which this errata is applicable

multival_columns:

	advisory
	cve : cve

sql:

	select * from (
	select rhnErrata.advisory_name as advisory,
		rhnErrata.advisory_type as type,
		rhnCVE.name as cve,
		rhnErrata.synopsis,
		count(*) as systems_affected
	from rhnErrata left outer join rhnErrataCVE
		on rhnErrata.id = rhnErrataCVE.errata_id
		left outer join rhnCVE
		on rhnErrataCVE.cve_id = rhnCVE.id
		, rhnServerNeededErrataCache
	where rhnErrata.id = rhnServerNeededErrataCache.errata_id
	group by rhnErrata.id,
		rhnErrata.advisory_name,
		rhnErrata.advisory_type,
		rhnCVE.name,
		rhnErrata.synopsis
	) X
	-- where placeholder
	order by advisory, cve
07070100000039000081B400000000000000000000000168EFD66400000464000000000000000000000000000000000000003100000000spacewalk-reports/reports/legacy/errata-list-all
synopsis:

	List of all erratas

description:

	List of all erratas, together with basic info about the errata.
	Also see errata-list to output only applicable erratas, and
	errata-systems report to get list of systems that are affected.

columns:

	advisory	Advisory / errata identifier
	type		Advisory type (Enhancement, Bug Fix, Security)
	issue_date	Issue date of the erratum
	update_date 	Date of the last update
	cve		List of CVE names (Common Vulnerabilities and Exposures Identifiers) addressed by the errata
	synopsis	Synopsis of the errata

multival_columns:

	advisory
	cve : cve

sql:

	select advisory, type, issue_date, update_date, cve, synopsis from (
	select rhnErrata.id, rhnErrata.advisory_name as advisory,
		rhnErrata.advisory_type as type,
		rhnErrata.issue_date as issue_date,
		rhnErrata.update_date as update_date,
		rhnCVE.name as cve,
		rhnErrata.synopsis
	from rhnErrata left outer join rhnErrataCVE
		on rhnErrata.id = rhnErrataCVE.errata_id
		left outer join rhnCVE
		on rhnErrataCVE.cve_id = rhnCVE.id
	) X
	-- where placeholder
	order by issue_date desc, update_date desc, advisory, id, cve
0707010000003A000081B400000000000000000000000168EFD66400000543000000000000000000000000000000000000003000000000spacewalk-reports/reports/legacy/errata-systems
synopsis:

	Errata out of compliance information - erratas for systems

description:

	List of applicable erratas and systems that are affected.

columns:

	advisory	Advisory / errata identifier
	server_id:i	System identifier
	profile_name	Profile name, as stored on server
	hostname	Hostname, as reported by the system
	ip_address	IP address, as reported by the system
	ipv6_address    IPv6 address, as reported by the system

sql:

	select * from (
	select rhnErrata.advisory_name as advisory,
		rhnServerNeededErrataCache.server_id,
		rhnServer.name as profile_name,
		rhnServer.hostname, trim(ipaddr) as ip_address,
		trim(ip6addr) as ipv6_address
	from rhnErrata, rhnServer,
		rhnServerNeededErrataCache left outer join
		(
		select server_id, rsna4.address as ipaddr, rsna6.address as ip6addr
		from rhnservernetinterface rsni
		left join rhnServerNetAddress4 rsna4
		on rsni.id = rsna4.interface_id
		left join rhnServerNetAddress6 rsna6
		on rsni.id = rsna6.interface_id
		where id in (
			select min(id)
			from rhnservernetinterface
			where is_primary = 'Y'
			group by server_id
			)
		) netinfos
		on rhnServerNeededErrataCache.server_id = netinfos.server_id
	where rhnErrata.id = rhnServerNeededErrataCache.errata_id
		and rhnServerNeededErrataCache.server_id = rhnServer.id
	) X
	-- where placeholder
	order by advisory, server_id
0707010000003B000081B400000000000000000000000168EFD664000001AC000000000000000000000000000000000000002D00000000spacewalk-reports/reports/legacy/host-guestssynopsis:

    Host-Guest mapping

description:

    List all systems, along with their guests

columns:

    server_id   System identifier
    guests    Guests

multival_columns:

    server_id
    guests : guests

sql:

    select host_system_id as server_id,
        virtual_system_id as guests
    from rhnvirtualinstance
    where host_system_id is not null
        and virtual_system_id is not null
    order by server_id
0707010000003C000081B400000000000000000000000168EFD66400000323000000000000000000000000000000000000003200000000spacewalk-reports/reports/legacy/inactive-systems
synopsis:

	Inactive system in spacewalk

description:

	List of all inactive systems in spacewalk

columns:

	system_id	System id
	system_name	System name
	organization_id	Id of organization system belongs to
	last_checkin	Last check of the system

sql:

	select * from (
	select rhnServer.id as system_id,
		rhnServer.name as system_name,
		rhnServer.org_id as organization_id,
		rhnServerInfo.checkin as last_checkin
	from rhnServer
		join rhnServerInfo on rhnServer.id=rhnServerInfo.server_id,
		(
			select cast(coalesce(value, default_value) as integer) as thresh from rhnConfiguration
			where key = 'SYSTEM_CHECKIN_THRESHOLD'
		) C
	where rhnServerInfo.checkin < current_timestamp - numtodsinterval(
	C.thresh * 86400, 'second')
	) X
	-- where placeholder
	order by system_id, organization_id

0707010000003D000081B400000000000000000000000168EFD6640000190E000000000000000000000000000000000000002B00000000spacewalk-reports/reports/legacy/inventory
synopsis:

	Inventory report

description:

	List of systems registered to the server, together with
	hardware and software information.

columns:

	server_id:i	System identifier
	profile_name	Profile name, as stored on server
	hostname	Hostname, as reported by the system
	ip_address	IPv4 address, as reported by the system
	ipv6_address    IPv6 address, as reported by the system
	registered_by	User under which the system is registered
	registration_time	Registration time
	last_checkin_time	Last checkin time
	kernel_version		Kernel version, as reported by the system
	packages_out_of_date:i	Number of packages that can be upgraded
	errata_out_of_date:i	Number of erratas that can be applied
	software_channel	List of channels to which the system is registered
	configuration_channel	List of configuration channels
	entitlements		List of entitlements
	system_group		List of system group to which the system belongs
	organization		Organization name
	virtual_host:i		System identifier of host, if system is a guest
	architecture		Architecture of the system
	is_virtualized	Information whether system is virtualized or not
	virt_type System virtualization type
	osad_status	OSAD status
	hardware		Hardware information
	minion_id       Minion ID, as reported by the system
	machine_id      Machine ID, as reported by the system

multival_columns:

	server_id
	software_channel : software_channel
	configuration_channel : configuration_channel
	entitlements : entitlements
	system_group : system_group
	virtual_host : virtual_host

sql:

	select server_id, profile_name, hostname, ip_address, ipv6_address, registered_by,
		registration_time, last_checkin_time, kernel_version,
		packages_out_of_date, errata_out_of_date,
		software_channel, configuration_channel,
		entitlements, system_group, organization, virtual_host, architecture, is_virtualized, virt_type, osad_status, hardware,
		minion_id, machine_id
	from (
	select servers_data.*,
	rhnchannel.name as software_channel,
	rhnchannel.parent_channel as parent_channel,
	rhnchannel.id as channel_id,
	COALESCE(update_data.packages_out_of_date, 0) as packages_out_of_date,
	COALESCE(update_data.errata_out_of_date, 0) as errata_out_of_date
	from
	(select rhnserver.id as server_id,
		rhnserver.name as profile_name,
		rhnserver.hostname,
		(select minion_id from suseMinionInfo where rhnserver.id = suseMinionInfo.server_id) as minion_id,
		trim(ipaddr) as ip_address,
		trim(ip6addr) as ipv6_address,
		rhnserver.machine_id,
		( select login from web_contact where rhnserver.creator_id = web_contact.id ) as registered_by,
		to_char(rhnserver.created, 'YYYY-MM-DD HH24:MI:SS') as registration_time,
		( select to_char(checkin, 'YYYY-MM-DD HH24:MI:SS') from rhnserverinfo where rhnserver.id = server_id ) as last_checkin_time,
		running_kernel as kernel_version,
		rhnconfigchannel.name as configuration_channel,
		rhnconfigchannel.id as configuration_channel_id,
		entitlement_data.name as entitlements,
		entitlement_data.server_group_id as entitlements_server_group_id,
		group_data.name as system_group,
		group_data.server_group_id as system_group_server_group_id,
		(
		select name from web_customer where rhnserver.org_id = web_customer.id
		) as organization,
		virtual_data.host_system_id as virtual_host,
		(
		select rhnserverarch.name from rhnserverarch where rhnserver.server_arch_id = rhnserverarch.id
		) as architecture,
		(case when (select rhnVirtualInstance.virtual_system_id from rhnVirtualInstance where rhnVirtualInstance.virtual_system_id=rhnserver.id) is null then 'No' else 'Yes' end
) as is_virtualized,
		(select rvit.name from rhnvirtualinstance rvi inner join rhnvirtualinstanceinfo rvii on rvi.id = rvii.instance_id inner join rhnvirtualinstancetype rvit on rvii.instance_type = rvit.id where rvi.virtual_system_id = rhnserver.id) as virt_type,
		(nvl((select rhnpushclientstate.label from rhnpushclient join rhnpushclientstate on rhnpushclient.state_id=rhnpushclientstate.id where rhnpushclient.server_id=rhnServer.id), 'Not enabled')) as osad_status,
		get_hw_info_as_clob(rhnserver.id, '; ') as hardware
	from rhnserver left outer join
		(
		select server_id, rsna4.address as ipaddr, rsna6.address as ip6addr
		from rhnservernetinterface rsni
		left join rhnServerNetAddress4 rsna4
		on rsni.id = rsna4.interface_id
		left join rhnServerNetAddress6 rsna6
		on rsni.id = rsna6.interface_id
		where id in (
			select min(id)
			from rhnservernetinterface
			where is_primary = 'Y'
			group by server_id
			)
		) netinfos
		on rhnserver.id = netinfos.server_id
		left outer join rhnserverconfigchannel
		on rhnserver.id = rhnserverconfigchannel.server_id
		left outer join rhnconfigchannel
		on rhnserverconfigchannel.config_channel_id = rhnconfigchannel.id
		left outer join
		(
		select rhnservergroupmembers.server_id, rhnservergroupmembers.server_group_id, rhnservergroup.name
		from rhnservergroupmembers left outer join rhnservergroup
			on rhnservergroupmembers.server_group_id = rhnservergroup.id
		where rhnservergroup.group_type is not null
		) entitlement_data
		on rhnserver.id = entitlement_data.server_id
		left outer join
		(
		select rhnservergroupmembers.server_id, rhnservergroupmembers.server_group_id, rhnservergroup.name
		from rhnservergroupmembers left outer join rhnservergroup
			on rhnservergroupmembers.server_group_id = rhnservergroup.id
		where rhnservergroup.group_type is null
		) group_data
		on rhnserver.id = group_data.server_id
		left outer join
		(
		select host_system_id, virtual_system_id
		from rhnvirtualinstance
		where host_system_id is not null
		) virtual_data
		on rhnserver.id = virtual_data.virtual_system_id
		) servers_data
		left outer join rhnserverchannel
			on servers_data.server_id = rhnserverchannel.server_id
		left outer join rhnchannel
			on rhnserverchannel.channel_id = rhnchannel.id
		left join (select rhnServerNeededCache.server_id,
					count(distinct rhnpackage.name_id) as packages_out_of_date,
					count(rhnServerNeededCache.errata_id) as errata_out_of_date
				from rhnpackage, rhnServerNeededCache
				where rhnServerNeededCache.package_id = rhnpackage.id
				group by rhnServerNeededCache.server_id) update_data on update_data.server_id = servers_data.server_id
	) X
	-- where placeholder
	order by server_id, parent_channel nulls first, channel_id,
		configuration_channel_id, entitlements_server_group_id, system_group_server_group_id,
		virtual_host
0707010000003E000081B400000000000000000000000168EFD664000004B6000000000000000000000000000000000000003300000000spacewalk-reports/reports/legacy/kickstart-scripts
synopsis:

    Kickstart scripts

description:

    Lists all kickstart scripts and their details

columns:

    id              Kickstart script id
    org_id          Organization id of the kickstart
    script_name     Kickstart script name
    kickstart_id    Kickstart id the kickstart script is assocxiated to
    kickstart_label Kickstart label the kickstart script is assocxiated to
    position        Position of the kickstart script within a Kickstart
    script_type     Type of the kickstart script
    chroot          Run the script within the chroot environment
    interpreter     Kickstart script interpreter (bash if empty)
    data            Actual kickstart script

sql:

    select * from (
        select kss.id,
               ks.org_id,
               kss.script_name,
               kss.kickstart_id,
               ks.label AS kickstart_label,
               kss.position,
               kss.script_type,
               kss.chroot,
               kss.interpreter,
               kss.data
        from rhnKickstartScript kss join rhnKsData ks on ks.id = kss.kickstart_id
        where kss.raw_script = 'Y'
    ) X
    -- where placeholder
    order by kickstart_id, position, id
0707010000003F000081B400000000000000000000000168EFD66400000333000000000000000000000000000000000000003500000000spacewalk-reports/reports/legacy/kickstartable-trees
synopsis:

	List of kickstartable trees

description:

	List of all kickstartable trees.

columns:

	organization_id:i	Organization identifier
	channel_label	Label of the channel
	tree_label	Kickstartable tree label
	number_of_files:i	Number of files in the kickstartable tree

sql:

	select organization_id, channel_label, tree_label, number_of_files
	from (
	select rhnKickstartableTree.org_id as organization_id,
		rhnChannel.label as channel_label,
		rhnKickstartableTree.label as tree_label,
		( select count(*) from rhnKSTreeFile where rhnKickstartableTree.id = rhnKSTreeFile.kstree_id ) as number_of_files,
		rhnKickstartableTree.id
	from rhnKickstartableTree, rhnChannel
	where rhnKickstartableTree.channel_id = rhnChannel.id
	) X
	-- where placeholder
	order by organization_id, channel_label, tree_label, id
07070100000040000081B400000000000000000000000168EFD66400000597000000000000000000000000000000000000003600000000spacewalk-reports/reports/legacy/packages-updates-all
synopsis:

	List of packages which can be updated

description:

	Prints list of packages which can be updated for all systems in spacewalk.
	Show all newer versions of the packages which are available.

columns:

	system_id System id
  org_id  Id of organization system belongs to
  package_name  Name of the package
  package_epoch Epoch of the package
  package_version Version of the package
  package_release Release of the package
  package_arch  Architecture of the package
	newer_epoch Version of the newer package available
  newer_version Release of the newer package available
  newer_release  Architecture of the newer package available

sql:

	select * from (
  select S.id as system_id,
    S.org_id as org_id,
    PN.name as package_name,
    OPE.epoch as package_epoch,
    OPE.version as package_version,
    OPE.release as package_release,
    PA.label as package_arch,
    NPE.epoch as newer_epoch,
    NPE.version as newer_version,
    NPE.release as newer_release
  from rhnServer S
    join rhnServerNeededCache SPC on S.id=SPC.server_id
    join rhnPackage P on SPC.package_id=P.id
    join rhnPackageName PN on P.name_id=PN.id
    join rhnServerPackage SP on SP.server_id=S.id and SP.name_id=P.name_id
    join rhnPackageArch PA on SP.package_arch_id=PA.id
    join rhnPackageEvr OPE on OPE.id=SP.evr_id
    join rhnPackageEvr NPE on NPE.id=P.evr_id
	) X
	-- where placeholder
	order by org_id, system_id

07070100000041000081B400000000000000000000000168EFD6640000068F000000000000000000000000000000000000003900000000spacewalk-reports/reports/legacy/packages-updates-newest
synopsis:

	List of packages which can be updated

description:

	Prints list of packages which can be updated for all systems in spacewalk.
	Shows only the newest package version available for upgrade.

columns:

	system_id System id
  org_id  Id of organization system belongs to
  package_name  Name of the package
  package_epoch Epoch of the package
  package_version Version of the package
  package_release Release of the package
  package_arch  Architecture of the package
	newest_epoch Version of the newest package available
  newest_version Release of the newest package available
  newest_release  Architecture of the newest package available

sql:

	select * from (
  select S.id as system_id,
    S.org_id as org_id,
    PN.name as package_name,
    OPE.epoch as package_epoch,
    OPE.version as package_version,
    OPE.release as package_release,
    PA.label as package_arch,
    NPE.epoch as newest_epoch,
    NPE.version as newest_version,
    NPE.release as newest_release
  from rhnServer S
    join rhnServerNeededCache SPC on S.id=SPC.server_id
    join rhnPackage P on SPC.package_id=P.id
    join rhnPackageName PN on P.name_id=PN.id
    join rhnServerPackage SP on SP.server_id=S.id and SP.name_id=P.name_id
    join rhnPackageArch PA on SP.package_arch_id=PA.id
    join rhnPackageEvr OPE on OPE.id=SP.evr_id
    join rhnPackageEvr NPE on NPE.id=P.evr_id
  where NPE.evr=(
    select max(PE.evr)
    from rhnServerNeededCache SPC1
      join rhnPackage P1 on SPC1.package_id=P1.id
      join rhnPackageEvr PE on P1.evr_id=PE.id
    where P1.name_id=P.name_id
      and SPC1.server_id = s.id)
  ) X
  -- where placeholder
  order by org_id, system_id
07070100000042000081B400000000000000000000000168EFD664000002E7000000000000000000000000000000000000003200000000spacewalk-reports/reports/legacy/proxies-overview
synopsis:

    Proxies report

description:

    List of proxies and the servers registered through them

columns:

    proxy_id     Proxy identifier
    proxy_name   Proxy name
    server_name  Server name
    server_id    Server identifier

sql:

    select * from (
        select proxy.id proxy_id, proxy.name proxy_name, server.name server_name, server.id server_id
          from rhnserver proxy
               inner join rhnproxyinfo pi on proxy.id = pi.server_id
               left outer join rhnserverpath sp on sp.proxy_server_id = proxy.id
               left outer join rhnserver server on server.id = sp.server_id
         order by proxy.name, server.name 
    ) X
    -- where placeholder
    order by proxy_name, server_name

07070100000043000081B400000000000000000000000168EFD6640000074C000000000000000000000000000000000000002E00000000spacewalk-reports/reports/legacy/repositories
synopsis:

    Repositories defined in system

description:

    List of all repositories, their SSL info, and any filters

columns:

    org_id:i                Organization identifier
    id:i                    Repository id
    repo_label              Repository name
    repo_type               Repository type (e.g., 'yum')
    source_url              Repository URL
    client_key_descr        Client SSL Cert Key Description
    client_key_type         Client SSL Cert Key Type
    client_key              Client SSL Cert Key
    client_cert_descr       Client SSL Cert Description
    client_cert_type        Client SSl Cert Type
    client_cert             Client SSL Cert
    ca_descr                SSL CA Cert Description
    ca_type                 SSL CA Cert Type
    ca_key                  SSL CA Cert

multival_columns:

    org_id
    id

sql:

    select * from (
       select cs.org_id, cs.id, cs.label as repo_label, cst.label as repo_type, cs.source_url,
              ck_key.description as client_key_descr, ck_key.crypto_key_type_id as client_key_type, ck_key.key as client_key,
              ck_cert.description as client_cert_descr, ck_cert.crypto_key_type_id as client_cert_type, ck_cert.key as client_cert,
              ck_ca.description as ca_descr, ck_ca.crypto_key_type_id as ca_type, ck_ca.key as ca_key
       from rhncontentsource cs
            left outer join rhncontentsourcessl css on css.content_source_id = cs.id
            left outer join rhncryptokey ck_key on ck_key.id = css.ssl_client_key_id
            left outer join rhncryptokey ck_cert on ck_cert.id = css.ssl_client_cert_id
            left outer join rhncryptokey ck_ca on ck_ca.id = css.ssl_ca_cert_id
            join rhncontentsourcetype cst on cs.type_id = cst.id
       where cs.org_id is not null
    ) X
    -- where placeholder
    order by org_id, id
07070100000044000081B400000000000000000000000168EFD66400000C26000000000000000000000000000000000000002B00000000spacewalk-reports/reports/legacy/scap-scan
synopsis:

	Results of OpenSCAP xccdf eval

description:

	For each system, list xccdf scans performed.

columns:

	org_id:i		Organization id
	system_id:i		System identifier
	hostname		Hostname, as reported by the system
	ip_address		IPv4 address, as reported by the system
	event_id:i		Event id
	testresult_id:i		Testresult identifier
	name			Identifier of xccdf testresult
	benchmark		Name of the xccdf benchmark
	benchmark_version	Version of xccdf benchmark
	profile			Name of the xccdf profile
	profile_title		Title of the xccdf profile
	end_time		System time of finished scan
	pass:i			Count of Pass results
	fail:i			Count of Fail results
	error:i			Count of Error results
	notselected:i		Count of Notselected results
	informational:i		Count of Informational results
	other:i			Count of other results

multival_columns:

sql:

	select org_id, system_id, hostname, ip_address, event_id, testresult_id, name, benchmark, benchmark_version,
		profile, profile_title, end_time, pass, fail, error, notselected, informational, other from (
	select rhnserver.org_id as org_id,
		rhnxccdftestresult.server_id as system_id,
		rhnserver.hostname as hostname,
		trim(rhnservernetaddress4.address) as ip_address,
		rhnactionscap.action_id as event_id,
		rhnxccdftestresult.id as testresult_id,
		rhnxccdftestresult.identifier as name,
		rhnxccdfbenchmark.identifier as benchmark,
		rhnxccdfbenchmark.version as benchmark_version,
		rhnxccdfprofile.identifier as profile,
		rhnxccdfprofile.title as profile_title,
		to_char(rhnxccdftestresult.end_time, 'YYYY-MM-DD HH24:MI:SS') as end_time,
		count(case label when 'pass' then 1 else null end) as pass,
		count(case label when 'fail' then 1 else null end) as fail,
		count(case label when 'error' then 1 else null end) as error,
		count(case label when 'notselected' then 1 else null end) as notselected,
		count(case label when 'informational' then 1 else null end) as informational,
		count(case when label not in ('pass', 'fail', 'error', 'notselected', 'informational') then 1 else null end) as other
	from rhnxccdftestresult, rhnactionscap, rhnxccdfbenchmark, rhnxccdfprofile,
		rhnservernetaddress4, rhnservernetinterface, rhnserver, rhnxccdfruleresult, rhnxccdfruleresulttype
	where rhnxccdftestresult.action_scap_id = rhnactionscap.id
		and rhnxccdftestresult.benchmark_id = rhnxccdfbenchmark.id
		and rhnxccdftestresult.profile_id = rhnxccdfprofile.id
		and rhnxccdftestresult.server_id = rhnservernetinterface.server_id
		and rhnservernetinterface.id = rhnservernetaddress4.interface_id
		and rhnservernetinterface.is_primary = 'Y'
		and rhnxccdftestresult.server_id = rhnserver.id
		and rhnxccdfruleresult.testresult_id = rhnxccdftestresult.id
		and rhnxccdfruleresult.result_id = rhnxccdfruleresulttype.id
	group by org_id, rhnxccdftestresult.server_id, hostname, trim(rhnservernetaddress4.address), rhnactionscap.action_id, rhnxccdftestresult.id, rhnxccdftestresult.identifier,
		rhnxccdfbenchmark.identifier, rhnxccdfbenchmark.version, rhnxccdfprofile.identifier, rhnxccdfprofile.title, end_time
	) X
	-- where placeholder
	order by system_id, event_id
07070100000045000081B400000000000000000000000168EFD66400000756000000000000000000000000000000000000003300000000spacewalk-reports/reports/legacy/scap-scan-results
synopsis:

	Results of OpenSCAP xccdf eval

description:

	For each scan, list identifiers and results of xccdf rules.

columns:

	testresult_id:i		Testresult identifier
	ruleresult_id:i		Ruleresult identifier
	idref			Ruleresult text identifier
	system			Naming scheme for the identifier
	system_id:i		System identifier
	ident			Identifier of the xccdf rule
	result			Result of the check

multival_columns:

sql:

	select testresult_id, ruleresult_id, idref, system, system_id, ident, result from (
	select rhnxccdfruleresult.testresult_id as testresult_id,
		rhnxccdfruleresult.id as ruleresult_id,
		(select xi.identifier
			from rhnxccdfruleidentmap rim, rhnxccdfident xi, rhnxccdfidentsystem xis
			where rim.rresult_id = rhnxccdfruleresult.id
				and rim.ident_id = xi.id
				and xi.identsystem_id = xis.id
				and xis.system = '#IDREF#'
		) as idref,
		rhnxccdfidentsystem.system as system,
                rhnxccdftestresult.server_id as system_id,
		rhnxccdfident.identifier as ident,
		rhnxccdfruleresulttype.label as result
	from rhnxccdfruleresult
		left outer join rhnxccdfruleresulttype
			on rhnxccdfruleresult.result_id = rhnxccdfruleresulttype.id
		left outer join rhnxccdfruleidentmap
			on rhnxccdfruleresult.id = rhnxccdfruleidentmap.rresult_id
			and (select count(*)
				from rhnxccdfident xi, rhnxccdfidentsystem xis
				where rhnxccdfruleidentmap.ident_id = xi.id
					and xi.identsystem_id = xis.id
					and xis.system = '#IDREF#'
			) = 0
		left outer join rhnxccdfident
			on rhnxccdfruleidentmap.ident_id = rhnxccdfident.id
		left outer join rhnxccdfidentsystem
			on rhnxccdfident.identsystem_id = rhnxccdfidentsystem.id
                left outer join rhnxccdftestresult
                        on rhnxccdfruleresult.testresult_id = rhnxccdftestresult.id
	) X
	-- where placeholder
	order by testresult_id, ruleresult_id, system, system_id, ident
07070100000046000081B400000000000000000000000168EFD66400001639000000000000000000000000000000000000002F00000000spacewalk-reports/reports/legacy/splice-export
synopsis:

    System data needed for splice integration for enhanced reporting.

description:

    List of systems registered to the server, together with
    various hardware and software information used for enhanced reporting.
    The structure of this report can change as needed in future releases
    of spacewalk-reports.

columns:

    server_id:i         System identifier
    organization        Organization
    org_id              Organization ID
    name                System Name
    hostname            Hostname, as reported by the system
    ip_address          IPv4 address, as reported by the system
    ipv6_address        IPv6 address, as reported by the system
    registered_by       User under which the system is registered
    registration_time   Registration time
    last_checkin_time   Last checkin time
    software_channel    List of channels to which the system is registered
    entitlements        List of entitlements
    system_group        List of system group to which the system belongs
    virtual_host:i      System identifier of host, if system is a guest
    architecture        Architecture of the system
    hardware            Hardware information
    memory              Memory info
    sockets             Socket count
    is_virtualized      Virtualization status (irrespective of host/guest mapping)

multival_columns:

    server_id
    software_channel : software_channel
    entitlements : entitlements
    system_group : system_group
    virtual_host : virtual_host

sql:

    select server_id, organization, org_id, name, hostname, ip_address, ipv6_address, registered_by,
        registration_time, last_checkin_time,
        software_channel,
        entitlements, system_group, virtual_host, architecture, hardware, memory, sockets, is_virtualized
    from (
    select rhnserver.id as server_id,
        rhnserver.name as name,
        rhnserver.org_id as org_id,
        rhnserver.hostname, trim(ipaddr) as ip_address,
        trim(ip6addr) as ipv6_address,
        ( select login from web_contact where rhnserver.creator_id = web_contact.id ) as registered_by,
        to_char(rhnserver.created, 'YYYY-MM-DD HH24:MI:SS') as registration_time,
        ( select to_char(checkin, 'YYYY-MM-DD HH24:MI:SS') from rhnserverinfo where rhnserver.id = server_id ) as last_checkin_time,
        rhnchannel.label as software_channel,
        rhnchannel.parent_channel as parent_channel,
        rhnchannel.id as channel_id,
        entitlement_data.name as entitlements,
        entitlement_data.server_group_id as entitlements_server_group_id,
        group_data.name as system_group,
        group_data.server_group_id as system_group_server_group_id,
        (
        select name from web_customer where rhnserver.org_id = web_customer.id
        ) as organization,
        virtual_data.host_system_id as virtual_host,
        (
        select rhnserverarch.name from rhnserverarch where rhnserver.server_arch_id = rhnserverarch.id
        ) as architecture,
        get_hw_info_as_clob(rhnserver.id, '; ') as hardware,
        (
        select rhnram.ram from rhnram where rhnram.server_id = rhnserver.id
        ) as memory,
        (
        select rhncpu.nrsocket from rhncpu where rhncpu.server_id = rhnserver.id
        ) as sockets,
        (case when (select rhnVirtualInstance.virtual_system_id from rhnVirtualInstance where rhnVirtualInstance.virtual_system_id=rhnserver.id) is null then 'No' else 'Yes' end
        ) as is_virtualized
    from rhnserver left outer join
        (
        select server_id, rsna4.address as ipaddr, rsna6.address as ip6addr
        from rhnservernetinterface rsni
        left join rhnServerNetAddress4 rsna4
        on rsni.id = rsna4.interface_id
        left join rhnServerNetAddress6 rsna6
        on rsni.id = rsna6.interface_id
        where id in (
          select min(id)
          from rhnservernetinterface
          where is_primary = 'Y'
          group by server_id
          )
        ) netinfos
        on rhnserver.id = netinfos.server_id
        left outer join rhnserverchannel
        on rhnserver.id = rhnserverchannel.server_id
        left outer join rhnchannel
        on rhnserverchannel.channel_id = rhnchannel.id
        left outer join rhnserverconfigchannel
        on rhnserver.id = rhnserverconfigchannel.server_id
        left outer join rhnconfigchannel
        on rhnserverconfigchannel.config_channel_id = rhnconfigchannel.id
        left outer join
        (
        select rhnservergroupmembers.server_id, rhnservergroupmembers.server_group_id, rhnservergroup.name
        from rhnservergroupmembers left outer join rhnservergroup
            on rhnservergroupmembers.server_group_id = rhnservergroup.id
        where rhnservergroup.group_type is not null
        ) entitlement_data
        on rhnserver.id = entitlement_data.server_id
        left outer join
        (
        select rhnservergroupmembers.server_id, rhnservergroupmembers.server_group_id, rhnservergroup.name
        from rhnservergroupmembers left outer join rhnservergroup
            on rhnservergroupmembers.server_group_id = rhnservergroup.id
        where rhnservergroup.group_type is null
        ) group_data
        on rhnserver.id = group_data.server_id
        left outer join
        (
        select host_system_id, virtual_system_id
        from rhnvirtualinstance
        where host_system_id is not null
        ) virtual_data
        on rhnserver.id = virtual_data.virtual_system_id
    ) X
    -- where placeholder
    order by server_id, parent_channel nulls first, channel_id,
        entitlements_server_group_id, system_group_server_group_id,
        virtual_host
07070100000047000081B400000000000000000000000168EFD66400000828000000000000000000000000000000000000003100000000spacewalk-reports/reports/legacy/system-currency
synopsis:

	System currency list

description:

	Prints list of numbers of available erratas for each registered system

columns:

	system_id Server ID
	org_id	Organization ID which is server registered to
	name	Name of the server
	critical	Number of critical security updates available
	important Number of important security updates available
	moderate	Number of moderate importance security updates available
	low	Number of low importance security updates available
	bug	Number of bug fixes available
	enhancement	Number of enhancements available
	score Total system score

params:

	p_crit	java.sc_crit
	p_imp	java.sc_imp
	p_mod	java.sc_mod
	p_low	java.sc_low
	p_bug	java.sc_bug
	p_enh	java.sc_enh

sql:

	select system_id, org_id, name, critical, important, moderate, low, bug, enhancement,
		((critical * :p_crit) + (important *  :p_imp) + (moderate * :p_mod) + (low * :p_low) + (bug * :p_bug) + (enhancement * :p_enh)) as score
	from (
	select S.id as system_id,
		S.org_id as org_id,
		S.name as name,
		sum(case when E.advisory_type = 'Security Advisory' and E.severity = 'errata.sev.label.critical' then 1 else 0 end) critical,
		sum(case when E.advisory_type = 'Security Advisory' and E.severity = 'errata.sev.label.important' then 1 else 0 end) important,
		sum(case when E.advisory_type = 'Security Advisory' and E.severity = 'errata.sev.label.moderate' then 1 else 0 end) moderate,
		sum(case when E.advisory_type = 'Security Advisory' and (E.severity = 'errata.sev.label.low' or E.severity is null) then 1 else 0 end) low,
		sum(case when E.advisory_type = 'Bug Fix Advisory' then 1 else 0 end) as bug,
		sum(case when E.advisory_type = 'Product Enhancement Advisory' then 1 else 0 end) as enhancement
	from rhnServer S
	left join (select distinct err.id, snc.server_id, err.synopsis, err.advisory_type, es.label as severity
		from rhnErrata err
		join rhnServerNeededCache SNC on err.id=SNC.errata_id
		left join rhnErrataSeverity es on err.SEVERITY_ID = es.id) E on S.id=E.server_id
	group by S.id, S.org_id, name
	) X
	-- where placeholder
	order by org_id, system_id

07070100000048000081B400000000000000000000000168EFD6640000074C000000000000000000000000000000000000003700000000spacewalk-reports/reports/legacy/system-extra-packages
synopsis:

	Packages installed on systems that are not available from subscribed channels

description:

	List all packages installed on all systems that are not available from channels the system is subscribed to

columns:

	system_id	System id
        system_name     System name
	org_id	Id of organization system belongs to
	package_name	Name of the package
	package_epoch	Epoch of the package
	package_version	Version of the package
	package_release	Release of the package
	package_arch	Architecture of the package

sql:

select s.id as system_id,
       s.name as system_name,
       s.org_id as org_id,
       pn.name as package_name,
       pe.epoch as package_epoch,
       pe.version as package_version,
       pe.release as package_release,
       pa.label as package_arch
  from rhnServer s
  join rhnServerPackage sp on s.id = sp.server_id
  join rhnPackageName pn on sp.name_id = pn.id
  join rhnPackageArch pa on sp.package_arch_id = pa.id
  join rhnPackageEvr pe on sp.evr_id = pe.id
  left join (select sc.server_id,
                    cp.package_id,
                    p.name_id,
                    p.evr_id,
                    p.package_arch_id
               from rhnPackage p,
                    rhnServerChannel sc,
                    rhnChannelPackage cp,
                    rhnServerPackage sp2
              where cp.package_id = p.id
                and sc.channel_id = cp.channel_id
                and sc.server_id = sp2.server_id
                and sp2.package_arch_id = p.package_arch_id
                and sp2.name_id = p.name_id
                and sp2.evr_id = p.evr_id
       ) scp on (scp.server_id = sp.server_id
            and sp.name_id = scp.name_id
            and sp.evr_id = scp.evr_id
            and sp.package_arch_id = scp.package_arch_id)
 where scp.package_id is null
 order by s.org_id, s.name, s.id, pn.name
07070100000049000081B400000000000000000000000168EFD664000001E5000000000000000000000000000000000000002F00000000spacewalk-reports/reports/legacy/system-groups
synopsis:

	System groups in spacewalk/SUSE Manager

description:

	List of all system groups across whole spacewalk/SUSE Manager

columns:

	group_id	System group id
	name	System group name
	current_members	Number of current members in system group
	org_id	ID of organization which owns the system group

sql:

	select * from (
	select id as group_id,
		name,
		current_members,
		org_id
	from rhnservergroup
		where group_type is null
	) X
	-- where placeholder
	order by group_id

0707010000004A000081B400000000000000000000000168EFD664000002E6000000000000000000000000000000000000003400000000spacewalk-reports/reports/legacy/system-groups-keys
synopsis:

  Activation keys for system groups

description:

  Lists all activation keys which can be used for registration of system into specific system group

columns:

	group_id	System group id
	group_name	System group name
	org_id  Id of organization group belongs to
	activation_key	Activation key

sql:

  select * from (
	select sysgroup.id as group_id,
		sysgroup.name as group_name,
		sysgroup.org_id as org_id,
		AK.token as activation_key
	from rhnactivationkey AK
		join rhnregtoken RT on AK.REG_TOKEN_ID=RT.ID
    join rhnRegTokenGroups RTG on AK.reg_token_id=RTG.token_id
    join rhnservergroup sysgroup on RTG.server_group_id=sysgroup.id
	where RT.disabled=0
  ) X
  -- where placeholder
  order by org_id, activation_key

0707010000004B000081B400000000000000000000000168EFD6640000026D000000000000000000000000000000000000003700000000spacewalk-reports/reports/legacy/system-groups-systems
synopsis:

	Systems in system groups

description:

	List of all systems which belongs to any system group

columns:

	group_id	System group ID
	group_name	System group name
	server_id	System ID
	server_name	Name of the system

sql:

	select * from (
	select sysgroup.id as group_id,
		sysgroup.name as group_name,
		server.id as server_id,
		server.name as server_name
	from rhnservergroup sysgroup, rhnservergroupmembers members,
		rhnserver server
	where sysgroup.id=members.server_group_id
		and members.server_id=server.id
		and sysgroup.group_type is null
	) X
	-- where placeholder
	order by group_id, server_id

0707010000004C000081B400000000000000000000000168EFD66400000455000000000000000000000000000000000000003500000000spacewalk-reports/reports/legacy/system-groups-users
synopsis:

	System groups users report

description:

	List of users which can access specific system groups

columns:

	group_id	System group id
	group_name	System group name
	user_id	Internal user id
	login	User login
	last_name Last name
	first_name	First name(s)
	email	User email

sql:

  select * from (
  select sysgroup.id as group_id,
    sysgroup.name as group_name,
    web_contact.id as user_id,
    web_contact.login as login,
    wupi.last_name as last_name,
    wupi.first_names as first_name,
    wupi.email as email
  from web_contact join
    web_user_personal_info wupi on web_contact.id=wupi.web_user_id join
    rhnServerGroup sysgroup on sysgroup.org_id=web_contact.org_id
  where sysgroup.group_type is null
    and ((web_contact.id in (select UGM.user_id from rhnUserGroupMembers UGM join rhnUserGroup UG on UGM.USER_GROUP_ID=UG.ID where (UG.NAME='Organization Administrators')))
    or exists(select * from rhnUserServerGroupPerms perms where
      perms.user_id=web_contact.id
      and perms.server_group_id=sysgroup.id))
  ) X
  -- where placeholder
  order by group_id, user_id

0707010000004D000081B400000000000000000000000168EFD66400001110000000000000000000000000000000000000003000000000spacewalk-reports/reports/legacy/system-history
synopsis:

	System event history

description:

	Event history for each system

columns:

	server_id:i	System identifier
	hostname	hostname
	event_id:i	Event id
	time		Time of event
	status		Status of the event
	event		Type of the event
	event_data	Additional parameters / details for the event

multival_columns:

	event_id
	event_data : event_data

sql:

	select server_id, hostname, event_id, time, status, event, event_data
	from (
		select rhnserveraction.server_id,
			rhnserver.hostname,
			rhnserveraction.action_id as event_id,
			to_char(rhnserveraction.completion_time, 'YYYY-MM-DD HH24:MI:SS') as time,
			rhnactionstatus.name as status,
			case when rhnactiontype.name = 'Package Install' and rhnactionpackage.parameter = 'upgrade' then 'Package Upgrade'
				else rhnactiontype.name end as event,
			case when rhnactiontype.name = 'Errata Update' then rhnerrata.advisory
				when rhnactiontype.name in ( 'Package Install', 'Package Removal', 'Verify deployed packages' ) then rhnpackagename.name
					|| case when rhnpackageevr.id is not null then '-' || evr_t_as_vre_simple(rhnpackageevr.evr) end
					|| case when rhnpackagearch.id is not null then '.' || rhnpackagearch.label end
				when rhnactiontype.label like 'configfiles.%' then rhnconfigfilename.path
				when rhnactiontype.label = 'kickstart.initiate' then (
					select distinct rhnksdata.label
					from rhnkickstartsessionhistory, rhnkickstartsession, rhnksdata
					where rhnserveraction.action_id = rhnkickstartsessionhistory.action_id
						and rhnkickstartsessionhistory.kickstart_session_id = rhnkickstartsession.id
						and rhnkickstartsession.kickstart_id = rhnksdata.id
					)
				when rhnactiontype.label = 'scap.xccdf_eval' then (
					select distinct rhnxccdftestresult.identifier
					from rhnxccdftestresult, rhnactionscap
					where rhnaction.id = rhnactionscap.action_id
						and rhnxccdftestresult.action_scap_id = rhnactionscap.id
					)
				end as event_data
		from rhnserveraction left outer join rhnactionerrataupdate
			on rhnserveraction.action_id = rhnactionerrataupdate.action_id
			inner join rhnserver 
				on rhnserveraction.server_id = rhnserver.id
			left outer join rhnactionpackage
				on rhnserveraction.action_id = rhnactionpackage.action_id
				left outer join rhnpackagename
					on rhnactionpackage.name_id = rhnpackagename.id
				left outer join rhnpackageevr
					on rhnactionpackage.evr_id = rhnpackageevr.id
				left outer join rhnpackagearch
					on rhnactionpackage.package_arch_id = rhnpackagearch.id
			left outer join rhnerrata
				on rhnactionerrataupdate.errata_id = rhnerrata.id
			left outer join rhnactionconfigrevision
				on rhnserveraction.action_id = rhnactionconfigrevision.action_id
				and rhnserveraction.server_id = rhnactionconfigrevision.server_id
				left outer join rhnconfigrevision
					on rhnactionconfigrevision.config_revision_id = rhnconfigrevision.id
					left outer join rhnconfigfile
						on rhnconfigrevision.config_file_id = rhnconfigfile.id
						left outer join rhnconfigfilename
							on rhnconfigfile.config_file_name_id = rhnconfigfilename.id
			, rhnaction, rhnactiontype, rhnactionstatus
		where rhnserveraction.action_id = rhnaction.id
			and rhnaction.action_type = rhnactiontype.id
			and rhnserveraction.status = rhnactionstatus.id
		union all
		select rhnserverhistory.server_id, 
			rhnserver.hostname,
			rhnserverhistory.id,
			to_char(greatest(rhnserverhistory.created, rhnserverhistory.modified), 'YYYY-MM-DD HH24:MI:SS'),
			'Done',
			case when rhnserverhistory.summary like 'subscribed to channel %' then 'Subscribed to channel'
				when rhnserverhistory.summary like 'unsubscribed from channel %' then 'Unsubscribed from channel'
				when rhnserverhistory.summary like 'Updated system release %' then 'Updated system release'
				else trim(upper(substr(rhnserverhistory.summary, 1, 1)) || substr(rhnserverhistory.summary, 2)) end,
			case when summary in ( 'added system entitlement ', 'removed system entitlement ') then details
				when summary like 'subscribed to channel %' then details
				when summary like 'unsubscribed from channel %' then details
				when summary like 'Updated system release %' then substr(summary, 24)
			end
		from rhnserverhistory inner join rhnserver on rhnserverhistory.server_id = rhnserver.id
	) X
	-- where placeholder
	order by server_id, time, event_id

0707010000004E000081B400000000000000000000000168EFD66400000430000000000000000000000000000000000000003900000000spacewalk-reports/reports/legacy/system-history-channels
synopsis:

	Channel event history

description:

	Channel event history.

columns:

	server_id:i	System identifier
	event_id:i	Event id
	created_date	Date created
	status		Status of the event
	event		Type of the event
	event_data	Channel label

multival_columns:

	event_id
	event_data : event_data

sql:

	select server_id, event_id, created_date, status, event, event_data from (
	select rhnserverhistory.server_id,
		rhnserverhistory.id as event_id,
		to_char(rhnserverhistory.created, 'YYYY-MM-DD HH24:MI:SS') as created_date,
		rhnserverhistory.created as created_raw_date,
		'D' || 'one' as status,
		case when rhnserverhistory.summary like 'subscribed to channel %' then 'Subscribed to channel'
			when rhnserverhistory.summary like 'unsubscribed from channel %' then 'Unsubscribed from channel'
			end as event,
		details as event_data
	from rhnserverhistory
	where (rhnserverhistory.summary like 'subscribed to channel %' or rhnserverhistory.summary like 'unsubscribed from channel %')
	) X
	-- where placeholder
	order by server_id, created_raw_date, event_id

0707010000004F000081B400000000000000000000000168EFD66400000727000000000000000000000000000000000000003E00000000spacewalk-reports/reports/legacy/system-history-configuration
synopsis:

	Configuration event history

description:

	Configuration event history.

columns:

	server_id:i	System identifier
	event_id:i	Event id
	created_date	Date created
	earliest_action	Earliest date this action will occur
	pickup_date	The date/time the action was picked up
	completed_date	The date/time the event was completed
	status		Status of the event
	event		Type of the event
	event_data	File name

multival_columns:

	event_id
	event_data : event_data

sql:

	select server_id, event_id, created_date, earliest_action, pickup_date, completed_date, status, event, event_data from (
	select rhnserveraction.server_id,
		rhnserveraction.action_id as event_id,
		to_char(rhnaction.created, 'YYYY-MM-DD HH24:MI:SS') as created_date,
		rhnaction.created as created_raw_date,
		to_char(rhnaction.earliest_action, 'YYYY-MM-DD HH24:MI:SS') as earliest_action,
		to_char(rhnserveraction.pickup_time, 'YYYY-MM-DD HH24:MI:SS') as pickup_date,
		to_char(rhnserveraction.completion_time, 'YYYY-MM-DD HH24:MI:SS') as completed_date,
		rhnactionstatus.name as status,
		rhnactiontype.name as event,
		rhnconfigfilename.path as event_data
	from rhnserveraction, rhnactionconfigrevision, rhnconfigrevision, rhnconfigfile, rhnconfigfilename, rhnaction, rhnactiontype, rhnactionstatus
	where rhnserveraction.action_id = rhnaction.id
		and rhnaction.action_type = rhnactiontype.id
		and rhnserveraction.status = rhnactionstatus.id
		and rhnserveraction.action_id = rhnactionconfigrevision.action_id
		and rhnserveraction.server_id = rhnactionconfigrevision.server_id
		and rhnactionconfigrevision.config_revision_id = rhnconfigrevision.id
		and rhnconfigrevision.config_file_id = rhnconfigfile.id
		and rhnconfigfile.config_file_name_id = rhnconfigfilename.id
	) X
	-- where placeholder
	order by server_id, created_raw_date, event_id

07070100000050000081B400000000000000000000000168EFD66400000513000000000000000000000000000000000000003D00000000spacewalk-reports/reports/legacy/system-history-entitlements
synopsis:

	System entitlement event history

description:

	System entitlement event history.

columns:

	server_id:i	System identifier
	event_id:i	Event id
	created_date	Date created
	status		Status of the event
	event		Type of the event
	event_data	Additional parameters / details for the event

multival_columns:

	event_id
	event_data : event_data

sql:

	select server_id, event_id, created_date, status, event, event_data from (
	select rhnserverhistory.server_id,
		rhnserverhistory.id as event_id,
		to_char(rhnserverhistory.created, 'YYYY-MM-DD HH24:MI:SS') as created_date,
		rhnserverhistory.created as created_raw_date,
		'D' || 'one' as status,
		case when rhnserverhistory.summary like 'Updated system release %' then 'Updated system release'
			else trim(upper(substr(rhnserverhistory.summary, 1, 1)) || substr(rhnserverhistory.summary, 2)) end as event,
		case when summary in ( 'added system entitlement ', 'removed system entitlement ') then details
			when summary like 'Updated system release %' then substr(summary, 24)
		end as event_data
	from rhnserverhistory
	where rhnserverhistory.summary not like 'subscribed to channel %'
		and rhnserverhistory.summary not like 'unsubscribed from channel %'
	) X
	-- where placeholder
	order by server_id, created_raw_date, event_id

07070100000051000081B400000000000000000000000168EFD66400000621000000000000000000000000000000000000003700000000spacewalk-reports/reports/legacy/system-history-errata
synopsis:

	Errata event history

description:

	Errata event history.

columns:

	server_id:i	System identifier
	event_id:i	Event id
	created_date	Date created
	earliest_action	Earliest date this action will occur
	pickup_date	The date/time the action was picked up
	completed_date	The date/time the event was completed
	status		Status of the event
	event		Type of the event
	event_data	Errata identifier

multival_columns:

#	event_id
#	event_data : event_data

sql:

	select server_id, event_id, created_date, earliest_action, pickup_date, completed_date, status, event, event_data from (
	select rhnserveraction.server_id,
		rhnserveraction.action_id as event_id,
		to_char(rhnaction.created, 'YYYY-MM-DD HH24:MI:SS') as created_date,
		rhnaction.created as created_raw_date,
		to_char(rhnaction.earliest_action, 'YYYY-MM-DD HH24:MI:SS') as earliest_action,
		to_char(rhnserveraction.pickup_time, 'YYYY-MM-DD HH24:MI:SS') as pickup_date,
		to_char(rhnserveraction.completion_time, 'YYYY-MM-DD HH24:MI:SS') as completed_date,
		rhnactionstatus.name as status,
		rhnactiontype.name as event,
		rhnerrata.advisory as event_data
	from rhnserveraction, rhnactionerrataupdate, rhnerrata, rhnaction, rhnactiontype, rhnactionstatus
	where rhnserveraction.action_id = rhnactionerrataupdate.action_id
		and rhnactionerrataupdate.errata_id = rhnerrata.id
		and rhnserveraction.action_id = rhnaction.id
		and rhnaction.action_type = rhnactiontype.id
		and rhnserveraction.status = rhnactionstatus.id
	) X
	-- where placeholder
	order by server_id, created_raw_date, event_id

07070100000052000081B400000000000000000000000168EFD664000006EC000000000000000000000000000000000000003A00000000spacewalk-reports/reports/legacy/system-history-kickstart
synopsis:

	Kickstart event history

description:

	Kickstart event history.

columns:

	server_id:i	System identifier
	event_id:i	Event id
	created_date	Date created
	earliest_action	Earliest date this action will occur
	pickup_date	The date/time the action was picked up
	completed_date	The date/time the event was completed
	status		Status of the event
	event		Type of the event
	event_data	Kickstart profile label

multival_columns:

	event_id
	event_data : event_data

sql:

	select server_id, event_id, created_date, earliest_action, pickup_date, completed_date, status, event, event_data from (
	select rhnserveraction.server_id,
		rhnserveraction.action_id as event_id,
		to_char(rhnaction.created, 'YYYY-MM-DD HH24:MI:SS') as created_date,
		rhnaction.created as created_raw_date,
		to_char(rhnaction.earliest_action, 'YYYY-MM-DD HH24:MI:SS') as earliest_action,
		to_char(rhnserveraction.pickup_time, 'YYYY-MM-DD HH24:MI:SS') as pickup_date,
		to_char(rhnserveraction.completion_time, 'YYYY-MM-DD HH24:MI:SS') as completed_date,
		rhnactionstatus.name as status,
		rhnactiontype.name as event,
		(
			select distinct rhnksdata.label
			from rhnkickstartsessionhistory, rhnkickstartsession, rhnksdata
			where rhnserveraction.action_id = rhnkickstartsessionhistory.action_id
				and rhnkickstartsessionhistory.kickstart_session_id = rhnkickstartsession.id
				and rhnkickstartsession.kickstart_id = rhnksdata.id
		) as event_data
		from rhnserveraction, rhnaction, rhnactiontype, rhnactionstatus
	where rhnserveraction.action_id = rhnaction.id
		and rhnaction.action_type = rhnactiontype.id
		and rhnserveraction.status = rhnactionstatus.id
		and rhnactiontype.label like 'kickstart.%'
	) X
	-- where placeholder
	order by server_id, created_raw_date, event_id

07070100000053000081B400000000000000000000000168EFD66400000817000000000000000000000000000000000000003900000000spacewalk-reports/reports/legacy/system-history-packages
synopsis:

	Package event history

description:

	Package event history.

columns:

	server_id:i	System identifier
	event_id:i	Event id
	created_date	Date created
	earliest_action	Earliest date this action will occur
	pickup_date	The date/time the action was picked up
	completed_date	The date/time the event was completed
	status		Status of the event
	event		Type of the event
	event_data	Package name, version, and release

multival_columns:

	event_id
	event_data : event_data

sql:

	select server_id, event_id, created_date, earliest_action, pickup_date, completed_date, status, event, event_data from (
	select rhnserveraction.server_id,
		rhnserveraction.action_id as event_id,
		to_char(rhnaction.created, 'YYYY-MM-DD HH24:MI:SS') as created_date,
		rhnaction.created as created_raw_date,
		to_char(rhnaction.earliest_action, 'YYYY-MM-DD HH24:MI:SS') as earliest_action,
		to_char(rhnserveraction.pickup_time, 'YYYY-MM-DD HH24:MI:SS') as pickup_date,
		to_char(rhnserveraction.completion_time, 'YYYY-MM-DD HH24:MI:SS') as completed_date,
		rhnactionstatus.name as status,
		case when rhnactiontype.name = 'Package Install' and rhnactionpackage.parameter = 'upgrade' then 'Package Upgrade'
			else rhnactiontype.name end as event,
		rhnpackagename.name
				|| case when rhnpackageevr.id is not null then '-' || evr_t_as_vre_simple(rhnpackageevr.evr) end
				|| case when rhnpackagearch.id is not null then '.' || rhnpackagearch.label end
			as event_data
	from rhnserveraction, rhnactionpackage
		left outer join rhnpackageevr
			on rhnactionpackage.evr_id = rhnpackageevr.id
		left outer join rhnpackagearch
			on rhnactionpackage.package_arch_id = rhnpackagearch.id
		, rhnpackagename, rhnaction, rhnactiontype, rhnactionstatus
	where rhnserveraction.action_id = rhnactionpackage.action_id
		and rhnactionpackage.name_id = rhnpackagename.id
		and rhnserveraction.action_id = rhnaction.id
		and rhnaction.action_type = rhnactiontype.id
		and rhnserveraction.status = rhnactionstatus.id
	) X
	-- where placeholder
	order by server_id, created_raw_date, event_id

07070100000054000081B400000000000000000000000168EFD66400000607000000000000000000000000000000000000003500000000spacewalk-reports/reports/legacy/system-history-scap
synopsis:

	OpenSCAP event history

description:

	OpenSCAP event history.

columns:

	server_id:i	System identifier
	event_id:i	Event id
	created_date	Date created
	earliest_action	Earliest date this action will occur
	pickup_date	The date/time the action was picked up
	completed_date	The date/time the event was completed
	status		Status of the event
	event		Type of the event
	event_data	Identifier of xccdf testresult

multival_columns:

sql:
	select server_id, event_id, created_date, earliest_action, pickup_date, completed_date, status, event, event_data from (
	select rhnserveraction.server_id,
		rhnserveraction.action_id as event_id,
		to_char(rhnaction.created, 'YYYY-MM-DD HH24:MI:SS') as created_date,
		rhnaction.created as created_raw_date,
		to_char(rhnaction.earliest_action, 'YYYY-MM-DD HH24:MI:SS') as earliest_action,
		to_char(rhnserveraction.pickup_time, 'YYYY-MM-DD HH24:MI:SS') as pickup_date,
		to_char(rhnserveraction.completion_time, 'YYYY-MM-DD HH24:MI:SS') as completed_date,
		rhnactionstatus.name as status,
		rhnactiontype.name as event,
		rhnxccdftestresult.identifier as event_data
	from rhnserveraction, rhnaction, rhnactiontype, rhnactionstatus, rhnactionscap, rhnxccdftestresult
	where rhnserveraction.action_id = rhnaction.id
		and rhnaction.action_type = rhnactiontype.id
		and rhnserveraction.status = rhnactionstatus.id
		and rhnactionscap.action_id = rhnaction.id
		and rhnxccdftestresult.action_scap_id = rhnactionscap.id
	) X
	-- where placeholder
	order by server_id, created_raw_date, event_id
07070100000055000081B400000000000000000000000168EFD66400000383000000000000000000000000000000000000003900000000spacewalk-reports/reports/legacy/system-md5-certificates
synopsis:

	Systems with certificate containing MD5 checksum

description:

	List of registereted systems which use certificate (/etc/sysconfig/rhn/systemid)
	with an MD5 checksum

columns:

	system_id	System ID
	system_name	System name
	organization_id	Organization ID
	last_checkin	Last check of the system

sql:

	select * from (
	select rhnServer.id as system_id,
		rhnServer.name as system_name,
		rhnServer.org_id as organization_id,
		rhnServerInfo.checkin as last_checkin
	from rhnServer
		join rhnServerInfo on rhnServer.id=rhnServerInfo.server_id,
		(
			select cast(coalesce(value, default_value) as integer) as thresh from rhnConfiguration
			where key = 'SYSTEM_CHECKIN_THRESHOLD'
		) C
	where rhnServerInfo.checkin >= current_timestamp - numtodsinterval(
	C.thresh * 86400, 'second') and
	length(rhnServer.secret) = 32
	) X
	-- where placeholder
	order by system_id, organization_id

07070100000056000081B400000000000000000000000168EFD66400000420000000000000000000000000000000000000003B00000000spacewalk-reports/reports/legacy/system-packages-installed
synopsis:

	Packages installed on systems

description:

	List all packages for all systems across whole spacewalk

columns:

	system_id	System id
	org_id	Id of organization system belongs to
	package_name	Name of the package
	package_epoch	Epoch of the package
	package_version	Version of the package
	package_release	Release of the package
	package_arch	Architecture of the package

sql:

	select * from (
	select rhnServer.id as system_id,
		rhnServer.org_id as org_id,
		rhnPackageName.name as package_name,
		rhnPackageEvr.epoch as package_epoch,
		rhnPackageEvr.version as package_version,
		rhnPackageEvr.release as package_release,
		rhnPackageArch.label as package_arch
	from rhnServer
		join rhnServerPackage on rhnServer.id=rhnServerPackage.server_id
		join rhnPackageName on rhnServerPackage.name_id=rhnPackageName.id
		join rhnPackageEvr on rhnServerPackage.evr_id=rhnPackageEvr.id
		join rhnPackageArch on rhnServerPackage.package_arch_id=rhnPackageArch.id
	) X
	-- where placeholder
	order by system_id, org_id, package_name, package_name

07070100000057000081B400000000000000000000000168EFD66400001355000000000000000000000000000000000000003100000000spacewalk-reports/reports/legacy/system-profiles
synopsis:

	System profile report

description:

	List of systems registered to the server, together with
	software and system group information.

columns:

	server_id:i	                System identifier
	profile_name	            Profile name, as stored on server
	hostname	                Hostname, as reported by the system
    description                 System description
	organization_id:i	        Organization id
	organization_name	        Organization name
	base_channel_id:i 	        Base channel id to which the system is registered
	base_channel_label 	        Base channel to which the system is registered
	child_channel_id:i 	        List of child channel ids to which the system is registered
	child_channel_label	        List of child channels to which the system is registered
	system_group_id:i	        List of system group ids to which the system belongs
	system_group		        List of system group to which the system belongs
    release                     Release of the system
	architecture		        Architecture of the system
	virtual_host:i              System identifier of virtual host (own system identifier in case of host)
	virtual_guest:i		        System identifier of virtual guests, if system is a host
	is_virtualized	            Information whether system is virtualized or not
	virt_type                   System virtualization type
	minion_id                   Minion ID, as reported by the system
	machine_id                  Machine ID of the system if available

multival_columns:

	server_id
	child_channel_id : child_channel_id
	child_channel_label : child_channel_label
	system_group_id : system_group_id
	system_group : system_group
	virtual_guest : virtual_guest

sql:

	select server_id, profile_name, hostname, description,
        organization_id, organization_name,
        base_channel_id, base_channel_label,
        child_channel_id, child_channel_label,
        system_group_id, system_group,
        release, architecture,
        virtual_host, virtual_guest, is_virtualized, virt_type,
        minion_id, machine_id
	from (
	select rhnServer.id as server_id, rhnServer.name as profile_name,
		rhnServer.hostname, suseMinionInfo.minion_id, rhnServer.machine_id,
        rhnServer.description,
        CASE WHEN rhnChannel.parent_channel IS NULL THEN rhnChannel.id ELSE NULL END AS base_channel_id,
        CASE WHEN rhnChannel.parent_channel IS NULL THEN NULL ELSE rhnChannel.id END AS child_channel_id,
        CASE WHEN rhnChannel.parent_channel IS NULL THEN rhnChannel.label ELSE NULL END AS base_channel_label,
        CASE WHEN rhnChannel.parent_channel IS NULL THEN NULL ELSE rhnChannel.label END AS child_channel_label,
		group_data.server_group_id as system_group_id,
		group_data.name as system_group,
        rhnServer.org_id as organization_id,
		(select name from web_customer where rhnServer.org_id = web_customer.id) as organization_name,
        rhnServer.release,
		(select rhnServerArch.name from rhnServerArch where rhnServer.server_arch_id = rhnServerArch.id) as architecture,
		vi.virtual_system_id as virtual_guest,
		(select distinct host_system_id from rhnVirtualInstance where uuid is not null and host_system_id = rhnServer.id or virtual_system_id = rhnServer.id and host_system_id is not null) as virtual_host,
		(case when (select rhnVirtualInstance.virtual_system_id from rhnVirtualInstance where rhnVirtualInstance.virtual_system_id=rhnServer.id) is null then 'No' else 'Yes' end
) as is_virtualized,
		(select rvit.name from rhnVirtualInstance rvi inner join rhnVirtualInstanceInfo rvii on rvi.id = rvii.instance_id inner join rhnVirtualInstanceType rvit on rvii.instance_type = rvit.id where rvi.virtual_system_id = rhnServer.id) as virt_type
	from rhnServer left outer join
		(
		select server_id, rsna4.address, rsna6.address
		from rhnservernetinterface rsni
		left join rhnServerNetAddress4 rsna4
		on rsni.id = rsna4.interface_id
		left join rhnServerNetAddress6 rsna6
		on rsni.id = rsna6.interface_id
		where id in (
			select min(id)
			from rhnservernetinterface
			where is_primary = 'Y'
			group by server_id
			)
		) netinfos on rhnServer.id = netinfos.server_id
		left outer join rhnServerChannel on rhnServer.id = rhnServerChannel.server_id
		left outer join rhnChannel on rhnServerChannel.channel_id = rhnChannel.id
		left outer join rhnVirtualInstance vi on vi.host_system_id = rhnServer.id and uuid is not null
		left outer join
		(
		select rhnServerGroupMembers.server_id, rhnServerGroupMembers.server_group_id, rhnServerGroup.name
		from rhnServerGroupMembers left outer join rhnServerGroup
			on rhnServerGroupMembers.server_group_id = rhnServerGroup.id
		where rhnServerGroup.group_type is null
		) group_data on rhnServer.id = group_data.server_id
		left outer join suseMinionInfo on rhnServer.id = suseMinionInfo.server_id
	) X
	-- where placeholder
	order by organization_id, server_id, base_channel_id,
		system_group_id,
		virtual_host
07070100000058000081B400000000000000000000000168EFD6640000083E000000000000000000000000000000000000002700000000spacewalk-reports/reports/legacy/users
synopsis:

	Users in the system

description:

	List of all users for all organizations, with their details
	and roles.

columns:

	organization_id:i	Organization identifier
	organization		Organization name
	user_id:i		Internal user id
	username		User name / login
	last_name		Last name
	first_name		First name(s)
	position		Position of the user
	email			Email address
	role			Roles assigned to the user
	creation_time		Date and time when the user was created
	last_login_time		When the user last accessed the system
	active			String enabled or disabled

multival_columns:

	organization_id
	user_id
	role : role

sql:

	select * from (
	select web_contact.org_id as organization_id,
		web_customer.name as organization,
		web_contact.id as user_id,
		login as username,
		web_user_personal_info.last_name,
		web_user_personal_info.first_names as first_name,
		web_user_personal_info.title as position,
		web_user_personal_info.email,
		rhnUserGroupType.name as role,
		to_char(web_contact.created, 'YYYY-MM-DD HH24:MI:SS') as creation_time,
		to_char(rhnUserInfo.last_logged_in, 'YYYY-MM-DD HH24:MI:SS') as last_login_time,
		nvl( ( select distinct wccs.label
			from rhnWebContactChangeLog wccl, rhnWebContactChangeState wccs
			where wccl.change_state_id = wccs.id
				and wccl.web_contact_id = web_contact.id
				and wccl.date_completed = (
					select max(wccl_exists.date_completed)
					from rhnWebContactChangeLog wccl_exists
                                        where wccl.web_contact_id = wccl_exists.web_contact_id
				)
			),'enabled') as active
	from web_contact left outer join rhnUserGroupMembers
		on web_contact.id = rhnUserGroupMembers.user_id
		left outer join rhnUserGroup
		on rhnUserGroupMembers.user_group_id = rhnUserGroup.id
		left outer join rhnUserGroupType
		on rhnUserGroup.group_type = rhnUserGroupType.id
		, web_customer, web_user_personal_info,
		rhnUserInfo
	where web_contact.org_id = web_customer.id
		and web_contact.id = web_user_personal_info.web_user_id
		and web_contact.id = rhnUserInfo.user_id
	) X
	-- where placeholder
	order by organization_id, user_id, role

07070100000059000081B400000000000000000000000168EFD6640000089E000000000000000000000000000000000000002B00000000spacewalk-reports/reports/legacy/users-md5
synopsis:

	Users in the system using MD5 encrypted passwords

description:

	List of all users for all organizations which use
	MD5 encrypted passwords, with their details and roles.

columns:

	organization_id:i	Organization identifier
	organization		Organization name
	user_id:i		Internal user id
	username		User name / login
	last_name		Last name
	first_name		First name(s)
	position		Position of the user
	email			Email address
	role			Roles assigned to the user
	creation_time		Date and time when the user was created
	last_login_time		When the user last accessed the system
	active			String enabled or disabled

multival_columns:

	organization_id
	user_id
	role : role

sql:

	select * from (
	select web_contact.org_id as organization_id,
		web_customer.name as organization,
		web_contact.id as user_id,
		login as username,
		web_user_personal_info.last_name,
		web_user_personal_info.first_names as first_name,
		web_user_personal_info.title as position,
		web_user_personal_info.email,
		rhnUserGroupType.name as role,
		to_char(web_contact.created, 'YYYY-MM-DD HH24:MI:SS') as creation_time,
		to_char(rhnUserInfo.last_logged_in, 'YYYY-MM-DD HH24:MI:SS') as last_login_time,
		nvl( ( select distinct wccs.label
			from rhnWebContactChangeLog wccl, rhnWebContactChangeState wccs
			where wccl.change_state_id = wccs.id
				and wccl.web_contact_id = web_contact.id
				and wccl.date_completed = (
					select max(wccl_exists.date_completed)
					from rhnWebContactChangeLog wccl_exists
                                        where wccl.web_contact_id = wccl_exists.web_contact_id
				)
			),'enabled') as active
	from web_contact left outer join rhnUserGroupMembers
		on web_contact.id = rhnUserGroupMembers.user_id
		left outer join rhnUserGroup
		on rhnUserGroupMembers.user_group_id = rhnUserGroup.id
		left outer join rhnUserGroupType
		on rhnUserGroup.group_type = rhnUserGroupType.id
		, web_customer, web_user_personal_info,
		rhnUserInfo
	where web_contact.org_id = web_customer.id
		and web_contact.id = web_user_personal_info.web_user_id
		and web_contact.id = rhnUserInfo.user_id
	and web_contact.password like '$1$%'
	) X
	-- where placeholder
	order by organization_id, user_id

0707010000005A000081B400000000000000000000000168EFD66400000842000000000000000000000000000000000000002F00000000spacewalk-reports/reports/legacy/users-systems
synopsis:

	Systems administered by individual users

description:

	List of systems that users can administer.

columns:

	organization_id:i	Organization identifier
	user_id:i		Internal user id
	username		User name / login
	server_id:i		System identifier
	group			Group through the user has access to the system
	admin_access:i		1 if the user has access by being org administrator

multival_columns:

	organization_id
	user_id
	server_id
	group : group

# adapted query available_to_uid
sql:

	select * from (
	select organization_id, web_contact_adm.user_id, username, server_id, group_name as "GROUP", admin_access
	from (
		select web_contact.org_id as organization_id,
			web_contact.id as user_id,
			login as username,
			case when web_contact_admin.user_id is not null then 1 else null end as admin_access
		from web_contact left outer join (
			select rhnUserGroupMembers.user_id
			from rhnUserGroupMembers, rhnUserGroup, rhnUserGroupType
			where rhnUserGroupMembers.user_group_id = rhnUserGroup.id
				and rhnUserGroup.group_type = rhnUserGroupType.id
				and rhnUserGroupType.label = 'org_admin'
			) web_contact_admin
		on web_contact.id = web_contact_admin.user_id
	) web_contact_adm left outer join (
		select 1 as is_admin, web_contact.id as user_id, rhnServer.id as server_id, null as group_name
		from web_contact, rhnServer
		where web_contact.org_id = rhnServer.org_id
		union all
		select 0 as is_admin,
			rhnUserServerGroupPerms.user_id, rhnServerGroupMembers.server_id, rhnServerGroup.name as group_name
		from rhnUserServerGroupPerms, rhnServerGroupMembers, rhnServerGroup
		where rhnUserServerGroupPerms.server_group_id = rhnServerGroupMembers.server_group_id
			and rhnUserServerGroupPerms.server_group_id = rhnServerGroup.id
		) rhn_contact_server_group
		on ( case when web_contact_adm.admin_access is null then 0 else web_contact_adm.admin_access end ) = rhn_contact_server_group.is_admin
		and web_contact_adm.user_id = rhn_contact_server_group.user_id
	where rhn_contact_server_group.server_id is not null
	) X
	-- where placeholder
	order by organization_id, user_id, server_id

0707010000005B000081FD00000000000000000000000168EFD66400004BC8000000000000000000000000000000000000002300000000spacewalk-reports/spacewalk-report#!/usr/bin/python3 -u
# pylint: disable=missing-module-docstring,invalid-name
#
# Copyright (c) 2008--2015 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.
#

import sys
from spacewalk.common.rhnConfig import CFG, initCFG


# pylint: disable-next=invalid-name
def systemExit(code, msgs=None):
    """exit with message and code"""
    if msgs:
        if type(msgs) not in [type([]), type(())]:
            msgs = (msgs,)
        for msg in msgs:
            sys.stderr.write(str(msg) + "\n")
    sys.exit(code)


# pylint: disable-next=wrong-import-position
import csv
# pylint: disable-next=wrong-import-position
from optparse import Option, OptionParser
# pylint: disable-next=wrong-import-position
import re
# pylint: disable-next=wrong-import-position
import errno


sys.path.append("/usr/share/spacewalk")
# pylint: disable-next=wrong-import-position
import reports

try:
    # pylint: disable-next=ungrouped-imports
    from spacewalk.server import rhnSQL
except KeyboardInterrupt:
    systemExit(-1, "\nUser interrupted process.")


# pylint: disable-next=invalid-name,redefined-outer-name
def getClause(clause, word):
    """get clause and column from swith"""
    # pylint: disable-next=consider-using-f-string
    prefix = "--%s-" % clause
    # pylint: disable-next=consider-using-f-string
    assert word.startswith(prefix), "%s is not prefix of %s" % (prefix, word)
    return clause, word[len(prefix) :]


# pylint: disable-next=invalid-name
def getDataDir(reportdb):
    if reportdb:
        return "data"
    else:
        return "legacy"


# pylint: disable-next=invalid-name
def getDatabaseType(reportdb):
    if reportdb:
        return "reporting database"
    else:
        return "legacy"


# pylint: disable-next=invalid-name
def processCommandline(argv):
    """process the commandline"""
    # pylint: disable-next=invalid-name
    optionsTable = [
        Option(
            "--multival-on-rows",
            action="store_true",
            dest="multivalonrows",
            help="if there are multiple values for certain field, repeat the rows",
        ),
        Option(
            "--multival-separator",
            action="store",
            dest="multivalseparator",
            default=";",
            help="if there are multiple values for certain field, separate them with this string"
            " (unless --multival-on-rows)",
        ),
        Option(
            "--info",
            action="store_true",
            help="print synopsis of the report in the list of report, or description of individual reports specified",
        ),
        Option(
            "--list-fields",
            action="store_true",
            dest="listfields",
            help="list fields of the report instead of running the report",
        ),
        Option(
            "--list-fields-info",
            action="store_true",
            dest="listfieldsinfo",
            help="as --list-fields but also prints description for each column",
        ),
        # This '<column-id>' is here just so optparse can generate nice help message,
        # parsing logic is couple of lines lower...
        Option(
            "--where-<column-id>",
            action="store",
            metavar="VALUE",
            dest="_where_trap",
            help="limit the output to records where column-id has value VALUE",
        ),
        Option(
            "--ne-where-<column-id>",
            action="store",
            metavar="VALUE",
            dest="_where_trap",
            help="limit the output to records where column-id has value not equal to VALUE",
        ),
        Option(
            "--le-where-<column-id>",
            action="store",
            metavar="VALUE",
            dest="_where_trap",
            help="limit the output to records where column-id has value less than or equal to VALUE",
        ),
        Option(
            "--ge-where-<column-id>",
            action="store",
            metavar="VALUE",
            dest="_where_trap",
            help="limit the output to records where column-id has value greater than or equal to VALUE",
        ),
        Option(
            "--like-<column-id>",
            action="store",
            metavar="VALUE",
            dest="_like_trap",
            help="limit the output to records where column-id has value like VALUE (string only)",
        ),
        Option(
            "-p",
            "--param",
            action="append",
            metavar="PARAM=VALUE",
            dest="params",
            help="Parameter value to pass to the report, overriding the default.",
        ),
        Option(
            "--timezone",
            action="store",
            type="str",
            dest="timezone",
            help="set timezone for all dates reported to custom one instead of UTC",
        ),
        Option(
            "--legacy-report",
            action="store_false",
            dest="use_reportdb",
            default=True,
            help="use the legacy SQL statement instead of the reporting database",
        ),
    ]

    # pylint: disable-next=invalid-name
    optionParser = OptionParser(
        # pylint: disable-next=consider-using-f-string
        usage="usage: %s [options] [report_name]" % sys.argv[0],
        option_list=optionsTable,
    )

    i = 0
    unused = []

    # where[column][clause].append(value)
    # pylint: disable-next=redefined-outer-name
    where = {}

    while i < len(argv):
        # pylint: disable-next=redefined-outer-name
        clause = None
        # pylint: disable-next=redefined-outer-name
        column = None
        rest = None
        # pylint: disable-next=redefined-outer-name
        for x in ["where", "ne-where", "le-where", "ge-where", "like"]:
            # pylint: disable-next=consider-using-f-string
            if argv[i].startswith("--%s-" % x):
                clause, rest = getClause(x, argv[i])
                break
            # pylint: disable-next=consider-using-f-string,consider-using-f-string
            elif argv[i] == "--%s" % x or argv[i].startswith("--%s=" % x):
                # pylint: disable-next=consider-using-f-string
                optionParser.error("no such option: %s" % argv[i])
        else:
            unused.append(argv[i])
            i += 1
            continue
        try:
            column, value = rest.split("=", 1)
        except ValueError:
            if i + 1 >= len(argv):
                # pylint: disable-next=consider-using-f-string
                optionParser.error("option %s has to have a parameter" % argv[i])
            column = rest
            value = argv[i + 1]
            i += 1
        if column == "":
            optionParser.error("<column-id> is required")
        if column == "<column-id>":
            optionParser.error(
                "use actual column-id in the --where-<column-id> parameter"
            )

        column = column.replace("-", "_")

        # where[column][clause].append(value)
        where.setdefault(column, {}).setdefault(clause, []).append(value)

        i += 1

    # pylint: disable-next=redefined-outer-name
    options, args = optionParser.parse_args(unused)

    sys.argv[1:] = args

    if not options.timezone:
        options.timezone = "UTC"

    return options, where


# pylint: disable-next=invalid-name,redefined-outer-name
def __field_str(v):
    if not isinstance(v, memoryview):
        return v
    try:
        return v.tobytes().decode()
    # pylint: disable-next=bare-except
    except:
        return "<binary data>"
    return v


if __name__ == "__main__":
    options, where = processCommandline(sys.argv[1:])
    initCFG("server.satellite")

    reportdb_configured = not CFG.REPORT_DB_NAME is None

    if not reportdb_configured and options.use_reportdb:
        sys.stderr.write(
            "Warning: Reporting database is not configured. Fallback to legacy reports\n"
        )
        options.use_reportdb = False

    # pylint: disable-next=invalid-name
    dataDir = getDataDir(options.use_reportdb)

    try:
        if len(sys.argv) > 2:
            systemExit(-5, "Only one report name expected.")
        if len(sys.argv) > 1:
            report_name = sys.argv[1]

            # Convert the parameters into a dict
            params = {}
            if options.params is not None:
                for param_value in options.params:
                    matcher = re.match("^([^=]+)=([^=]+)$", param_value)
                    if not matcher:
                        systemExit(-5, "Invalid parameter value: " + param_value)
                    params[matcher.group(1)] = matcher.group(2)

            try:
                report = reports.report(report_name, dataDir, params)
            except reports.spacewalk_unknown_report:
                if not reportdb_configured:
                    # if reportdb is not configured, we have already looked for the legacy report and it's missing.
                    # This means we do not have an alternative.
                    # pylint: disable-next=consider-using-f-string
                    systemExit(-4, "Unknown report [%s]." % report_name)

                # Check if the other type of report is available
                options.use_reportdb = not options.use_reportdb
                # pylint: disable-next=invalid-name
                dataDir = getDataDir(options.use_reportdb)

                try:
                    report = reports.report(report_name, dataDir, params)
                    sys.stderr.write(
                        # pylint: disable-next=consider-using-f-string
                        "Warning: %s does not exists as a %s report. Using the %s one\n"
                        % (
                            report_name,
                            getDatabaseType(not options.use_reportdb),
                            getDatabaseType(options.use_reportdb),
                        )
                    )
                except reports.spacewalk_unknown_report:
                    # pylint: disable-next=consider-using-f-string
                    systemExit(-4, "Unknown report [%s]." % report_name)

            need_exit = None
            if options.info:
                if report.synopsis is not None:
                    print(report.synopsis)
                else:
                    # pylint: disable-next=consider-using-f-string
                    print("No synopsis for report %s." % report_name)
                if report.description is not None:
                    print()
                    print(report.description)
                need_exit = True

            if options.listfields or options.listfieldsinfo:
                if options.info:
                    print()
                    print("Fields in the report:")
                    print()

                for c in report.columns:
                    text = c
                    if options.info:
                        # pylint: disable-next=consider-using-f-string
                        text = "    %s" % c
                    if options.listfieldsinfo and c in report.column_descriptions:
                        # pylint: disable-next=consider-using-f-string
                        text = "%s: %s" % (text, report.column_descriptions[c])
                    print(text)
                need_exit = True

            if need_exit:
                sys.exit(0)

            the_sql_where = []
            the_dict_where = {}
            pi = 1
            # pylint: disable-next=consider-using-dict-items
            for column in where:
                if column not in report.columns:
                    systemExit(
                        -6,
                        # pylint: disable-next=consider-using-f-string
                        "Unknown column [%s] in report [%s]." % (column, report_name),
                    )
                for v in (val for vals in where[column].values() for val in vals):
                    if report.column_types[column] == "i" and not re.match(
                        "^[0-9]+$", v
                    ):
                        systemExit(
                            -7,
                            # pylint: disable-next=consider-using-f-string
                            "Column [%s] in report [%s] only accepts integer value."
                            % (column, report_name),
                        )

                for clause, values in where[column].items():
                    l = []
                    for v in values:
                        # pylint: disable-next=consider-using-f-string
                        l.append(":p%d" % pi)
                        # pylint: disable-next=consider-using-f-string
                        the_dict_where["p%d" % pi] = v
                        pi += 1

                    # Column named "group" can be a little complicated...
                    if column.lower() == "group":
                        # pylint: disable-next=consider-using-f-string
                        column = '"%s"' % column.lower()

                    if clause == "where":
                        # pylint: disable-next=consider-using-f-string
                        conjunct = "%s in ( %s )" % (column, ", ".join(l))
                    elif clause == "ne-where":
                        # pylint: disable-next=consider-using-f-string
                        conjunct = "%s not in ( %s )" % (column, ", ".join(l))
                    elif clause == "le-where":
                        # pylint: disable-next=consider-using-f-string
                        conjunct = " and ".join("%s <= %s" % (column, v) for v in l)
                    elif clause == "ge-where":
                        # pylint: disable-next=consider-using-f-string
                        conjunct = " and ".join("%s >= %s" % (column, v) for v in l)
                    elif clause == "like":
                        # pylint: disable-next=consider-using-f-string
                        conjunct = " and ".join("%s like %s" % (column, v) for v in l)
                    else:
                        assert False, "Unsupported clause"

                    the_sql_where.append(conjunct)

            rhnSQL.initDB(reportdb=options.use_reportdb)

            writer = csv.writer(sys.stdout, lineterminator="\n")

            the_sql = report.sql

            if the_sql_where:
                the_sql = the_sql.replace(
                    # pylint: disable-next=consider-using-f-string
                    "-- where placeholder", "where %s" % " and ".join(the_sql_where)
                )

            tz = rhnSQL.prepare("set session timezone to :tz")
            tz.execute(tz=options.timezone)

            h = rhnSQL.prepare(the_sql)
            h.execute(
                **dict(tuple(report.params.items()) + tuple(the_dict_where.items()))
            )

            db_columns = [x[0].lower() for x in h.description]
            if db_columns != report.columns:
                systemExit(
                    -3,
                    # pylint: disable-next=consider-using-f-string
                    "Columns in report spec and in the database do not match:\nexpected %s\n     got %s"
                    % (report.columns, db_columns),
                )
            writer.writerow(report.columns)

            row = h.fetchone()
            prevrow = None
            outrow = None
            multival_dupes = {}
            while row is not None:
                # pylint: disable-next=unnecessary-lambda
                row = list(map(lambda v: __field_str(v), row))
                if options.multivalonrows or not report.multival_column_names.keys():
                    writer.writerow(row)
                    row = h.fetchone()
                    continue

                if outrow is not None:
                    for m in report.multival_columns_stop:
                        # pylint: disable-next=unsubscriptable-object
                        if prevrow[m] != row[m]:
                            writer.writerow(outrow)
                            outrow = None
                            break

                if outrow is not None:
                    # pylint: disable-next=consider-iterating-dictionary
                    for m in report.multival_columns_reverted.keys():
                        # pylint: disable-next=unsubscriptable-object
                        if prevrow[m] != row[m]:
                            if m not in multival_dupes:
                                multival_dupes[m] = {}
                                # store the dupe value from previous row
                                # pylint: disable-next=unsubscriptable-object
                                multival_dupes[m][prevrow[m]] = 1
                            if not row[m] in multival_dupes[m]:
                                outrow[m] = (
                                    str(outrow[m])
                                    + options.multivalseparator
                                    + str(row[m])
                                )
                                multival_dupes[m][row[m]] = 1
                            else:
                                # check another multival
                                continue

                if outrow is None:
                    outrow = []
                    for x in row:
                        if x is None:
                            outrow.append(None)
                        else:
                            outrow.append(str(x))
                    multival_dupes = {}

                prevrow = row
                row = h.fetchone()

            if outrow is not None:
                writer.writerow(outrow)
        else:
            for report_name in sorted(reports.available_reports(dataDir)):
                if options.info:
                    synopsis = ""
                    try:
                        # pylint: disable-next=no-value-for-parameter,no-value-for-parameter
                        report = reports.report(report_name)
                        synopsis = report.synopsis
                    # pylint: disable-next=bare-except
                    except:
                        # pylint: disable-next=pointless-statement
                        None
                    # pylint: disable-next=consider-using-f-string
                    print("%s: %s" % (report_name, synopsis))
                else:
                    print(report_name)

    except KeyboardInterrupt:
        systemExit(-1, "\nUser interrupted process.")
    except (rhnSQL.SQLError, rhnSQL.SQLSchemaError, rhnSQL.SQLConnectError) as e:
        # really a stub for better exception handling in the future.
        sys.stderr.write("SQL error occurred, traceback follows...\n")
        raise
    except IOError as e:
        if e.errno == errno.EPIPE:
            sys.exit(0)
        else:
            raise
0707010000005C000081B400000000000000000000000168EFD6640000205D000000000000000000000000000000000000002800000000spacewalk-reports/spacewalk-report.sgml<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V3.1//EN">

<refentry>

<RefMeta>
<RefEntryTitle>spacewalk-report</RefEntryTitle><manvolnum>8</manvolnum>
</RefMeta>

<RefNameDiv>
<RefName><command>spacewalk-report</command></RefName>
<RefPurpose>
Generate reports from Spacewalk server in csv format
</RefPurpose>
</RefNameDiv>

<RefSynopsisDiv>
<Synopsis>
    <cmdsynopsis>
        <command>spacewalk-report</command>
        <arg>--info</arg>
    </cmdsynopsis>
    <cmdsynopsis>
        <command>spacewalk-report</command>
        <sbr>
        <group>
          <arg>--multival-on-rows</arg>
          <arg>--multival-separator=<replaceable>separator-string</replaceable></arg>
        </group>
        <sbr>
        <arg>--info</arg>
        <sbr>
        <group><arg>--list-fields</arg><arg>--list-fields-info</arg></group>
        <sbr>
        <arg>--where-<replaceable>column-id</replaceable>=<replaceable>VALUE</replaceable></arg>
        <sbr>
        <arg>--ne-where-<replaceable>column-id</replaceable>=<replaceable>VALUE</replaceable></arg>
        <sbr>
        <arg>--le-where-<replaceable>column-id</replaceable>=<replaceable>VALUE</replaceable></arg>
        <sbr>
        <arg>--ge-where-<replaceable>column-id</replaceable>=<replaceable>VALUE</replaceable></arg>
        <sbr>
        <arg>--like-<replaceable>column-id</replaceable>=<replaceable>VALUE</replaceable></arg>
        <sbr>
        <arg>--timezone=<replaceable>VALUE</replaceable></arg>
        <sbr>
        <arg>--legacy-report</arg>
        <sbr>
        <arg choice='plain'><replaceable>report-name</replaceable></arg>
    </cmdsynopsis>
</Synopsis>
</RefSynopsisDiv>

<RefSect1><Title>Description</Title>
<para>
    The <command>spacewalk-report</command> command can be used to
    generate canned reports from Spacewalk server database. The report
    which will be generated is selected by specifying its name as
    a parameter to <command>spacewalk-report</command>.
</para>

<para>
    If the report name is not specified, list of available report
    names is printed, one name per line.
</para>
</RefSect1>

<RefSect1><Title>Options</Title>
<variablelist>
    <varlistentry>
        <term>--info</term>
        <listitem>
            <para>When listing available reports, also print
            synopsis for each report.</para>

            <para>When used with report name specified, print
            synopsis and description for the report, instead
            of running the report.</para>
        </listitem>
    </varlistentry>
    <varlistentry>
        <term>--multival-on-rows</term>
        <listitem>
            <para>If certain field can have multiple values, you can
            use this option to have records for the entity repeated
            in output in the form of cartesian product. By default,
            those multiple values are presented on one row in one
            field, separated by semicolon.</para>
        </listitem>
    </varlistentry>
    <varlistentry>
        <term>--multival-separator=<replaceable>separator-string</replaceable></term>
        <listitem>
            <para>If multiple values are output on one row (the
            default), this option can change the string which
            separates multiple values in one field. The default is
            semicolon.</para>
        </listitem>
    </varlistentry>
    <varlistentry>
        <term>--list-fields</term>
        <listitem>
            <para>Instead of running the report, shows fields that the
            report has, one field name per line.</para>
        </listitem>
    </varlistentry>
    <varlistentry>
        <term>--list-fields-info</term>
        <listitem>
            <para>Instead of running the report, shows fields that the
            report has, one field name per line, and a description of
            that field.</para>
        </listitem>
    </varlistentry>
    <varlistentry>
        <term>--where-<replaceable>column-id</replaceable>=<replaceable>VALUE</replaceable></term>
        <listitem>
            <para>Limit the output to records where column-id has value
            VALUE. It can be used multiple times -- for the same column
            it will select records where the column has any of the
            VALUEs. When different columns are specified, all of them
            have to meet the condition.</para>
        </listitem>
    </varlistentry>
    <varlistentry>
        <term>--ne-where-<replaceable>column-id</replaceable>=<replaceable>VALUE</replaceable></term>
        <listitem>
            <para>Limit the output to records where column-id does not have value
            VALUE. It can be used multiple times -- for the same column
            it will select records where the column does not have any of the
            VALUEs. When different columns are specified, all of them
            have to meet the condition.</para>
        </listitem>
    </varlistentry>
    <varlistentry>
        <term>--le-where-<replaceable>column-id</replaceable>=<replaceable>VALUE</replaceable></term>
        <listitem>
            <para>Limit the output to records where column-id has value
            less than or equal to VALUE. It can be used multiple times -- for the same column
            it will select records where the column is less than or equal to all of the
            VALUEs. When different columns are specified, all of them
            have to meet the condition.</para>
        </listitem>
    </varlistentry>
    <varlistentry>
        <term>--ge-where-<replaceable>column-id</replaceable>=<replaceable>VALUE</replaceable></term>
        <listitem>
            <para>Limit the output to records where column-id has value
            greater than or equal to VALUE. It can be used multiple times -- for the same column
            it will select records where the column is greater than or equal to all of the
            VALUEs. When different columns are specified, all of them
            have to meet the condition.</para>
        </listitem>
    </varlistentry>
    <varlistentry>
        <term>--like-<replaceable>column-id</replaceable>=<replaceable>VALUE</replaceable></term>
        <listitem>
            <para>Limit the output to records where column-id has value
      like VALUE. This applies for string values only. It can be used
      multiple times -- for the same column it will select records
      where the column has any of the VALUEs. When different columns
      are specified, all of them have to meet the condition. Regular
      expressions for like clause are described by SQL standard. Most
      common wildcards are _ for any single character and % for multiple
      occurrences of any character.</para>
        </listitem>
    </varlistentry>
    <varlistentry>
        <term>--param=<replaceable>PARAM</replaceable>=<replaceable>VALUE</replaceable></term>
        <listitem>
            <para>Overwrite the default report parameter value</para>
        </listitem>
    </varlistentry>
    <varlistentry>
        <term>--timezone=<replaceable>VALUE</replaceable></term>
        <listitem>
            <para>As all dates are reported as in UTC timezone, this
      option sets the timezone to the custom one. List of applicable
      timezones may differ depending on your database backend. Common
      examples: CET, Europe/Prague; +7 for Postgresql database backend,
      +07:00 for Oracle one.</para>
        </listitem>
    </varlistentry>
    <varlistentry>
        <term>--legacy-report</term>
        <listitem>
            <para>Use the legacy report definition instead of the one for
            the reporting database.</para>

            <para>Since the introduction of the reporting database, spacewalk-report
            targets by default the reporting database. This leads to some minor
            differences in the structure and the format of the report produced.
            If these differences are problematic, this flag can be used to fall back
            to the old reports which use only the application database.</para>
        </listitem>
    </varlistentry>
</variablelist>
</RefSect1>

<RefSect1><Title>Authors</Title>
<simplelist>
    <member>Jan Pazdziora</member>
    <member>Tomas Kasparek</member>
</simplelist>
</RefSect1>
</RefEntry>

<!--
vim: sw=4
-->
0707010000005D000081B400000000000000000000000168EFD66400002E11000000000000000000000000000000000000002C00000000spacewalk-reports/spacewalk-reports.changes-------------------------------------------------------------------
Tue Jun 17 19:32:57 CEST 2025 - marina.latini@suse.com

- version 5.1.2-0
  * Fix system/listActiveSystems queries (bsc#1242010)

-------------------------------------------------------------------
Mon Oct 14 15:53:11 CEST 2024 - rosuna@suse.com

- version 5.1.1-0
  * Bump version to 5.1.0

-------------------------------------------------------------------
Fri May 03 14:29:21 CEST 2024 - marina.latini@suse.com

- version 5.0.2-0
  * Add reports for Confidential Computing attestation

-------------------------------------------------------------------
Tue Jan 16 08:22:31 CET 2024 - jgonzalez@suse.com

- version 5.0.1-1
  * Bump version to 5.0.0

-------------------------------------------------------------------
Mon Sep 18 14:34:53 CEST 2023 - rosuna@suse.com

- version 4.4.4-1
  * Drop Python2 compatibility (bsc#1212588)

-------------------------------------------------------------------
Wed Dec 14 14:13:25 CET 2022 - jgonzalez@suse.com

- version 4.4.3-1
  * Check if options.params is empty

-------------------------------------------------------------------
Fri Nov 18 15:05:43 CET 2022 - jgonzalez@suse.com

- version 4.4.2-1
  * Stop using web.system_checkin_threshold configuration value
  * Add --param option to overwrite report parameter default value

-------------------------------------------------------------------
Wed Sep 28 11:08:52 CEST 2022 - jgonzalez@suse.com

- version 4.4.1-1
  * Bump version to 4.4.0

-------------------------------------------------------------------
Wed May 04 15:21:53 CEST 2022 - jgonzalez@suse.com

- version 4.3.4-1
  * Executed the reports against the reporting database and added a
    new command line parameter for spacewalk-report to execute the
    legacy reports

-------------------------------------------------------------------
Tue Jan 18 13:58:54 CET 2022 - jgonzalez@suse.com

- version 4.3.3-1
  * Fixes query for system-history report to prevent more than one
    row returned by a subquery with rhnxccdftestresult.identifier
    (bsc#1191192)

-------------------------------------------------------------------
Fri Nov 05 13:52:03 CET 2021 - jgonzalez@suse.com

- version 4.3.2-1
  * Improve performance of inventory report (bsc#1191495)

-------------------------------------------------------------------
Mon Aug 09 11:03:10 CEST 2021 - jgonzalez@suse.com

- version 4.3.1-1
- Bump version to 4.3.0

-------------------------------------------------------------------
Fri Feb 12 14:29:55 CET 2021 - jgonzalez@suse.com

- version 4.2.4-1
- Removed "Software Crashes" feature

-------------------------------------------------------------------
Wed Jan 27 13:05:16 CET 2021 - jgonzalez@suse.com

- version 4.2.3-1
- Fixes no file content in `spacewalk-report config-files`
- Write `<binary data>` placeholder instead of dumping binary data
- Added RHEL and Fedora to the Python3 builds.

-------------------------------------------------------------------
Wed Nov 25 12:23:18 CET 2020 - jgonzalez@suse.com

- version 4.2.2-1
- Added hostname field to system-history report

-------------------------------------------------------------------
Fri Sep 18 11:41:39 CEST 2020 - jgonzalez@suse.com

- version 4.2.1-1
- Update package version to 4.2.0

-------------------------------------------------------------------
Wed Mar 11 10:56:23 CET 2020 - jgonzalez@suse.com

- version 4.1.2-1
- remove oracle backend support

-------------------------------------------------------------------
Wed Nov 27 16:48:43 CET 2019 - jgonzalez@suse.com

- version 4.1.1-1
- Bump version to 4.1.0 (bsc#1154940)

-------------------------------------------------------------------
Wed May 15 15:17:15 CEST 2019 - jgonzalez@suse.com

- version 4.0.5-1
- SPEC cleanup
- Fix shebang for spacewalk-reports when built for Python3 (bsc#1132353)

-------------------------------------------------------------------
Mon Apr 22 12:14:54 CEST 2019 - jgonzalez@suse.com

- version 4.0.4-1
- add makefile and pylint configuration

-------------------------------------------------------------------
Mon Dec 17 14:40:34 CET 2018 - jgonzalez@suse.com

- version 4.0.3-1
- Add support for Python 3 on spacewalk-reports

-------------------------------------------------------------------
Fri Oct 26 10:41:44 CEST 2018 - jgonzalez@suse.com

- version 4.0.2-1
- Add Uyuni URL to package

-------------------------------------------------------------------
Fri Aug 10 15:29:31 CEST 2018 - jgonzalez@suse.com

- version 4.0.1-1
- Bump version to 4.0.0 (bsc#1104034)
- Fix copyright for the package specfile (bsc#1103696)

-------------------------------------------------------------------
Mon Mar 26 09:03:55 CEST 2018 - jgonzalez@suse.com

- version 2.8.4.3-1
- fix error in inventory report (bsc#1083753)

-------------------------------------------------------------------
Mon Mar 05 08:54:25 CET 2018 - jgonzalez@suse.com

- version 2.8.4.2-1
- remove empty clean section from spec (bsc#1083294)

-------------------------------------------------------------------
Wed Feb 28 09:50:49 CET 2018 - jgonzalez@suse.com

- version 2.8.4.1-1
- Sync with upstream

-------------------------------------------------------------------
Fri Feb 02 13:51:44 CET 2018 - jgonzalez@suse.com

- version 2.8.3.2-1
- Improve performance of some queries over the rhnServerNeededCache
  table

-------------------------------------------------------------------
Wed Jan 17 12:55:36 CET 2018 - jgonzalez@suse.com

- version 2.8.3.1-1
- Add machine_id and minion_id to inventory report
- Add machine_id and minion_id to system-profile report
- Bumping package versions for 2.8.

-------------------------------------------------------------------
Tue Nov 28 12:15:45 CET 2017 - jgonzalez@suse.com
 
- version 2.7.5.3-1
- add machine_id and minion_id to system-profiles and inventory
  report (bsc#1054902)
- rhnServerNetwork refactoring (bsc#1063419)

-------------------------------------------------------------------
Wed May 03 16:10:07 CEST 2017 - michele.bologna@suse.com

- version 2.7.5.2-1
- Remove unused imports.

-------------------------------------------------------------------
Fri Mar 31 09:54:38 CEST 2017 - mc@suse.de

- version 2.7.5.1-1
- Add issue date to errata-list-all report
- date is a keyword on oracle

-------------------------------------------------------------------
Tue Mar 07 15:16:04 CET 2017 - mc@suse.de

- version 2.7.4.1-1
- Updated links to github in spec files
- errata-list-all report: add date
- Remove legacy audit logging reports

-------------------------------------------------------------------
Wed Jan 11 16:34:03 CET 2017 - michele.bologna@suse.com

- version 2.7.2.1-1
- Version 2.7.2

-------------------------------------------------------------------
Mon Nov 30 10:52:57 CET 2015 - mc@suse.de

- version 2.5.1.1-1
- align with upstream reports

-------------------------------------------------------------------
Wed Oct 07 14:31:55 CEST 2015 - mc@suse.de

- version 2.5.0.1-1
- replace upstream subscription counting with new subscription
  matching (FATE#311619)
- fix spacewalk-report multival issue
- Adding reports for activation-keys

-------------------------------------------------------------------
Mon Jun 22 15:59:56 CEST 2015 - jrenner@suse.de

- version 2.1.14.9-1
- fix system-currency report (bsc#934957)

-------------------------------------------------------------------
Tue Feb 03 13:24:29 CET 2015 - mc@suse.de

- version 2.1.14.8-1
- Getting rid of Tabs and trailing spaces

-------------------------------------------------------------------
Fri Nov 07 13:00:32 CET 2014 - mc@suse.de

- version 2.1.14.7-1
- improve documentation
- code cleanup

-------------------------------------------------------------------
Fri Sep 12 15:42:56 CEST 2014 - mc@suse.de

- version 2.1.14.6-1
- do not sort multival values within one column to match other
  multival values (in another columns)
- process all the multival values on row

-------------------------------------------------------------------
Tue Jun 17 10:34:11 CEST 2014 - jrenner@suse.de

- version 2.1.14.5-1
- base_channel_id and child_channel_id instead of channel_id in 
  activation_key report
- Added channel- and server-group-ids to activation-keys
- Spacewalk-report fix allows all activation-key info to live in 
  one report
- Added spacewalk-report for systems with extra packages

-------------------------------------------------------------------
Wed May 21 11:04:18 CEST 2014 - mc@suse.de

- version 2.1.14.4-1
- fix issues in spacewalk-report with multival fields

-------------------------------------------------------------------
Fri May 16 12:47:23 CEST 2014 - mc@suse.de

- version 2.1.14.3-1
- Adding reports for activation-keys
- add report for schedule/actions

-------------------------------------------------------------------
Tue May 06 15:01:41 CEST 2014 - mc@suse.de

- version 2.1.14.2-1
- Add report for custom-channels
- Add report on repositories
- Add org-id to channels

-------------------------------------------------------------------
Mon Dec 09 16:47:50 CET 2013 - mc@suse.de

- version 2.1.14.1-1
- switch to 2.1

-------------------------------------------------------------------
Wed Aug 21 15:38:18 CEST 2013 - mc@suse.de

- version 1.7.1.7-1
- spacewalk-reports host-guests shouldn't fail on oracle databases
- add support for sql like predicates into spacewalk-report
- inventory report should now display correct number of errata
- modify description to better explain what these reports do (bnc#833566)
- fix branding (bnc#833566)

-------------------------------------------------------------------
Wed Jun 12 13:34:22 CEST 2013 - mc@suse.de

- version 1.7.1.6-1
- fix of system group reports
- display more meaningful description
- Report for host-guest mappings
- Reports to support enhanced reporting

-------------------------------------------------------------------
Fri Feb 08 11:20:25 CET 2013 - mc@suse.de

- version 1.7.1.5-1
- Add OSAD status report (brc#237581)
- Add report of package upgrades available for systems (brc#768074)
- Add system custom info report (brc#745342)
- Add spacewalk-report inactive-systems RFE (brc#703629)
- Add spacewalk-report system-packages-installed (brc#662773)
- Add additional column in spacewalk-report inventory (brc#745342)

-------------------------------------------------------------------
Thu Jun 21 11:21:20 CEST 2012 - jrenner@suse.de

- version 1.7.1.4-1
- add COPYING file (bnc#764863)

-------------------------------------------------------------------
Thu May 31 10:59:24 CEST 2012 - mc@suse.de

- version 1.7.1.3-1
- require spacewalk-branding
- simplify spec and own directory /usr/share/spacewalk/reports

-------------------------------------------------------------------
Fri Apr 27 16:59:22 CEST 2012 - mc@suse.de

- version 1.7.1.2-1
- Rework reporting to correspond with 0-n rule/ident mapping
- concatenation with null gives null on PostgreSQL, fixing.

-------------------------------------------------------------------
Wed Mar 21 16:55:04 CET 2012 - mc@suse.de

- version 1.7.1.1-1
- Bumping package version

-------------------------------------------------------------------
Mon Sep 19 17:44:42 CEST 2011 - mc@suse.de

- provide reports for SUSE Manager (bnc#673047, FATE#312367)

-------------------------------------------------------------------
Thu Aug 11 15:10:05 CEST 2011 - iartarisi@suse.cz

- fix some imports after move from spacewalk.common

-------------------------------------------------------------------
Sun Jan 30 15:29:51 CET 2011 - mc@suse.de

- backport upstrem fixes

-------------------------------------------------------------------
Wed Sep 15 09:50:26 CEST 2010 - mantel@suse.de

- Initial release of spacewalk-reports

0707010000005E000081B400000000000000000000000168EFD66400000021000000000000000000000000000000000000004500000000spacewalk-reports/spacewalk-reports.changes.agraul.pylint-everything- Allow existing pylint failures
0707010000005F000081B400000000000000000000000168EFD66400000022000000000000000000000000000000000000004200000000spacewalk-reports/spacewalk-reports.changes.agraul.reformat-black- Reformat Python code with black
07070100000060000081B400000000000000000000000168EFD6640000005C000000000000000000000000000000000000004100000000spacewalk-reports/spacewalk-reports.changes.mcalmer.adapt-report- Add new system columns to the Inventory Report
- Fix a typo in the System Hardware Report
07070100000061000081B400000000000000000000000168EFD6640000002E000000000000000000000000000000000000005200000000spacewalk-reports/spacewalk-reports.changes.mcalmer.enhance-reportdb-schema-part2- Add a System Hardware Report (jsc#SUMA-316)
07070100000062000081B400000000000000000000000168EFD66400000020000000000000000000000000000000000000004A00000000spacewalk-reports/spacewalk-reports.changes.mcalmer.fix-changelog-formats- Fix syntax error in changelog
07070100000063000081B400000000000000000000000168EFD66400000A9B000000000000000000000000000000000000002900000000spacewalk-reports/spacewalk-reports.spec#
# spec file for package spacewalk-reports
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2008-2018 Red Hat, Inc.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%if 0%{?suse_version} > 1320 || 0%{?rhel} || 0%{?fedora}
# SLE15 builds on Python 3
%global build_py3   1
%endif
%define pythonX %{?build_py3:python3}%{!?build_py3:python2}

Name:           spacewalk-reports
Version:        5.2.0
Release:        0
Summary:        Script based reporting
License:        GPL-2.0-only
# FIXME: use correct group or remove it, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group:          Applications/Internet
URL:            https://github.com/uyuni-project/uyuni
#!CreateArchive: %{name}
Source0:        https://github.com/spacewalkproject/spacewalk/archive/%{name}-%{version}.tar.gz
Requires:       %{pythonX}
Requires:       spacewalk-branding
BuildRequires:  /usr/bin/docbook2man
BuildArch:      noarch

%description
Script based reporting to retrieve data from Spacewalk server in CSV format.

%prep
%setup -q

%build
%{_bindir}/docbook2man *.sgml

# Fixing shebang for Python 3
%if 0%{?build_py3}
for i in $(find . -type f);
do
    sed -i '1s=^#!/usr/bin/\(python\|env python\)[0-9.]*=#!/usr/bin/python3=' $i;
done
%endif

%install
install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_datadir}/spacewalk
install -d %{buildroot}%{_datadir}/spacewalk/reports/data
install -d %{buildroot}%{_datadir}/spacewalk/reports/legacy
install -d %{buildroot}%{_mandir}/man8
install spacewalk-report %{buildroot}%{_bindir}
install reports.py %{buildroot}%{_datadir}/spacewalk
install -m 644 reports/data/* %{buildroot}%{_datadir}/spacewalk/reports/data
install -m 644 reports/legacy/* %{buildroot}%{_datadir}/spacewalk/reports/legacy
install *.8 %{buildroot}%{_mandir}/man8
chmod -x %{buildroot}%{_mandir}/man8/spacewalk-report.8*

%files
%defattr(-,root,root)
%attr(755,root,root) %{_bindir}/spacewalk-report
%dir %{_datadir}/spacewalk
%{_datadir}/spacewalk/reports.py*
%{_datadir}/spacewalk/reports
%{_mandir}/man8/spacewalk-report.8*
%license COPYING
%if 0%{?suse_version}
%dir %{_datadir}/spacewalk
%endif

%changelog
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!
openSUSE Build Service is sponsored by