Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
60da7591
Commit
60da7591
authored
Feb 28, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2241 from tonk/devel
Added dat and time facts to setup
parents
fab3a522
7b51f671
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
library/setup
+18
-0
No files found.
library/setup
View file @
60da7591
...
...
@@ -26,6 +26,7 @@ import platform
import
re
import
socket
import
struct
import
datetime
DOCUMENTATION
=
'''
---
...
...
@@ -117,6 +118,7 @@ class Facts(object):
self
.
get_selinux_facts
()
self
.
get_pkg_mgr_facts
()
self
.
get_lsb_facts
()
self
.
get_date_time_facts
()
def
populate
(
self
):
return
self
.
facts
...
...
@@ -289,6 +291,22 @@ class Facts(object):
except
OSError
,
e
:
self
.
facts
[
'selinux'
][
'type'
]
=
'unknown'
def
get_date_time_facts
(
self
):
self
.
facts
[
'date_time'
]
=
{}
now
=
datetime
.
datetime
.
now
()
self
.
facts
[
'date_time'
][
'year'
]
=
now
.
strftime
(
'
%
Y'
)
self
.
facts
[
'date_time'
][
'month'
]
=
now
.
strftime
(
'
%
m'
)
self
.
facts
[
'date_time'
][
'day'
]
=
now
.
strftime
(
'
%
d'
)
self
.
facts
[
'date_time'
][
'hour'
]
=
now
.
strftime
(
'
%
H'
)
self
.
facts
[
'date_time'
][
'minute'
]
=
now
.
strftime
(
'
%
M'
)
self
.
facts
[
'date_time'
][
'second'
]
=
now
.
strftime
(
'
%
S'
)
self
.
facts
[
'date_time'
][
'epoch'
]
=
now
.
strftime
(
'
%
s'
)
self
.
facts
[
'date_time'
][
'date'
]
=
now
.
strftime
(
'
%
Y-
%
m-
%
d'
)
self
.
facts
[
'date_time'
][
'time'
]
=
now
.
strftime
(
'
%
H:
%
M:
%
S'
)
class
Hardware
(
Facts
):
"""
This is a generic Hardware subclass of Facts. This should be further
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment