update-linux 2.0.0__tar.gz → 2.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {update-linux-2.0.0 → update-linux-2.1.1}/PKG-INFO +3 -1
- {update-linux-2.0.0 → update-linux-2.1.1}/README.md +2 -0
- {update-linux-2.0.0 → update-linux-2.1.1}/update_linux/__init__.py +48 -19
- {update-linux-2.0.0 → update-linux-2.1.1}/update_linux/__main__.py +3 -0
- {update-linux-2.0.0 → update-linux-2.1.1}/update_linux.egg-info/PKG-INFO +3 -1
- {update-linux-2.0.0 → update-linux-2.1.1}/setup.cfg +0 -0
- {update-linux-2.0.0 → update-linux-2.1.1}/setup_update_linux.py +0 -0
- {update-linux-2.0.0 → update-linux-2.1.1}/update_linux.egg-info/SOURCES.txt +0 -0
- {update-linux-2.0.0 → update-linux-2.1.1}/update_linux.egg-info/dependency_links.txt +0 -0
- {update-linux-2.0.0 → update-linux-2.1.1}/update_linux.egg-info/entry_points.txt +0 -0
- {update-linux-2.0.0 → update-linux-2.1.1}/update_linux.egg-info/requires.txt +0 -0
- {update-linux-2.0.0 → update-linux-2.1.1}/update_linux.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: update-linux
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: Update Linux
|
|
5
5
|
Home-page: https://github.com/barry-scott/CLI-tools
|
|
6
6
|
Author: Barry Scott
|
|
@@ -27,6 +27,8 @@ If running update-linux on a macOS system it is necessary to flush DNS so that f
|
|
|
27
27
|
|
|
28
28
|
This is done with the command `sudo killall -HUP mDNSResponder`.
|
|
29
29
|
|
|
30
|
+
update-linux will refuse to update the host it is running on.
|
|
31
|
+
|
|
30
32
|
## update-linux update process
|
|
31
33
|
|
|
32
34
|
```
|
|
@@ -10,6 +10,8 @@ If running update-linux on a macOS system it is necessary to flush DNS so that f
|
|
|
10
10
|
|
|
11
11
|
This is done with the command `sudo killall -HUP mDNSResponder`.
|
|
12
12
|
|
|
13
|
+
update-linux will refuse to update the host it is running on.
|
|
14
|
+
|
|
13
15
|
## update-linux update process
|
|
14
16
|
|
|
15
17
|
```
|
|
@@ -8,7 +8,7 @@ import tempfile
|
|
|
8
8
|
import json
|
|
9
9
|
from config_path import ConfigPath
|
|
10
10
|
|
|
11
|
-
VERSION = '2.
|
|
11
|
+
VERSION = '2.1.1'
|
|
12
12
|
|
|
13
13
|
default_json_config_template = u'''{
|
|
14
14
|
"group":
|
|
@@ -169,15 +169,20 @@ class UpdateFedora:
|
|
|
169
169
|
|
|
170
170
|
if self.opt_help:
|
|
171
171
|
print(
|
|
172
|
-
'''Usage: %s <options> <group>|<host>...
|
|
172
|
+
'''Usage: %(appname)s <options> <group>|<host>...
|
|
173
|
+
|
|
174
|
+
%(appname)s version %(version)s
|
|
175
|
+
|
|
173
176
|
group - read from the JSON config file:
|
|
174
|
-
%s
|
|
177
|
+
%(config_file)s
|
|
175
178
|
|
|
176
179
|
each group is a list of hosts to be updated
|
|
177
180
|
|
|
178
181
|
host - host to be updated
|
|
179
182
|
|
|
180
|
-
options:''' %
|
|
183
|
+
options:''' % {'appname': appname.name
|
|
184
|
+
,'version': VERSION
|
|
185
|
+
,'config_file': self.config.readFilePath()} )
|
|
181
186
|
|
|
182
187
|
printOptionsHelp( self )
|
|
183
188
|
return 0
|
|
@@ -194,7 +199,20 @@ class UpdateFedora:
|
|
|
194
199
|
print( 'Log directory: %s' % (self.logdir,) )
|
|
195
200
|
return 0
|
|
196
201
|
|
|
197
|
-
|
|
202
|
+
all_to_exclude = []
|
|
203
|
+
if self.opt_exclude:
|
|
204
|
+
all_to_exclude = self.all_groups.get( self.opt_exclude(), self.opt_exclude() )
|
|
205
|
+
|
|
206
|
+
for group_or_host in positional_args:
|
|
207
|
+
if group_or_host in self.all_groups:
|
|
208
|
+
for host in self.all_groups[ group_or_host ]:
|
|
209
|
+
if host not in all_to_exclude:
|
|
210
|
+
self.all_hosts.append( host )
|
|
211
|
+
else:
|
|
212
|
+
if group_or_host not in all_to_exclude:
|
|
213
|
+
self.all_hosts.append( group_or_host )
|
|
214
|
+
|
|
215
|
+
if len(self.all_hosts) == 0:
|
|
198
216
|
self.error( '', 'No hosts to update' )
|
|
199
217
|
print('''
|
|
200
218
|
For help:
|
|
@@ -202,22 +220,16 @@ For help:
|
|
|
202
220
|
''' % (appname.name,))
|
|
203
221
|
return 1
|
|
204
222
|
|
|
205
|
-
this_host = socket.gethostname().split('.')[0]
|
|
206
|
-
|
|
207
223
|
self.summary_log_name = self.logdir / ('update-summary-%s.log' % (self.ts,))
|
|
208
224
|
|
|
209
225
|
with open( self.summary_log_name, 'a' ) as self.summary_log:
|
|
210
226
|
t = datetime.datetime.now()
|
|
211
227
|
self.header( 'Update summary %s' % (t.strftime( '%Y-%m-%d %H:%M:%S' ),) )
|
|
212
228
|
|
|
213
|
-
for group_or_host in positional_args:
|
|
214
|
-
if group_or_host in self.all_groups:
|
|
215
|
-
for host in self.all_groups[ group_or_host ]:
|
|
216
|
-
self.all_hosts.append( host )
|
|
217
|
-
else:
|
|
218
|
-
self.all_hosts.append( group_or_host )
|
|
219
|
-
|
|
220
229
|
for host in self.all_hosts:
|
|
230
|
+
if host in all_to_exclude:
|
|
231
|
+
continue
|
|
232
|
+
|
|
221
233
|
self.flushDns()
|
|
222
234
|
if self.opt_check:
|
|
223
235
|
self.check( host )
|
|
@@ -225,13 +237,13 @@ For help:
|
|
|
225
237
|
elif self.opt_install_package() is not None:
|
|
226
238
|
self.installPackage( host, self.opt_install_package )
|
|
227
239
|
|
|
228
|
-
elif self.opt_system_upgrade:
|
|
229
|
-
self.systemUpgrade( host, self.opt_system_upgrade )
|
|
230
|
-
|
|
231
240
|
else:
|
|
232
|
-
if host
|
|
241
|
+
if self.isThisHost( host ):
|
|
233
242
|
self.warn( host, 'Refusing to update this host' )
|
|
234
243
|
|
|
244
|
+
elif self.opt_system_upgrade:
|
|
245
|
+
self.systemUpgrade( host, self.opt_system_upgrade )
|
|
246
|
+
|
|
235
247
|
else:
|
|
236
248
|
self.update( host )
|
|
237
249
|
|
|
@@ -241,6 +253,23 @@ For help:
|
|
|
241
253
|
|
|
242
254
|
return 0
|
|
243
255
|
|
|
256
|
+
def isThisHost( self, other_host ):
|
|
257
|
+
this_host = socket.gethostname()
|
|
258
|
+
this_info = socket.getaddrinfo( this_host, 'ssh', proto=socket.IPPROTO_TCP )
|
|
259
|
+
this_addrs = set(info[4][0] for info in this_info) | set(['::1', '127.0.0.1'])
|
|
260
|
+
|
|
261
|
+
try:
|
|
262
|
+
other_info = socket.getaddrinfo( other_host, 'ssh', proto=socket.IPPROTO_TCP )
|
|
263
|
+
except socket.gaierror as e:
|
|
264
|
+
self.warn( other_host, str(e) )
|
|
265
|
+
# return true to prevent update
|
|
266
|
+
return True
|
|
267
|
+
|
|
268
|
+
other_addrs = set(info[4][0] for info in other_info)
|
|
269
|
+
|
|
270
|
+
# share any address in common?
|
|
271
|
+
return len(this_addrs & other_addrs) > 0
|
|
272
|
+
|
|
244
273
|
def loadConfig( self ):
|
|
245
274
|
self.config = ConfigPath( 'update-linux', 'barrys-emacs.org', '.json' )
|
|
246
275
|
config_file = self.config.readFilePath()
|
|
@@ -250,8 +279,8 @@ For help:
|
|
|
250
279
|
if config_file is None:
|
|
251
280
|
json_config = default_json_config
|
|
252
281
|
self.debug( 'Using default builtin config' )
|
|
253
|
-
self.info( '', 'Creating default config in %s' )
|
|
254
282
|
config_file = self.config.saveFilePath( True )
|
|
283
|
+
self.info( '', 'Creating default config in %s' % (config_file,) )
|
|
255
284
|
with open( config_file, 'w' ) as f:
|
|
256
285
|
f.write( json_config )
|
|
257
286
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: update-linux
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: Update Linux
|
|
5
5
|
Home-page: https://github.com/barry-scott/CLI-tools
|
|
6
6
|
Author: Barry Scott
|
|
@@ -27,6 +27,8 @@ If running update-linux on a macOS system it is necessary to flush DNS so that f
|
|
|
27
27
|
|
|
28
28
|
This is done with the command `sudo killall -HUP mDNSResponder`.
|
|
29
29
|
|
|
30
|
+
update-linux will refuse to update the host it is running on.
|
|
31
|
+
|
|
30
32
|
## update-linux update process
|
|
31
33
|
|
|
32
34
|
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|