浏览代码

Try 6 to fix apparmor denied in syslog at Snap Candidate.

Thanks to webenefits and xet7 !

Fixes #4855
Lauri Ojansivu 8 月之前
父节点
当前提交
5aa38c2e40
共有 1 个文件被更改,包括 9 次插入9 次删除
  1. 9 9
      snap-src/bin/mongodb-control

+ 9 - 9
snap-src/bin/mongodb-control

@@ -114,12 +114,12 @@ if [ -z "${MONGO_URL}" ]; then
     #echo "mongodb log destination: ${MONGO_LOG_DESTINATION}" >> "${SNAP_COMMON}/settings.log"
 
     # Disable MongoDB telemetry and free monitoring
-    mongosh wekan --eval 'disableTelemetry();' --port ${MONGODB_PORT}
-    mongosh wekan --eval 'db.disableFreeMonitoring();' --port ${MONGODB_PORT}
+    /snap/${SNAP_NAME}/current/usr/bin/mongosh wekan --eval 'disableTelemetry();' --port ${MONGODB_PORT}
+    /snap/${SNAP_NAME}/current/usr/bin/mongosh wekan --eval 'db.disableFreeMonitoring();' --port ${MONGODB_PORT}
 
     # Snap: Disable apparmor="DENIED" at syslog
     # https://github.com/wekan/wekan/issues/4855
-    mongosh wekan --eval 'db.adminCommand({ setParameter: 1, diagnosticDataCollectionEnabled: false});' --port ${MONGODB_PORT}
+    /snap/${SNAP_NAME}/current/usr/bin/mongosh wekan --eval 'db.adminCommand({ setParameter: 1, diagnosticDataCollectionEnabled: false});' --port ${MONGODB_PORT}
 
     # Drop indexes on database upgrade, when starting MongoDB
     #mongosh wekan --eval "db.getCollectionNames().forEach(function(col_name) { var coll = db.getCollection(col_name); coll.dropIndexes(); });" $BIND_OPTIONS
@@ -128,7 +128,7 @@ if [ -z "${MONGO_URL}" ]; then
     #mongosh wekan --eval 'db.adminCommand({ setFeatureCompatibilityVersion: "4.4" });' ${BIND_OPTIONS}
 
     # Delete incomplete uploads so that they would not prevent starting WeKan
-    mongosh wekan --eval 'db.getCollection("cfs.attachments.filerecord").find( { "uploadedAt": { "$exists": true }, "copies.attachments" : null,"failures.copies.attachments.doneTrying" : {"$ne" : true}});' --port ${MONGODB_PORT}
+    /snap/${SNAP_NAME}/current/usr/bin/mongosh wekan --eval 'db.getCollection("cfs.attachments.filerecord").find( { "uploadedAt": { "$exists": true }, "copies.attachments" : null,"failures.copies.attachments.doneTrying" : {"$ne" : true}});' --port ${MONGODB_PORT}
 
 else
 
@@ -148,20 +148,20 @@ else
     fi
 
     # Disable MongoDB telemetry and free monitoring
-    mongosh ${MONGO_URL} --eval 'disableTelemetry();'
-    mongosh ${MONGO_URL} --eval 'db.disableFreeMonitoring();'
+    /snap/${SNAP_NAME}/current/usr/bin/mongosh ${MONGO_URL} --eval 'disableTelemetry();'
+    /snap/${SNAP_NAME}/current/usr/bin/mongosh ${MONGO_URL} --eval 'db.disableFreeMonitoring();'
 
     # Snap: Disable apparmor="DENIED" at syslog
     # https://github.com/wekan/wekan/issues/4855
-    mongosh ${MONGO_URL} --eval 'db.adminCommand({ setParameter: 1, diagnosticDataCollectionEnabled: false});'
+    /snap/${SNAP_NAME}/current/usr/bin/mongosh ${MONGO_URL} --eval 'db.adminCommand({ setParameter: 1, diagnosticDataCollectionEnabled: false});'
 
     # Drop indexes on database upgrade, when starting MongoDB
     #mongosh wekan --eval "db.getCollectionNames().forEach(function(col_name) { var coll = db.getCollection(col_name); coll.dropIndexes(); });" $BIND_OPTIONS
 
     # Set MongoDB feature compatibility version
-    mongosh ${MONGO_URL} --eval 'db.adminCommand({ setFeatureCompatibilityVersion: "4.4" });'
+    #/snap/${SNAP_NAME}/current/usr/bin/mongosh ${MONGO_URL} --eval 'db.adminCommand({ setFeatureCompatibilityVersion: "4.4" });'
 
     # Delete incomplete uploads so that they would not prevent starting WeKan
-    mongosh ${MONGO_URL} --eval 'db.getCollection("cfs.attachments.filerecord").find( { "uploadedAt": { "$exists": true }, "copies.attachments" : null,"failures.copies.attachments.doneTrying" : {"$ne" : true}});'
+    /snap/${SNAP_NAME}/current/usr/bin/mongosh ${MONGO_URL} --eval 'db.getCollection("cfs.attachments.filerecord").find( { "uploadedAt": { "$exists": true }, "copies.attachments" : null,"failures.copies.attachments.doneTrying" : {"$ne" : true}});'
 
 fi