Release Lightning-rod v0.4.5:

- Docker procedures updated
- Board registration procedure fixed
- Rest Manager updated

Change-Id: I4c9bb728d3f9696b73f902754e57ec0cb89bbae1
This commit is contained in:
Nicola Peditto 2019-01-10 14:32:56 +01:00
parent c2d6ecf0f5
commit f351ff5caf
9 changed files with 130 additions and 9 deletions

View File

@ -7,6 +7,6 @@ GitHub repo:
```
docker run -d --privileged \
-v lr_var:/var/lib/iotronic -v lr_le:/etc/letsencrypt/ \
--net=host --restart unless-stopped \
--name=lightning-rod mdslab/rpi-openstack-iotronic-lightning-rod
-v lr_nginx:/etc/nginx -v lr_confs:/etc/iotronic/ \
--net=host --restart unless-stopped --name=lightning-rod mdslab/arm-openstack-iotronic-lightning-rod
```

View File

@ -7,6 +7,6 @@ GitHub repo:
```
docker run -d --privileged \
-v lr_var:/var/lib/iotronic -v lr_le:/etc/letsencrypt/ \
--net=host --restart unless-stopped \
--name=lightning-rod mdslab/openstack-iotronic-lightning-rod
-v lr_nginx:/etc/nginx -v lr_confs:/etc/iotronic/ \
--net=host --restart unless-stopped --name=lightning-rod mdslab/openstack-iotronic-lightning-rod
```

View File

@ -113,7 +113,6 @@ class Board(object):
if self.status == None:
LOG.warning("settings.json file exception: " + str(err))
# STATUS REGISTERED
try:
self.code = board_config['code']
@ -124,8 +123,8 @@ class Board(object):
FIRST_BOOT = True
LOG.info("FIRST BOOT procedure started")
self.status = "first_boot"
else:
self.status = None # change to pre-registration status
LOG.info('First registration board settings: ')
LOG.info(' - code: ' + str(self.code))
self.getWampAgent(self.iotronic_config)
@ -144,7 +143,8 @@ class Board(object):
LOG.info('WAMP Agent settings:')
except Exception:
if (self.status is None) | (self.status == "registered"):
if (self.status is None) | (self.status == "registered") | \
(self.status == "first_boot"):
self.wamp_config = \
config['iotronic']['wamp']['registration-agent']
LOG.info('Registration Agent settings:')

View File

@ -78,6 +78,10 @@ class RestManager(Module.Module):
else:
wstun_status = "Offline"
service_list = service_manager.services_list()
if service_list == "":
service_list = "no services exposed!"
info = {
'board_id': board.uuid,
'board_name': board.name,
@ -88,7 +92,7 @@ class RestManager(Module.Module):
'wstun_status': wstun_status,
'board_reg_status': str(board.status),
'iotronic_status': str(iotronic_status(board.status)),
'service_list': str(service_manager.services_list())
'service_list': str(service_list)
}
return render_template('status.html', **info)

View File

@ -592,7 +592,6 @@ class ServiceManager(Module.Module):
"WSTUN server is offline! Retry " + str(count_ws) + "/5..."
)
time.sleep(randint(3, 6))
global ws_server_alive
ws_server_alive = sock.connect_ex(
(self.wstun_ip, int(self.wstun_port))
)

View File

@ -16,6 +16,10 @@ RUN npm install -g --unsafe @mdslab/wstun@1.0.9 && npm cache --force clean
RUN pip3 install iotronic-lightningrod
RUN sed -i "s|listen 80 default_server;|listen 50000 default_server;|g" /etc/nginx/sites-available/default
RUN sed -i "s|80 default_server;|50000 default_server;|g" /etc/nginx/sites-available/default
COPY data/lr_configure /usr/local/bin/lr_configure
COPY data/lr_install /usr/local/bin/lr_install
COPY data/startLR /usr/local/bin/startLR

View File

@ -0,0 +1,55 @@
#!/usr/bin/python3
# Copyright 2017 MDSLAB - University of Messina
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
import sys
if len(sys.argv) == 1:
print('Arguments required:')
print(" with '-c' specify: <REGISTRATION-TOKEN> <WAMP-REG-AGENT-URL> <LR_CONF_PATH>")
print(" without '-c' specify: <REGISTRATION-TOKEN> <WAMP-REG-AGENT-URL>")
else:
if sys.argv[1] == "-c":
if len(sys.argv) < 5:
print('Arguments required: '
+ '<REGISTRATION-TOKEN> '
+ '<WAMP-REG-AGENT-URL> '
+ '<LR_CONF_PATH>',
str(sys.argv)
)
else:
os.system('sed -i "s|\\"code\\":.*|\\"code\\": \\"'
+ sys.argv[2] + '\\"|g" ' + sys.argv[4] + '/settings.json')
os.system('sed -i "s|\\"url\\":.*|\\"url\\": \\"'
+ sys.argv[3] + '\\",|g" ' + sys.argv[4] + '/settings.json')
os.system('sed -i "s|<IOTRONIC-REALM>|s4t|g" '
+ sys.argv[4] + '/settings.json')
else:
if len(sys.argv) < 3:
print('Arguments required: <REGISTRATION-TOKEN> <WAMP-REG-AGENT-URL>',
str(sys.argv))
else:
os.system('sed -i "s|\\"code\\":.*|\\"code\\": \\"'
+ sys.argv[1] + '\\"|g" /etc/iotronic/settings.json')
os.system('sed -i "s|\\"url\\":.*|\\"url\\": \\"'
+ sys.argv[2] + '\\",|g" /etc/iotronic/settings.json')
os.system('sed -i "s|<IOTRONIC-REALM>|s4t|g" /etc/iotronic/settings.json')

View File

@ -16,6 +16,10 @@ RUN npm install -g --unsafe @mdslab/wstun@1.0.9 && npm cache --force clean
RUN pip3 install iotronic-lightningrod
RUN sed -i "s|listen 80 default_server;|listen 50000 default_server;|g" /etc/nginx/sites-available/default
RUN sed -i "s|80 default_server;|50000 default_server;|g" /etc/nginx/sites-available/default
COPY data/lr_configure /usr/local/bin/lr_configure
COPY data/lr_install /usr/local/bin/lr_install
COPY data/startLR /usr/local/bin/startLR

View File

@ -0,0 +1,55 @@
#!/usr/bin/python3
# Copyright 2017 MDSLAB - University of Messina
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
import sys
if len(sys.argv) == 1:
print('Arguments required:')
print(" with '-c' specify: <REGISTRATION-TOKEN> <WAMP-REG-AGENT-URL> <LR_CONF_PATH>")
print(" without '-c' specify: <REGISTRATION-TOKEN> <WAMP-REG-AGENT-URL>")
else:
if sys.argv[1] == "-c":
if len(sys.argv) < 5:
print('Arguments required: '
+ '<REGISTRATION-TOKEN> '
+ '<WAMP-REG-AGENT-URL> '
+ '<LR_CONF_PATH>',
str(sys.argv)
)
else:
os.system('sed -i "s|\\"code\\":.*|\\"code\\": \\"'
+ sys.argv[2] + '\\"|g" ' + sys.argv[4] + '/settings.json')
os.system('sed -i "s|\\"url\\":.*|\\"url\\": \\"'
+ sys.argv[3] + '\\",|g" ' + sys.argv[4] + '/settings.json')
os.system('sed -i "s|<IOTRONIC-REALM>|s4t|g" '
+ sys.argv[4] + '/settings.json')
else:
if len(sys.argv) < 3:
print('Arguments required: <REGISTRATION-TOKEN> <WAMP-REG-AGENT-URL>',
str(sys.argv))
else:
os.system('sed -i "s|\\"code\\":.*|\\"code\\": \\"'
+ sys.argv[1] + '\\"|g" /etc/iotronic/settings.json')
os.system('sed -i "s|\\"url\\":.*|\\"url\\": \\"'
+ sys.argv[2] + '\\",|g" /etc/iotronic/settings.json')
os.system('sed -i "s|<IOTRONIC-REALM>|s4t|g" /etc/iotronic/settings.json')