I can't replicate this issue but I'm using the development versions of the openwisp modules so it may be for one of the following causes:
1. it's a bug that affects the release of netjsonconfig <https://github.com/openwisp/netjsonconfig> that is installed on your system, you could try upgrading it at the current master of today, there should be no breaking changes, but note down the version you are using before upgrading (to upgrade you need to go in */opt/openwisp2*, activate the python virtualenv with *source env/bin/activate*, then *pip install https://github.com/openwisp/netjsonconfig/tarball/master* and reload OpenWISP with *supervisorctl restart all* 2. it's a bug that manifests on your instance for some other obscure reason, probably some kind of interaction between system configuration, OS version, python version (eg: maybe you're using python2? Lately I have been testing manually almost only on python3, I test python2 only automatically on the CI builds of each repo), or some other more intricate problem Fed On Friday, November 23, 2018 at 11:47:12 AM UTC+1, henriqsc wrote: > > Ok. This json generates a file without the last two characters. This > problem happens only using the web interface not the netjsonconfig command > line. > > { > "files": [ > { > "contents": > "#!/bin/sh\n\npostar_arquivo_no_servidor(){\n\tTIPO=$1\n\tARQUIVO=$2\n\tlogger > > \"Script Monitoramento: enviando $ARQUIVO ao servidor.\"\n\tcurl -u > fdsfdsfdsf -T $ARQUIVO $URL_NETAG\n\trm -f > $ARQUIVO\n}\n\nenvia_dhcp_leases(){\n logger \"Script Monitoramento: > gerando o arquivo > dhcp.leases\"\n\tARQ_DHCP=/tmp/[email protected]\n\techo > $NOME > $ARQ_DHCP\n\tcat /tmp/dhcp.leases >> > $ARQ_DHCP\n\tpostar_arquivo_no_servidor \"dhcp\" > $ARQ_DHCP\n}\n\nenvia_macs_identificados_na_lan(){\n logger \"Script > Monitoramento: gerando o arquivo de entradas > ARP\"\n\tARQ_ARP=/tmp/[email protected]\n\techo $NOME > $ARQ_ARP\n\tcat > /proc/net/arp | grep -v 00:00:00:00:00:00 >> > $ARQ_ARP\n\tpostar_arquivo_no_servidor \"arp\" > $ARQ_ARP\n}\n\nenvia_saida_traceroute(){\n logger \"Script > Monitoramento: gerando arquivo > traceroute\"\n\tARQ_TRACERT=/tmp/[email protected]\n\ttraceroute -m 4 > 8.8.8.8 >> $ARQ_TRACERT\n\tpostar_arquivo_no_servidor \"tracert\" > $ARQ_TRACERT\n}\n\nenvia_saida_iw_scan(){\n logger \"Script > Monitoramento: gerando arquivo > iwscan\"\n\tARQ_IWSCAN=/tmp/[email protected]\n\tpostar_arquivo_no_servidor > \"iwscan\" $ARQ_IWSCAN\n}\n\nenvia_saida_bandwidthd(){\n\tif [ -f > /usr/sbin/bandwidthd ]; then\n logger \"Script > Monitoramento: gerando arquivo de monitoramento de > banda\"\n\t\tARQ_BANDWIDTHD=/tmp/[email protected]\n\t\twget > http://localhost/bandwidthd/index.html -O > $ARQ_BANDWIDTHD\n\t\tpostar_arquivo_no_servidor \"bandwidthd\" > $ARQ_BANDWIDTHD\n\telse\n\t\tlogger \"Script Monitoramento: pacote > bandwidthd não localizado. Baixando e habilitando\"\n\t\topkg > update\n\t\topkg install bandwidthd\n\t\tsed -i 's/option > graph\\t\\ttrue/option graph\\t\\tfalse/g' /etc/config/bandwidthd\n\t\tsed > -i -r 's/192.168.1.0([^0-9]+|$)/192.168.123.0\\1/g' > /etc/config/bandwidthd\n\t\t/etc/init.d/bandwidthd > enable\n\t\t/etc/init.d/bandwidthd > start\n\tfi\n}\n\nverifica_certificado_(){\n\tlogger \"Sript Monitoramento: > Verificando certificado.\"\n\tif [ ! -f /etc/ssl/certs/CA.cer ]; > then\n\t\tlogger \"Script Monitoramento: certificado não localizado. > Baixando...\"\n\t\twget http://wwww.domain.com/CA.cer -P > /etc/ssl/certs/\n\telse\n\t\tlogger \"Script Monitoramento: certificado > localizado.\"\n\tfi\n}\n\nsleep_a_while(){\n\tTEMPO=$(awk > 'BEGIN{srand();print int(rand()*300)}')\n\tlogger \"Script Monitoramento: > esperando $TEMPO segundos antes da coleta.\"\n\tsleep > $TEMPO\n}\nNOME=$(uname -n)\nMAC=$(cat > /sys/devices/platform/ag71xx.1/net/eth1/address | tr \":\" > \"-\")\nPREFIXO_ARQ=${NOME}@`date > +%Y-%m-%d_%H-%M`@${MAC}\nsleep_a_while\nverifica_certificado\nenvia_dhcp_leases > > $PREFIXO_ARQ\nenvia_saida_traceroute $PREFIXO_ARQ\nenvia_saida_iw_scan > $PREFIXO_ARQ\nenvia_macs_identificados_na_lan > $PREFIXO_ARQ\nenvia_saida_bandwidthd $PREFIXO_ARQ", > "path": "/bin/script.sh", > "mode": "0777" > } > ] > } > -- You received this message because you are subscribed to the Google Groups "OpenWISP" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
