Example #1
0
 def fields(self):
     return Fields(
         self,
         name=Field(kind=str, help="path to the destination file"),
         from_file=Field(kind=str,
                         default=None,
                         help="path to a source file"),
         from_template=Field(kind=str,
                             default=None,
                             help="path to a source Jinja2 template"),
         from_content=Field(
             kind=str,
             default=None,
             help="use this string as source data instead of a file"),
         owner=Field(kind=str, default=None, help="owner name"),
         group=Field(kind=str, default=None, help="group name"),
         mode=Field(kind=int,
                    default=None,
                    help="file mode, in hex/octal (not a string)"),
         absent=Field(kind=bool,
                      default=False,
                      help="if true, delete the file/directory"),
         overwrite=Field(kind=bool,
                         default=True,
                         help="replace existing files"),
     )
Example #2
0
 def fields(self):
     return Fields(
         self,
         name = Field(kind=str, default=None),
         variables = Field(kind=dict, loader=self.set_variables),
         roles = Field(kind=list, of=Role, loader=self.set_roles)
     )
Example #3
0
 def fields(self):
     return Fields(
         self,
         name = Field(kind=str, default=None),
         variables = Field(kind=dict, loader=self.set_variables),
         resources = Field(kind=list, of=Resource, loader=self.set_resources),
         handlers  = Field(kind=dict, of=Resource, loader=self.set_handlers),
     )
Example #4
0
 def fields(self):
     return Fields(
         self,
         name=Field(kind=str),
         started=Field(kind=bool, default=True),
         enabled=Field(kind=bool, default=True),
         restarted=Field(kind=bool, default=False),
     )
Example #5
0
 def fields(self):
     return Fields(
         self,
         cmd=Field(kind=str,
                   default=None,
                   help="execute this shell code in the default shell"),
         timeout=Field(kind=int,
                       default=99999,
                       help="max time to allow this command to run"))
Example #6
0
 def fields(self):
     return Fields(
         self,
         name = Field(kind=str, help="the name of the package to install"),
         version = Field(kind=str, default=None, help="what version to install"),
         latest = Field(kind=bool, default=False, help="if true, upgrade the package regardless of version"),
         absent = Field(kind=bool, default=False, help="if true, remove the package"),
         update_cache = Field(kind=bool, default=False, help="if true, update the package cache")
     )
Example #7
0
 def fields(self):
     return Fields(
         self,
         name = Field(kind=str, help="path to the destination file"),
         owner = Field(kind=str, default=None, help="owner name"),
         group = Field(kind=str, default=None, help="group name"),
         mode = Field(kind=int, default=None, help="file mode, in hex/octal (not a string)"),
         absent = Field(kind=bool, default=False, help="if true, delete the file/directory"),
         recursive = Field(kind=bool, default=False, help="if true, owner, group, and mode become recursive and always run if set")
     )
Example #8
0
 def fields(self):
     return Fields(
         self,
         name=Field(kind=str, help="the name of the group"),
         gid=Field(kind=int,
                   default=None,
                   help="if set, use this group ID (on creation)"),
         system=Field(
             kind=bool,
             default=False,
             help="if True, specifies a system group (on creation)"),
         absent=Field(kind=bool,
                      default=False,
                      help="if True, remove this group"))
Example #9
0
 def get_fields(self, common=False):
     module = importlib.import_module("opsmop.types.%s" % self.record.name)
     class_name = self.fix_class_name(self.record.name.title())
     cls = getattr(module, class_name)
     try:
         inst = cls()
     except TypeError:
         # for shortcut Types that take a first argument
         inst = cls('')
     fields = inst.fields().fields
     common_fields = Fields.common_field_spec(self, inst)
     if common:
         return collections.OrderedDict(sorted(common_fields.items()))
     else:
         for (k, v) in common_fields.items():
             del fields[k]
         return collections.OrderedDict(sorted(fields.items()))
Example #10
0
 def fields(self):
     return Fields(
         self,
         name=Field(kind=str, help="the name of the user account"),
         group=Field(
             kind=str,
             default=None,
             help="if set, assign the user's primary group (on creation)"),
         home=Field(
             kind=str,
             default=None,
             help=
             "if set, override the user's home directory location (on creation)"
         ),
         uid=Field(
             kind=int,
             default=None,
             help="if set, use a specific UID for the account (on creation)"
         ),
         system=Field(
             kind=bool,
             default=False,
             help="if true, specifies a system account (on creation)"),
         groups=Field(
             kind=list,
             default=None,
             of=str,
             help=
             "if set, assign these groups in addition to the primary groups (on creation)"
         ),
         shell=Field(kind=str,
                     default=None,
                     help="if set, assign the user's shell (on creation)"),
         absent=Field(kind=bool,
                      default=False,
                      help="if True, remove this user account"))
Example #11
0
 def fields(self):
     return Fields(self,
                   evals=Field(kind=dict),
                   variable_names=Field(kind=list))
Example #12
0
 def fields(self):
     return Fields(
         self,
         items = Field(kind=list, of=Resource),
     )
Example #13
0
 def fields(self):
     return Fields(self)
Example #14
0
 def fields(self):
     return Fields(
         self,
         msg = Field(kind=str, allow_none=False, help="string to print")
     )
Example #15
0
 def fields(self):
     return Fields(self, variables=Field(kind=dict))