1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 from optparse import OptionParser, Option
17 from spacewalk.common.rhnConfig import PRODUCT_NAME
18
19
20 option_parser = OptionParser
21 option = Option
22
23
24
25
27
29 self.optiontable = [
30 option("-d", "--dir", action="store",
31 help="This is the directory that the information that you want to sync gets dumped in."),
32 option("--hard-links", action="store_true", default=0,
33 help="Exported RPM and kickstart are hard linked to original files."),
34 option("--list-channels", action="store_true", default=0,
35 help="List all of the channels that can be exported."),
36 option("--list-steps", action="store_true", default=0,
37 help="List all of the steps that rhn-satellite-exporter takes while exporting data."
38 + " These can be used as values for --step"),
39 option("-c", "--channel", action="append",
40 help="Include this channel in the export."),
41 option("-a", "--all-channels", action="store_true", default=0,
42 help="Export all channels."),
43 option("--start-date", action="store",
44 help="The start date limit that the last modified dates are compared against. "
45 + "Should be in the format 'YYYYMMDDHH24MISS'."),
46 option("--end-date", action="store",
47 help="The end date limit that the last modified dates are compared against. "
48 + "Should be in the format 'YYYYMMDDHH24MISS'."),
49 option("--use-rhn-date", action="store_true",
50 help="Limit exported packages according to the date when they appeared at Red Hat Network."),
51 option("--use-sync-date", action="store_true",
52 help="Limit exported packages according to the date they where pulled into %s." % PRODUCT_NAME),
53 option("--whole-errata", action="store_true",
54 help="Always include package if it belongs to errata which is withing start/end-date range."),
55 option("--make-isos", action="store",
56 help="Create channel dump isos a directory called satellite-isos. Usage: --make-isos=cd or dvd"),
57 option("-p", "--print-configuration", action="store_true", default=0,
58 help="Print the configuration and exit."),
59 option("--print-report", action="store_true", default=0,
60 help="Print the report to the terminal when the export is complete."),
61 option("--step", action="store",
62 help="Export only up to this step."),
63 option("--no-rpms", action="store_true",
64 help="Do not export RPMs."),
65 option("--no-packages", action="store_true",
66 help="Do not export package metadata."),
67 option("--no-errata", action="store_true",
68 help="Do not export errata data."),
69 option("--no-kickstarts", action="store_true",
70 help="Do not export kickstart data."),
71 option("--debug-level", action="store",
72 help="Set the debug level to this value. Overrides the value in rhn.conf."),
73 option("-v", "--verbose", action="store_true",
74 help="Set debug level to 3. Overrides the value in rhn.conf.."),
75 option("--email", action="store_true",
76 help="Email a report of what was exported."),
77 option("--traceback-mail", action="store",
78 help="Alternative email address for --email."),
79 option("--all-orgs", action="store_true",
80 help="Export all orgs."),
81 option("-o", "--org", action="append",
82 help="Include the org with this id in the export."),
83 option("--list-orgs", action="store_true",
84 help="List all orgs that can be exported"),
85 ]
86 self.optionparser = option_parser(option_list=self.optiontable)
87 self.options, self.args = self.optionparser.parse_args()
88 if self.options.verbose and not self.options.debug_level:
89 self.options.debug_level = 3
90
91 for i in self.options.__dict__.keys():
92 if i not in self.__dict__:
93 self.__dict__[i] = self.options.__dict__[i]
94
95 if __name__ == "__main__":
96
97 a = UI()
98 print(str(a.no_errata))
99