diff --git a/samcli/commands/package/validations.py b/samcli/commands/package/validations.py index 18f14411af..27648970f3 100644 --- a/samcli/commands/package/validations.py +++ b/samcli/commands/package/validations.py @@ -30,12 +30,13 @@ def wrapped(*args, **kwargs): # NOTE(sriram-mv): Both params and default_map need to be checked, as the option can be either be # passed in directly or through configuration file. # If passed in through configuration file, default_map is loaded with those values. + guided = ctx.params.get("guided", False) or ctx.params.get("g", False) resolve_s3_provided = ctx.params.get("resolve_s3", False) or ctx.default_map.get("resolve_s3", False) s3_bucket_provided = ctx.params.get("s3_bucket", False) or ctx.default_map.get("s3_bucket", False) either_required = stack.has_assets_of_package_type(ZIP) if stack is not None else False - if s3_bucket_provided and resolve_s3_provided: + if not guided and s3_bucket_provided and resolve_s3_provided: raise PackageResolveS3AndS3SetError() - if either_required and not s3_bucket_provided and not resolve_s3_provided: + if not guided and either_required and not s3_bucket_provided and not resolve_s3_provided: raise PackageResolveS3AndS3NotSetError() return func(*args, **kwargs) diff --git a/samcli/lib/iac/interface.py b/samcli/lib/iac/interface.py index 197a3b084b..5a8c2ea27f 100644 --- a/samcli/lib/iac/interface.py +++ b/samcli/lib/iac/interface.py @@ -663,6 +663,12 @@ def find_function_resources_of_package_type(self, package_type: str) -> List[Res _function_resources.append(resource) return _function_resources + def get_overrideable_parameters(self): + """ + Return a dict of parameters that are override-able, i.e. not added by iac + """ + return {key: val for key, val in self.get("Parameters", {}).items() if not val.added_by_iac} + def as_dict(self): """ return the stack as a dict for JSON serialization diff --git a/samcli/lib/package/packageable_resources.py b/samcli/lib/package/packageable_resources.py index 4dbf331c4e..c25114f6c9 100644 --- a/samcli/lib/package/packageable_resources.py +++ b/samcli/lib/package/packageable_resources.py @@ -108,7 +108,9 @@ def export(self, resource, parent_dir): if not resource.is_packageable(): return - # we can safely assume resource.assets contains at lease one asset + if not resource.assets: + return + # resource.assets contains at lease one asset asset = resource.assets[0] if not asset.source_path and not self.PACKAGE_NULL_PROPERTY: