2014-10-03 19:01:59 +00:00
|
|
|
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
|
|
|
|
#
|
|
|
|
# This file is part of Ansible
|
|
|
|
#
|
|
|
|
# Ansible is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# Ansible is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2014-10-15 23:22:54 +00:00
|
|
|
# Make coding more python3-ish
|
|
|
|
from __future__ import (absolute_import, division, print_function)
|
|
|
|
__metaclass__ = type
|
|
|
|
|
2014-10-15 23:37:29 +00:00
|
|
|
class Attribute:
|
2014-10-06 21:06:13 +00:00
|
|
|
|
2015-08-28 19:54:20 +00:00
|
|
|
def __init__(self, isa=None, private=False, default=None, required=False, listof=None, priority=0, always_post_validate=False):
|
2014-10-06 21:06:13 +00:00
|
|
|
|
2014-10-03 19:25:21 +00:00
|
|
|
self.isa = isa
|
2014-10-06 20:29:02 +00:00
|
|
|
self.private = private
|
2014-10-06 21:06:13 +00:00
|
|
|
self.default = default
|
2014-11-14 22:14:08 +00:00
|
|
|
self.required = required
|
2015-06-27 05:01:08 +00:00
|
|
|
self.listof = listof
|
2015-08-05 17:54:00 +00:00
|
|
|
self.priority = priority
|
2015-08-28 19:54:20 +00:00
|
|
|
self.always_post_validate = always_post_validate
|
2015-08-05 17:54:00 +00:00
|
|
|
|
|
|
|
def __cmp__(self, other):
|
|
|
|
return cmp(other.priority, self.priority)
|
2014-10-03 19:01:59 +00:00
|
|
|
|
|
|
|
class FieldAttribute(Attribute):
|
|
|
|
pass
|