def __init__(self, *args, **kwargs): kwargs['argument_spec'] = self.argspec AnsibleModule.__init__(self, *args, **kwargs) if not HAS_K8S_MODULE_HELPER: self.fail_json(msg=missing_required_lib('openshift'), exception=K8S_IMP_ERR, error=to_native(k8s_import_exception)) self.openshift_version = openshift.__version__ if not HAS_YAML: self.fail_json(msg=missing_required_lib("PyYAML"), exception=YAML_IMP_ERR)
def __init__(self, *args, **kwargs): arg_spec = {} if 'argument_spec' in kwargs: arg_spec = kwargs['argument_spec'] kwargs['argument_spec'] = self._merge_dictionaries( arg_spec, dict( project=dict( required=False, type='str', fallback=(env_fallback, ['GCP_PROJECT'])), auth_kind=dict( required=True, fallback=(env_fallback, ['GCP_AUTH_KIND']), choices=['machineaccount', 'serviceaccount', 'application'], type='str'), service_account_email=dict( required=False, fallback=(env_fallback, ['GCP_SERVICE_ACCOUNT_EMAIL']), type='str'), service_account_file=dict( required=False, fallback=(env_fallback, ['GCP_SERVICE_ACCOUNT_FILE']), type='path'), service_account_contents=dict( required=False, fallback=(env_fallback, ['GCP_SERVICE_ACCOUNT_CONTENTS']), no_log=True, type='jsonarg'), scopes=dict( required=False, fallback=(env_fallback, ['GCP_SCOPES']), type='list'), env_type=dict( required=False, fallback=(env_fallback, ['GCP_ENV_TYPE']), type='str') ) ) mutual = [] if 'mutually_exclusive' in kwargs: mutual = kwargs['mutually_exclusive'] kwargs['mutually_exclusive'] = mutual.append( ['service_account_email', 'service_account_file', 'service_account_contents'] ) AnsibleModule.__init__(self, *args, **kwargs)
def __init__(self): AnsibleModule.__init__(self, argument_spec=K8S_AUTH_ARG_SPEC, required_if=[ ('state', 'present', ['username', 'password']), ('state', 'absent', ['api_key']), ]) if not HAS_REQUESTS: self.fail( "This module requires the python 'requests' package. Try `pip install requests`." ) if not HAS_REQUESTS_OAUTH: self.fail( "This module requires the python 'requests-oauthlib' package. Try `pip install requests-oauthlib`." ) if not HAS_URLLIB3: self.fail( "This module requires the python 'urllib3' package. Try `pip install urllib3`." )