added --user to the pip install command to avoid the use of sudo, improved enable_plugin_coap
@@ -19,6 +19,7 @@ source ${SUITE_BASEDIR}/suite.cfg
# Definitions
COAPFile=${FOGLAMP_ROOT}/python/foglamp/plugins/south/coap/coap.py
+COAPRequirementsFile=${TMP_DIR}/${PLUGIN_COAP_NAME}/python/requirements-coap.txt
# Redirects std out/err for all the following commands
exec 8>&1 # Backups stdout
@@ -26,18 +27,27 @@ exec 1>>"${RESULT_DIR}/${TEST_NAME}_out.temp"
exec 2>>"${RESULT_DIR}/${TEST_NAME}_err.temp"
#
-# Checks if the COAP plugin code is already available in the FogLAMP directory tree
+# Checks if the COAP plugin code is already available in the temporary directory
#
-if [[ ! -f "${COAPFile}" ]]
+if [[ ! -f "${COAPRequirementsFile}" ]]
then
-
- echo "COAP plugin code does not exists - |${COAPFile}|, retrieving the code from the github repository."
+ echo "COAP plugin code does not exists in the temporary directory - |${COAPRequirementsFile}|, retrieving the code from the github repository."
# Extracts the COAP plugin code
cd ${TMP_DIR}
rm -rf ${PLUGIN_COAP_NAME}
git clone ${PLUGIN_COAP_REPO}
cd ${PLUGIN_COAP_NAME}
+else
+ echo "COAP plugin code is already available - |${COAPRequirementsFile}|"
+fi
+
+#
+# Checks if the COAP plugin code is already available in the FogLAMP directory tree
+#
+if [[ ! -f "${COAPFile}" ]]
+then
+ echo "COAP plugin code does not exists in the FogLAMP directory- |${COAPFile}|, copying the code."
# Copies the COAP plugin code into the FogLAMP directory tree
mkdir -p ${FOGLAMP_ROOT}/python/foglamp/plugins/south/coap
@@ -50,7 +60,10 @@ fi
#
# Installs python libraries required by the plugin
#
-sudo pip3 install -Ir ${TMP_DIR}/${PLUGIN_COAP_NAME}/python/requirements-coap.txt --no-cache-dir
+pip3 install --user -Ir "${COAPRequirementsFile}" --no-cache-dir
+if [[ "$?" != "0" ]]; then
+ exit 1
+fi
#
# Enables the plugin
