Skip to content

Commit

Permalink
Move to opts instead of __opts__ in Python package
Browse files Browse the repository at this point in the history
Fixes #602.
  • Loading branch information
hausdorff committed Jul 13, 2019
1 parent a8047e5 commit efa6707
Show file tree
Hide file tree
Showing 174 changed files with 1,740 additions and 1,213 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
## 0.25.3 (Unreleased)

### Bug fixes

- Use `opts` instead of `__opts__` in Python SDK
(https://github.com/pulumi/pulumi-kubernetes/pull/639).




## 0.25.2 (July 11, 2019)

### Supported Kubernetes versions
Expand All @@ -10,7 +18,7 @@

### Improvements

- The Kubernetes provider can now communicate detailed information about the difference between a resource's
- The Kubernetes provider can now communicate detailed information about the difference between a resource's
desired and actual state during a Pulumi update. (https://github.com/pulumi/pulumi-kubernetes/pull/618).
- Refactor Pod await logic for easier testing and maintenance (https://github.com/pulumi/pulumi-kubernetes/pull/590).
- Update to client-go v12.0.0 (https://github.com/pulumi/pulumi-kubernetes/pull/621).
Expand Down Expand Up @@ -72,7 +80,7 @@ desired and actual state during a Pulumi update. (https://github.com/pulumi/pulu

BREAKING: This release changes the behavior of the provider `namespace` flag introduced
in `0.23.0`. Previously, this flag was treated as an override, which ignored namespace
values set directly on resources. Now, the flag is a default, and will only set the
values set directly on resources. Now, the flag is a default, and will only set the
namespace if one is not already set. If you have created resources using a provider
with the `namespace` flag set, this change may cause these resources to be recreated
on the next update.
Expand Down
17 changes: 10 additions & 7 deletions pkg/gen/python-templates/kind.py.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ from ... import tables, version

class {{Kind}}(pulumi.CustomResource):
{{{Comment}}}
def __init__(self, __name__, __opts__=None{{#Properties}}, {{LanguageName}}=None{{/Properties}}):
def __init__(self, __name__, opts=None{{#Properties}}, {{LanguageName}}=None{{/Properties}}, __opts__=None):
if not __name__:
raise TypeError('Missing resource name argument (for URN creation)')
if not isinstance(__name__, str):
raise TypeError('Expected resource name to be a string')
if __opts__ and not isinstance(__opts__, pulumi.ResourceOptions):
if __opts__ is not None:
warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
opts = __opts__
if opts and not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')

__props__ = dict()
Expand All @@ -30,16 +33,16 @@ class {{Kind}}(pulumi.CustomResource):
__props__['{{Name}}'] = {{LanguageName}}
{{/OptionalProperties}}

if __opts__ is None:
__opts__ = pulumi.ResourceOptions()
if __opts__.version is None:
__opts__.version = version.get_version()
if opts is None:
opts = pulumi.ResourceOptions()
if opts.version is None:
opts.version = version.get_version()

super({{Kind}}, self).__init__(
"kubernetes:{{URNAPIVersion}}:{{Kind}}",
__name__,
__props__,
__opts__)
opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ class MutatingWebhookConfiguration(pulumi.CustomResource):
MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or
reject and may change the object.
"""
def __init__(self, __name__, __opts__=None, metadata=None, webhooks=None):
def __init__(self, __name__, opts=None, metadata=None, webhooks=None, __opts__=None):
if not __name__:
raise TypeError('Missing resource name argument (for URN creation)')
if not isinstance(__name__, str):
raise TypeError('Expected resource name to be a string')
if __opts__ and not isinstance(__opts__, pulumi.ResourceOptions):
if __opts__ is not None:
warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
opts = __opts__
if opts and not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')

__props__ = dict()
Expand All @@ -27,16 +30,16 @@ def __init__(self, __name__, __opts__=None, metadata=None, webhooks=None):
__props__['metadata'] = metadata
__props__['webhooks'] = webhooks

if __opts__ is None:
__opts__ = pulumi.ResourceOptions()
if __opts__.version is None:
__opts__.version = version.get_version()
if opts is None:
opts = pulumi.ResourceOptions()
if opts.version is None:
opts.version = version.get_version()

super(MutatingWebhookConfiguration, self).__init__(
"kubernetes:admissionregistration.k8s.io/v1beta1:MutatingWebhookConfiguration",
__name__,
__props__,
__opts__)
opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ class MutatingWebhookConfigurationList(pulumi.CustomResource):
"""
MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration.
"""
def __init__(self, __name__, __opts__=None, items=None, metadata=None):
def __init__(self, __name__, opts=None, items=None, metadata=None, __opts__=None):
if not __name__:
raise TypeError('Missing resource name argument (for URN creation)')
if not isinstance(__name__, str):
raise TypeError('Expected resource name to be a string')
if __opts__ and not isinstance(__opts__, pulumi.ResourceOptions):
if __opts__ is not None:
warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
opts = __opts__
if opts and not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')

__props__ = dict()
Expand All @@ -28,16 +31,16 @@ def __init__(self, __name__, __opts__=None, items=None, metadata=None):
__props__['items'] = items
__props__['metadata'] = metadata

if __opts__ is None:
__opts__ = pulumi.ResourceOptions()
if __opts__.version is None:
__opts__.version = version.get_version()
if opts is None:
opts = pulumi.ResourceOptions()
if opts.version is None:
opts.version = version.get_version()

super(MutatingWebhookConfigurationList, self).__init__(
"kubernetes:admissionregistration.k8s.io/v1beta1:MutatingWebhookConfigurationList",
__name__,
__props__,
__opts__)
opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ class ValidatingWebhookConfiguration(pulumi.CustomResource):
ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept
or reject and object without changing it.
"""
def __init__(self, __name__, __opts__=None, metadata=None, webhooks=None):
def __init__(self, __name__, opts=None, metadata=None, webhooks=None, __opts__=None):
if not __name__:
raise TypeError('Missing resource name argument (for URN creation)')
if not isinstance(__name__, str):
raise TypeError('Expected resource name to be a string')
if __opts__ and not isinstance(__opts__, pulumi.ResourceOptions):
if __opts__ is not None:
warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
opts = __opts__
if opts and not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')

__props__ = dict()
Expand All @@ -27,16 +30,16 @@ def __init__(self, __name__, __opts__=None, metadata=None, webhooks=None):
__props__['metadata'] = metadata
__props__['webhooks'] = webhooks

if __opts__ is None:
__opts__ = pulumi.ResourceOptions()
if __opts__.version is None:
__opts__.version = version.get_version()
if opts is None:
opts = pulumi.ResourceOptions()
if opts.version is None:
opts.version = version.get_version()

super(ValidatingWebhookConfiguration, self).__init__(
"kubernetes:admissionregistration.k8s.io/v1beta1:ValidatingWebhookConfiguration",
__name__,
__props__,
__opts__)
opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ class ValidatingWebhookConfigurationList(pulumi.CustomResource):
"""
ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration.
"""
def __init__(self, __name__, __opts__=None, items=None, metadata=None):
def __init__(self, __name__, opts=None, items=None, metadata=None, __opts__=None):
if not __name__:
raise TypeError('Missing resource name argument (for URN creation)')
if not isinstance(__name__, str):
raise TypeError('Expected resource name to be a string')
if __opts__ and not isinstance(__opts__, pulumi.ResourceOptions):
if __opts__ is not None:
warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
opts = __opts__
if opts and not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')

__props__ = dict()
Expand All @@ -28,16 +31,16 @@ def __init__(self, __name__, __opts__=None, items=None, metadata=None):
__props__['items'] = items
__props__['metadata'] = metadata

if __opts__ is None:
__opts__ = pulumi.ResourceOptions()
if __opts__.version is None:
__opts__.version = version.get_version()
if opts is None:
opts = pulumi.ResourceOptions()
if opts.version is None:
opts.version = version.get_version()

super(ValidatingWebhookConfigurationList, self).__init__(
"kubernetes:admissionregistration.k8s.io/v1beta1:ValidatingWebhookConfigurationList",
__name__,
__props__,
__opts__)
opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ class CustomResourceDefinition(pulumi.CustomResource):
CustomResourceDefinition represents a resource that should be exposed on the API server. Its
name MUST be in the format <.spec.name>.<.spec.group>.
"""
def __init__(self, __name__, __opts__=None, metadata=None, spec=None, status=None):
def __init__(self, __name__, opts=None, metadata=None, spec=None, status=None, __opts__=None):
if not __name__:
raise TypeError('Missing resource name argument (for URN creation)')
if not isinstance(__name__, str):
raise TypeError('Expected resource name to be a string')
if __opts__ and not isinstance(__opts__, pulumi.ResourceOptions):
if __opts__ is not None:
warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
opts = __opts__
if opts and not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')

__props__ = dict()
Expand All @@ -30,16 +33,16 @@ def __init__(self, __name__, __opts__=None, metadata=None, spec=None, status=Non
__props__['metadata'] = metadata
__props__['status'] = status

if __opts__ is None:
__opts__ = pulumi.ResourceOptions()
if __opts__.version is None:
__opts__.version = version.get_version()
if opts is None:
opts = pulumi.ResourceOptions()
if opts.version is None:
opts.version = version.get_version()

super(CustomResourceDefinition, self).__init__(
"kubernetes:apiextensions.k8s.io/v1beta1:CustomResourceDefinition",
__name__,
__props__,
__opts__)
opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ class CustomResourceDefinitionList(pulumi.CustomResource):
"""
CustomResourceDefinitionList is a list of CustomResourceDefinition objects.
"""
def __init__(self, __name__, __opts__=None, items=None, metadata=None):
def __init__(self, __name__, opts=None, items=None, metadata=None, __opts__=None):
if not __name__:
raise TypeError('Missing resource name argument (for URN creation)')
if not isinstance(__name__, str):
raise TypeError('Expected resource name to be a string')
if __opts__ and not isinstance(__opts__, pulumi.ResourceOptions):
if __opts__ is not None:
warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
opts = __opts__
if opts and not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')

__props__ = dict()
Expand All @@ -28,16 +31,16 @@ def __init__(self, __name__, __opts__=None, items=None, metadata=None):
__props__['items'] = items
__props__['metadata'] = metadata

if __opts__ is None:
__opts__ = pulumi.ResourceOptions()
if __opts__.version is None:
__opts__.version = version.get_version()
if opts is None:
opts = pulumi.ResourceOptions()
if opts.version is None:
opts.version = version.get_version()

super(CustomResourceDefinitionList, self).__init__(
"kubernetes:apiextensions.k8s.io/v1beta1:CustomResourceDefinitionList",
__name__,
__props__,
__opts__)
opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop
Expand Down
17 changes: 10 additions & 7 deletions sdk/python/pulumi_kubernetes/apiregistration/v1/APIService.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ class APIService(pulumi.CustomResource):
"""
APIService represents a server for a particular GroupVersion. Name must be "version.group".
"""
def __init__(self, __name__, __opts__=None, metadata=None, spec=None, status=None):
def __init__(self, __name__, opts=None, metadata=None, spec=None, status=None, __opts__=None):
if not __name__:
raise TypeError('Missing resource name argument (for URN creation)')
if not isinstance(__name__, str):
raise TypeError('Expected resource name to be a string')
if __opts__ and not isinstance(__opts__, pulumi.ResourceOptions):
if __opts__ is not None:
warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
opts = __opts__
if opts and not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')

__props__ = dict()
Expand All @@ -27,16 +30,16 @@ def __init__(self, __name__, __opts__=None, metadata=None, spec=None, status=Non
__props__['spec'] = spec
__props__['status'] = status

if __opts__ is None:
__opts__ = pulumi.ResourceOptions()
if __opts__.version is None:
__opts__.version = version.get_version()
if opts is None:
opts = pulumi.ResourceOptions()
if opts.version is None:
opts.version = version.get_version()

super(APIService, self).__init__(
"kubernetes:apiregistration/v1:APIService",
__name__,
__props__,
__opts__)
opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop
Expand Down
17 changes: 10 additions & 7 deletions sdk/python/pulumi_kubernetes/apiregistration/v1/APIServiceList.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ class APIServiceList(pulumi.CustomResource):
"""
APIServiceList is a list of APIService objects.
"""
def __init__(self, __name__, __opts__=None, items=None, metadata=None):
def __init__(self, __name__, opts=None, items=None, metadata=None, __opts__=None):
if not __name__:
raise TypeError('Missing resource name argument (for URN creation)')
if not isinstance(__name__, str):
raise TypeError('Expected resource name to be a string')
if __opts__ and not isinstance(__opts__, pulumi.ResourceOptions):
if __opts__ is not None:
warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
opts = __opts__
if opts and not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')

__props__ = dict()
Expand All @@ -28,16 +31,16 @@ def __init__(self, __name__, __opts__=None, items=None, metadata=None):
__props__['items'] = items
__props__['metadata'] = metadata

if __opts__ is None:
__opts__ = pulumi.ResourceOptions()
if __opts__.version is None:
__opts__.version = version.get_version()
if opts is None:
opts = pulumi.ResourceOptions()
if opts.version is None:
opts.version = version.get_version()

super(APIServiceList, self).__init__(
"kubernetes:apiregistration/v1:APIServiceList",
__name__,
__props__,
__opts__)
opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop
Expand Down
Loading

0 comments on commit efa6707

Please sign in to comment.