Skip to content

Commit

Permalink
giza: credentials tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Kleinman committed Jul 29, 2015
1 parent 4837dd9 commit a4414b0
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion giza/giza/config/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def get_credentials_skeleton():
'jira': {
'username': None,
'password': None,
'url': None,
},
'corp': {
'username': None,
Expand Down Expand Up @@ -76,10 +77,38 @@ def aws(self):
def aws(self, value):
self.state['aws'] = AwsCredentialsConfig(value)

@property
def rhn(self):
return self.state['rhn']

@rhn.setter
def rhn(self, value):
self.state['rhn'] = RhnCredentialsConfig(value)


class JiraCredentialsConfig(ConfigurationBase):
_option_registry = ['username', 'password']

@property
def url(self):
if 'url' in self.state:
return self.state['url']
else:
logger.error("jira url is not specified.")
return ""

@url.setter
def url(self, value):
value = value.strip()

if value.startswith('http'):
self.state['url'] = value
if value[4] != 's':
logger.warning("jira url is not https.")
else:
logger.error("invalid jira url")
raise TypeError


class CorpCredentialsConfig(ConfigurationBase):
_option_registry = ['username', 'password', 'seed']
Expand All @@ -88,6 +117,8 @@ class CorpCredentialsConfig(ConfigurationBase):
class GithubCredentialsConfig(ConfigurationBase):
_option_registry = ['username', 'password', 'token']


class AwsCredentialsConfig(ConfigurationBase):
_option_registry = ['key', 'secret']

class RhnCredentialsConfig(ConfigurationBase):
_option_registry = ['username', 'password']

0 comments on commit a4414b0

Please sign in to comment.