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
f4ba0e78
Commit
f4ba0e78
authored
Aug 25, 2013
by
Hiroaki Nakamura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise an error on unsupported platform/distributions.
parent
ce2b37e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletions
+25
-1
library/system/hostname
+25
-1
No files found.
library/system/hostname
View file @
f4ba0e78
...
...
@@ -51,6 +51,30 @@ def log(msg):
syslog
.
openlog
(
'ansible-
%
s'
%
os
.
path
.
basename
(
__file__
))
syslog
.
syslog
(
syslog
.
LOG_NOTICE
,
msg
)
class
UnimplementedStrategy
(
object
):
def
__init__
(
self
,
module
):
self
.
module
=
module
def
get_current_hostname
(
self
):
self
.
unimplemented_error
()
def
set_current_hostname
(
self
,
name
):
self
.
unimplemented_error
()
def
get_permanent_hostname
(
self
):
self
.
unimplemented_error
()
def
set_permanent_hostname
(
self
,
name
):
self
.
unimplemented_error
()
def
unimplemented_error
(
self
):
platform
=
get_platform
()
distribution
=
get_distribution
()
msg_platform
=
'
%
s (
%
s)'
%
(
platform
,
distribution
)
\
if
distribution
is
not
None
else
platform
self
.
module
.
fail_json
(
msg
=
'hostname module cannot be used on platform
%
s'
%
msg_platform
)
class
Hostname
(
object
):
"""
This is a generic Hostname manipulation class that is subclassed
...
...
@@ -63,7 +87,7 @@ class Hostname(object):
platform
=
'Generic'
distribution
=
None
strategy_class
=
None
strategy_class
=
UnimplementedStrategy
def
__new__
(
cls
,
*
args
,
**
kwargs
):
return
load_platform_subclass
(
Hostname
,
args
,
kwargs
)
...
...
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