| Trees | Indices | Help |
|---|
|
|
1
2 # all the crap that is stored on the rhn side of stuff
3 # updating/fetching package lists, channels, etc
4
5 from up2date_client import up2dateAuth
6 from up2date_client import up2dateErrors
7 from up2date_client import config
8 from up2date_client import rhnserver
9
10 import gettext
11 t = gettext.translation('rhn-client-tools', fallback=True)
12 # Python 3 translations don't have a ugettext method
13 if not hasattr(t, 'ugettext'):
14 t.ugettext = t.gettext
15 _ = t.ugettext
16
17 # heh, dont get much more generic than this...
19 # shrug, use attributes for thetime being
25
27 return self.dict[item]
28
30 self.dict[item] = value
31
34
37
40
43
70
71 # for the gui client that needs to show more info
72 # maybe we should always make this call? If nothing
73 # else, wrapper should have a way to show extended channel info
75
76 channels = []
77 sourceChannels = getChannels(timeout=timeout)
78
79 for sourceChannel in sourceChannels.channels():
80 if sourceChannel['type'] != 'up2date':
81 # FIMXE: kluge since we dont have a good name, maybe be able to fix
82 sourceChannel['name'] = sourceChannel['label']
83 sourceChannel['description'] = "%s channel %s from %s" % (sourceChannel['type'],
84 sourceChannel['label'],
85 sourceChannel['url'])
86 channels.append(sourceChannel)
87 return channels
88
89 cmdline_pkgs = []
90
91 global selected_channels
92 selected_channels = None
94 """ return rhnChannelList containing list of channel we are subscribed to """
95 cfg = config.initUp2dateConfig()
96 global selected_channels
97 if not selected_channels and not force:
98 selected_channels = rhnChannelList()
99 s = rhnserver.RhnServer(timeout=timeout)
100
101 if not up2dateAuth.getSystemId():
102 raise up2dateErrors.NoSystemIdError(_("Unable to Locate SystemId"))
103
104 up2dateChannels = s.up2date.listChannels(up2dateAuth.getSystemId())
105
106 for chan in up2dateChannels:
107 if label_whitelist and not chan['label'] in label_whitelist:
108 continue
109
110 channel = rhnChannel(type = 'up2date', url = config.getServerlURL())
111 for key in chan.keys():
112 if key == "last_modified":
113 channel['version'] = chan['last_modified']
114 else:
115 channel[key] = chan[key]
116 selected_channels.addChannel(channel)
117
118 if len(selected_channels.list) == 0:
119 raise up2dateErrors.NoChannelsError(_("This system may not be updated until it is associated with a channel."))
120
121 return selected_channels
122
123
125 global selected_channels
126 selected_channels = None
127 whitelist = dict(map(lambda x: (x,1), tempchannels))
128 return getChannels(label_whitelist=whitelist)
129
130
131
133 s = rhnserver.RhnServer()
134 return s.up2date.subscribeChannels(up2dateAuth.getSystemId(), channels, username,
135 passwd)
136
138 s = rhnserver.RhnServer()
139 return s.up2date.unsubscribeChannels(up2dateAuth.getSystemId(), channels,
140 username, passwd)
141
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Wed Mar 4 07:37:43 2020 | http://epydoc.sourceforge.net |