Merge pull request #4634 from ryanpetrello/licensing-rhsm-changes-380

reimplement licensing to work with RHSM and entitlement uploads
This commit is contained in:
Ryan Petrello
2020-10-30 13:03:08 -04:00
committed by GitHub
34 changed files with 787 additions and 275 deletions

View File

@@ -11,15 +11,9 @@ class Config(base.Base):
'ami-id' in self.license_info or \
'instance-id' in self.license_info
@property
def is_demo_license(self):
return self.license_info.get('demo', False) or \
self.license_info.get('key_present', False)
@property
def is_valid_license(self):
return self.license_info.get('valid_key', False) and \
'license_key' in self.license_info and \
'instance_count' in self.license_info
@property
@@ -31,16 +25,6 @@ class Config(base.Base):
def is_awx_license(self):
return self.license_info.get('license_type', None) == 'open'
@property
def is_legacy_license(self):
return self.is_valid_license and \
self.license_info.get('license_type', None) == 'legacy'
@property
def is_basic_license(self):
return self.is_valid_license and \
self.license_info.get('license_type', None) == 'basic'
@property
def is_enterprise_license(self):
return self.is_valid_license and \
@@ -52,4 +36,11 @@ class Config(base.Base):
return [k for k, v in self.license_info.get('features', {}).items() if v]
class ConfigAttach(page.Page):
def attach(self, **kwargs):
return self.post(json=kwargs).json
page.register_page(resources.config, Config)
page.register_page(resources.config_attach, ConfigAttach)

View File

@@ -16,6 +16,7 @@ class Resources(object):
_auth = 'auth/'
_authtoken = 'authtoken/'
_config = 'config/'
_config_attach = 'config/attach/'
_credential = r'credentials/\d+/'
_credential_access_list = r'credentials/\d+/access_list/'
_credential_copy = r'credentials/\d+/copy/'