version bump
- added inventory check - supporto for ubuntu 20.04
This commit is contained in:
parent
949471915c
commit
30941d369e
@ -1,2 +1,3 @@
|
|||||||
*/5 * * * * root /usr/sbin/libreschool-client
|
*/5 * * * * root /usr/sbin/libreschool-client
|
||||||
|
* */1 * * * root /usr/sbin/libreschool-client --with-inventory
|
||||||
@reboot root /usr/sbin/libreschool-client
|
@reboot root /usr/sbin/libreschool-client
|
||||||
|
7
debian/changelog
vendored
7
debian/changelog
vendored
@ -1,3 +1,10 @@
|
|||||||
|
libreschool-client (1.0.1) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
|
* Support for ubuntu 20.04
|
||||||
|
* Added inventory check
|
||||||
|
|
||||||
|
-- paolo <paolo@asperti.com> Mon, 6 Apr 2020 22:00:00 +0200
|
||||||
|
|
||||||
libreschool-client (1.0.0) UNRELEASED; urgency=medium
|
libreschool-client (1.0.0) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* Initial release.
|
* Initial release.
|
||||||
|
2
debian/control
vendored
2
debian/control
vendored
@ -8,6 +8,6 @@ Homepage: https://git.libreschool.org/LibreSchool/libreschool-client
|
|||||||
|
|
||||||
Package: libreschool-client
|
Package: libreschool-client
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Depends: python, python-configparser, python-requests, openssh-server, ${shlibs:Depends}, ${misc:Depends}
|
Depends: python | python-is-python2, python-configparser, python-requests, openssh-server, ${shlibs:Depends}, ${misc:Depends}
|
||||||
Description: LibreSchool management client
|
Description: LibreSchool management client
|
||||||
Managed by a LibreSchool server.
|
Managed by a LibreSchool server.
|
||||||
|
@ -10,6 +10,7 @@ import sys
|
|||||||
import socket
|
import socket
|
||||||
import fileinput
|
import fileinput
|
||||||
import json
|
import json
|
||||||
|
import commands
|
||||||
|
|
||||||
def get_default_gateway_linux():
|
def get_default_gateway_linux():
|
||||||
"""Read the default gateway directly from /proc."""
|
"""Read the default gateway directly from /proc."""
|
||||||
@ -27,15 +28,15 @@ def update_config_file(config):
|
|||||||
config.write(configfile)
|
config.write(configfile)
|
||||||
|
|
||||||
def set_new_hostname(hostname, domainname, oldhostname):
|
def set_new_hostname(hostname, domainname, oldhostname):
|
||||||
|
if os.path.isfile('/etc/hosts'):
|
||||||
|
f1=open('/etc/hosts','r').read()
|
||||||
|
m1=f1.replace(oldhostname,hostname)
|
||||||
|
m2=m1.replace(oldhostname+'.'+domainname, hostname+'.'+domainname)
|
||||||
|
f2=open('/etc/hosts','w')
|
||||||
|
f2.write(m2)
|
||||||
os.system("hostname -b "+hostname)
|
os.system("hostname -b "+hostname)
|
||||||
with open('/etc/hostname', 'w') as hostnamefile:
|
with open('/etc/hostname', 'w') as hostnamefile:
|
||||||
hostnamefile.write(hostname)
|
hostnamefile.write(hostname)
|
||||||
if not os.path.isfile('/etc/hosts'):
|
|
||||||
f1=open('/etc/hosts','r').read()
|
|
||||||
m=f1.replace(oldhostname,hostname)
|
|
||||||
m=m.replace(oldhostname+'.'+domainname, hostname+'.'+domainname)
|
|
||||||
f2=open('/etc/hosts','w')
|
|
||||||
f2.write(m)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
@ -74,6 +75,14 @@ data = {
|
|||||||
'last_config': config['server'].get('last_config','0')
|
'last_config': config['server'].get('last_config','0')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if '--with-inventory' in sys.argv:
|
||||||
|
_, cpu = commands.getstatusoutput('cat /proc/cpuinfo | grep \'^model\ name\' | head -n 1 | sed \'s/model\\ name\\s:\\s*\\(.*\\)/\\1/\'')
|
||||||
|
_, ram = commands.getstatusoutput('vmstat -s | grep \'total memory$\' | awk \'{print $1}\'')
|
||||||
|
_, distro = commands.getstatusoutput('lsb_release -d')
|
||||||
|
data['cpu'] = cpu
|
||||||
|
data['ram'] = ram
|
||||||
|
data['distro'] = distro
|
||||||
|
|
||||||
# if server uuid is set
|
# if server uuid is set
|
||||||
if 'uuid' in config['server']:
|
if 'uuid' in config['server']:
|
||||||
# and is in the correct format
|
# and is in the correct format
|
||||||
|
Loading…
x
Reference in New Issue
Block a user