Skip to content

Instantly share code, notes, and snippets.

@AdamSaleh
Created January 7, 2014 13:59
Show Gist options
  • Select an option

  • Save AdamSaleh/8299686 to your computer and use it in GitHub Desktop.

Select an option

Save AdamSaleh/8299686 to your computer and use it in GitHub Desktop.
class Operatingsystem(ApiCrudMixin, ApiModelMixin,DataGeneratorMixin):
@classmethod
def api_path(cls):
return "/api/operatingsystems/"
@classmethod
def id_from_json(cls, json):
return json[u'operatingsystem'][u'id']
def opts(self):
return {u'operatingsystem': self.to_data_structure()}
def change(self):
self.release_name += "updated"
return self
@required(name = regexdef(r"operatingsystem\d\d\d_.*"),
major = partial(randint, 1, 8),
minor = partial(randint, 1, 30),
family = partial(choice,
["Archlinux",
"Debian",
"Freebsd",
"Gentoo",
"Redhat",
"Solaris",
"Suse",
"Windows"]),
release_name = regexdef(r"osrelease\d\d\d"))
def __init__(self, **kwargs):
pass
class Host(DataGeneratorMixin):
@classmethod
def api_path(cls):
return "/api/hosts/"
@classmethod
def id_from_json(cls, json):
return json[u'host'][u'id']
def opts(self):
return {u'host': self.to_data_structure()}
def change(self):
self.name += "updated"
return self
@required(name = regexdef(r"host_\d\d\d_.*"),
environment = Environment,
architecture = Architecture,
domain = Domain,
puppet_proxy = SmartProxy,
operatingsystem = Operatingsystem)
def __init__(self, **kwargs):
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment