Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
Update Checker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
firmware
Update Checker
Commits
525b8da0
Commit
525b8da0
authored
5 years ago
by
Leonard Penzer
Browse files
Options
Downloads
Patches
Plain Diff
initial commit
parents
No related branches found
No related tags found
No related merge requests found
Pipeline
#127
failed
5 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
update_checker.py
+76
-0
76 additions, 0 deletions
update_checker.py
with
76 additions
and
0 deletions
update_checker.py
0 → 100755
+
76
−
0
View file @
525b8da0
#!/usr/bin/python3
import
json
import
netaddr
branch_to_be_checked
=
"
nightly
"
def
getNodesDownloadedUpdate
(
access
,
segments
):
updated
=
[]
for
line
in
access
.
split
(
"
\n
"
):
ipv6
=
line
.
split
(
"
"
)[
0
]
for
segment
in
segments
:
if
(
"
Wget
"
in
line
or
"
Gluon Autoupdater (using libuclient)
"
in
line
)
and
branch_to_be_checked
in
line
and
ipv6
.
startswith
(
"
fd21:b4dc:4b%02i
"
%
(
segment
))
and
"
gluon-ffs
"
in
line
:
#print(line)
if
netaddr
.
IPAddress
(
ipv6
)
not
in
updated
:
updated
.
append
(
netaddr
.
IPAddress
(
ipv6
))
return
updated
with
open
(
"
/var/log/nginx/access.log
"
)
as
fp
:
access
=
fp
.
read
()
with
open
(
"
/home/www/html/netinfo/json/nodesdb.json
"
)
as
fp
:
data
=
json
.
load
(
fp
)
countWaiting
=
0
countUpdated
=
0
countOfflineAfterUpdate
=
0
segmentsWatched
=
range
(
1
,
33
)
updated
=
getNodesDownloadedUpdate
(
access
,
segmentsWatched
)
release_to_be_watched
=
"
1.6+2019-09-14-g.9f827678-s.5904ca9
"
for
mac
in
data
:
d
=
data
[
mac
]
software
=
d
[
"
software
"
]
branch
=
d
[
"
software
"
][
"
autoupdater
"
][
"
branch
"
]
autoupdater_enabled
=
d
[
"
software
"
][
"
autoupdater
"
][
"
enabled
"
]
release
=
d
[
"
software
"
][
"
firmware
"
][
"
release
"
]
hardware_model
=
"
UNKNOWN
"
if
"
model
"
in
d
[
"
hardware
"
]:
hardware_model
=
d
[
"
hardware
"
][
"
model
"
]
if
"
addresses
"
in
d
[
"
network
"
]:
addresses
=
d
[
"
network
"
][
"
addresses
"
]
for
a
in
addresses
:
if
a
.
startswith
(
"
fd21:b4dc:4b
"
):
ipv6
=
netaddr
.
IPAddress
(
a
)
else
:
ipv6
=
None
if
"
segment
"
in
d
:
segment
=
d
[
"
segment
"
]
else
:
segment
=
0
hasDownloaded
=
""
if
ipv6
in
updated
:
hasDownloaded
=
"
UPDATING
"
online
=
d
[
"
status
"
]
for
segmentWatched
in
segmentsWatched
:
if
segment
==
segmentWatched
and
online
==
"
online
"
and
branch
==
branch_to_be_checked
and
autoupdater_enabled
==
True
:
if
release
==
release_to_be_watched
:
countUpdated
+=
1
if
ipv6
not
in
updated
:
print
(
"
Not expected %s %s %s %s %2i %s
"
%
(
mac
,
online
,
branch
,
release
,
segment
,
ipv6
))
else
:
print
(
"
%s %s %s %s %2i %s %s %s
"
%
(
mac
,
online
,
branch
,
release
,
segment
,
ipv6
,
hardware_model
,
hasDownloaded
))
countWaiting
+=
1
if
segment
==
segmentWatched
and
online
!=
"
online
"
and
release
!=
release_to_be_watched
and
branch
==
branch_to_be_checked
and
autoupdater_enabled
==
True
and
ipv6
in
updated
:
print
(
"
!!!! %s %s %s %s %2i %s %s
"
%
(
mac
,
online
,
branch
,
release
,
segment
,
ipv6
,
hasDownloaded
))
countOfflineAfterUpdate
+=
1
print
(
"
Waiting: %i
"
%
countWaiting
)
print
(
"
Updated: %i
"
%
countUpdated
)
print
(
"
Offline after Update: %i
"
%
countOfflineAfterUpdate
)
print
(
"
Downloads: %i
"
%
(
len
(
updated
)))
print
(
"
Sum: %i
"
%
(
countWaiting
+
countUpdated
))
#for u in updated:
# print(u)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment