Skip to content

Commit ea0d4e9

Browse files
committed
follow-up to PR72. It turns out that we hit a situation in docker-migrid where the 'somearg is keyword_auto' comparison in generateconfs fails, when passing the default 'AUTO' values e.g. for salts. This a.o. breaks the CI genoiddiscovery.py call because 'AUTO' ends up in the MiGserver.conf and causes havoc on parsing. Comparing the values with 'somearg == keyword_auto' instead solves the problems. Further analysis may be needed but perhaps it's due to string argument passing throught the command line or any mangling like somearg.upper() or the like that the memory address comparison with 'is' fails. In most other cases it makes no difference, which is used for comparing string literals.
git-svn-id: svn+ssh://svn.code.sf.net/p/migrid/code/trunk@6081 b75ad72c-e7d7-11dd-a971-7dbc132099af
1 parent 61f8c77 commit ea0d4e9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

mig/shared/install.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -418,17 +418,17 @@ def generate_confs(
418418
expanded = dict(locals())
419419

420420
# expand any directory path specific as "auto" relative to CWD
421-
if source is keyword_auto:
421+
if source == keyword_auto:
422422
expanded['source'] = os.path.dirname(sys.argv[0])
423423
source = expanded['source']
424-
if destination is keyword_auto:
424+
if destination == keyword_auto:
425425
expanded['destination'] = os.path.dirname(sys.argv[0])
426426
destination = expanded['destination']
427427

428428
# expand any user information marked as "auto" based on the environment
429-
if user is keyword_auto:
429+
if user == keyword_auto:
430430
user = pwd.getpwuid(os.getuid())[0]
431-
if group is keyword_auto:
431+
if group == keyword_auto:
432432
group = grp.getgrgid(os.getgid())[0]
433433

434434
# finalize a destination path up-front
@@ -941,7 +941,7 @@ def generate_confs(
941941
prio_duplicati_protocols.append('davs')
942942
user_dict['__DUPLICATI_PROTOCOLS__'] = ' '.join(prio_duplicati_protocols)
943943

944-
if timezone is keyword_auto:
944+
if timezone == keyword_auto:
945945
# attempt to detect the timezone
946946
sys_timezone = None
947947
try:
@@ -963,11 +963,11 @@ def generate_confs(
963963

964964
user_dict['__SEAFILE_TIMEZONE__'] = timezone
965965

966-
if seafile_secret is keyword_auto:
966+
if seafile_secret == keyword_auto:
967967
seafile_secret = ensure_native_string(base64.b64encode(os.urandom(32))).lower()
968968
user_dict['__SEAFILE_SECRET_KEY__'] = seafile_secret
969969

970-
if seafile_ccnetid is keyword_auto:
970+
if seafile_ccnetid == keyword_auto:
971971
seafile_ccnetid = ensure_native_string(base64.b64encode(os.urandom(20))).lower()
972972
user_dict['__SEAFILE_CCNET_ID__'] = seafile_ccnetid
973973

@@ -1732,12 +1732,12 @@ def generate_confs(
17321732
default_https_port])
17331733
user_dict['__SID_URL__'] += ':%(__SID_PORT__)s' % user_dict
17341734

1735-
if digest_salt is keyword_auto:
1735+
if digest_salt == keyword_auto:
17361736
# Generate random hex salt for scrambling saved digest credentials
17371737
digest_salt = ensure_native_string(base64.b16encode(os.urandom(16)))
17381738
user_dict['__DIGEST_SALT__'] = digest_salt
17391739

1740-
if crypto_salt is keyword_auto:
1740+
if crypto_salt == keyword_auto:
17411741
# Generate random hex salt for various crypto helpers
17421742
crypto_salt = ensure_native_string(base64.b16encode(os.urandom(16)))
17431743
user_dict['__CRYPTO_SALT__'] = crypto_salt

0 commit comments

Comments
 (0)