File tree 2 files changed +6
-12
lines changed
2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change 90
90
binaries = BINARIES
91
91
92
92
def _patch_salt_grains_core_server_id ():
93
- import subprocess
94
93
import salt .config # must import before salt.grains.core
95
94
import salt .grains .core
96
95
import sys
96
+ import patch
97
97
98
- with open ('pkg/salt.grains.core.patch' , 'rb' ) as fh :
99
- patch_data = fh .read ()
100
-
101
- process = subprocess .Popen (['patch' ,
102
- '--forward' , # ignore patches that appear reversed or already applied
103
- '--batch' , # ask no questions
104
- salt .grains .core .__file__ ],
105
- stdin = subprocess .PIPE )
106
- stdout , stderr = process .communicate (patch_data )
98
+ pset = patch .fromfile ('pkg/salt.grains.core.patch' )
99
+ pset .items [0 ].target = salt .grains .core .__file__ .encode ()
100
+ pset .apply ()
107
101
sys .stderr .write ('patching complete\n ' )
108
102
109
- _patch_salt_grains_core_server_id ()
103
+ _patch_salt_grains_core_server_id ()
Original file line number Diff line number Diff line change 30
30
+
31
31
+ import hashlib
32
32
+ md5 = hashlib.md5()
33
- + md5.update( f'{ id_}' .encode() )
33
+ + md5.update( str( id_) .encode() )
34
34
+ id_hash = int( md5.hexdigest(), 16 )
35
35
if id_hash is None:
36
36
# Python < 3.3 or error encountered above
You can’t perform that action at this time.
0 commit comments