Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cc-node
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
Mirror
cc-node
Commits
b9a6a071
Commit
b9a6a071
authored
9 years ago
by
Antoine Millet
Browse files
Options
Downloads
Patches
Plain Diff
Added hkvmver and hkvmsetup tags
parent
dcc18468
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cloudcontrol/node/host/tags.py
+16
-0
16 additions, 0 deletions
cloudcontrol/node/host/tags.py
with
16 additions
and
0 deletions
cloudcontrol/node/host/tags.py
+
16
−
0
View file @
b9a6a071
...
...
@@ -19,6 +19,8 @@ Just define a string or a function and it will be introspected and used as a
tag value.
"""
import
re
import
time
import
datetime
import
os
as
os_
import
platform
as
platform_
from
multiprocessing
import
cpu_count
...
...
@@ -207,3 +209,17 @@ def load():
def
plugins
(
handler
):
return
'
'
.
join
(
handler
.
plugins
)
or
None
# HKVM related tags
def
hkvmver
():
"""
HKVM version.
"""
fields
=
dict
(
x
.
split
(
'
:
'
,
1
)
for
x
in
open
(
'
/etc/isimage
'
).
read
().
split
(
'
\n
'
)
if
x
.
strip
())
return
int
(
fields
[
'
image version
'
])
def
hkvmsetup
():
"""
HKVM setup date.
"""
fields
=
dict
(
x
.
split
(
'
:
'
,
1
)
for
x
in
open
(
'
/etc/isimage
'
).
read
().
split
(
'
\n
'
)
if
x
.
strip
())
setup_date
=
datetime
.
datetime
.
strptime
(
fields
[
'
setup date
'
],
'
%a, %d %b %Y %H:%M:%S +0000
'
)
return
int
(
time
.
mktime
(
setup_date
.
timetuple
()))
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