4747 _object_to_dict , _add_or_update_secrets , _remove_additional_attributes , _remove_readonly_attributes ,
4848 _add_or_update_env_vars , _add_or_update_tags , update_nested_dictionary , _update_traffic_weights ,
4949 _get_app_from_revision , raise_missing_token_suggestion , _infer_acr_credentials , _remove_registry_secret , _remove_secret ,
50- _ensure_identity_resource_id , _remove_dapr_readonly_attributes , _registry_exists , _remove_env_vars , _update_revision_env_secretrefs )
50+ _ensure_identity_resource_id , _remove_dapr_readonly_attributes , _remove_env_vars , _update_revision_env_secretrefs )
5151
5252logger = get_logger (__name__ )
5353
5454
5555# These properties should be under the "properties" attribute. Move the properties under "properties" attribute
5656def process_loaded_yaml (yaml_containerapp ):
57+ if yaml_containerapp .get ('systemData' ):
58+ yaml_containerapp ['systemData' ] = {}
5759 if not yaml_containerapp .get ('properties' ):
5860 yaml_containerapp ['properties' ] = {}
5961
@@ -73,7 +75,7 @@ def load_yaml_file(file_name):
7375
7476 try :
7577 with open (file_name ) as stream : # pylint: disable=unspecified-encoding
76- return yaml .safe_load (stream )
78+ return yaml .safe_load (stream . read (). replace ( ' \x00 ' , '' ) )
7779 except (IOError , OSError ) as ex :
7880 if getattr (ex , 'errno' , 0 ) == errno .ENOENT :
7981 raise ValidationError ('{} does not exist' .format (file_name )) from ex
@@ -1431,7 +1433,7 @@ def show_ingress(cmd, name, resource_group_name):
14311433 raise ValidationError ("The containerapp '{}' does not have ingress enabled." .format (name )) from e
14321434
14331435
1434- def enable_ingress (cmd , name , resource_group_name , type , target_port , transport , allow_insecure = False , no_wait = False ): # pylint: disable=redefined-builtin
1436+ def enable_ingress (cmd , name , resource_group_name , type , target_port , transport = "auto" , allow_insecure = False , no_wait = False ): # pylint: disable=redefined-builtin
14351437 _validate_subscription_registered (cmd , "Microsoft.App" )
14361438
14371439 containerapp_def = None
@@ -1708,22 +1710,28 @@ def remove_registry(cmd, name, resource_group_name, server, no_wait=False):
17081710 pass
17091711
17101712
1711- def list_secrets (cmd , name , resource_group_name ):
1713+ def list_secrets (cmd , name , resource_group_name , show_values = False ):
17121714 _validate_subscription_registered (cmd , "Microsoft.App" )
17131715
17141716 containerapp_def = None
17151717 try :
1716- containerapp_def = ContainerAppClient .show (cmd = cmd , resource_group_name = resource_group_name , name = name )
1718+ r = containerapp_def = ContainerAppClient .show (cmd = cmd , resource_group_name = resource_group_name , name = name )
17171719 except :
17181720 pass
17191721
17201722 if not containerapp_def :
17211723 raise ResourceNotFoundError ("The containerapp '{}' does not exist" .format (name ))
17221724
1725+ if not show_values :
1726+ try :
1727+ return r ["properties" ]["configuration" ]["secrets" ]
1728+ except :
1729+ return []
17231730 try :
17241731 return ContainerAppClient .list_secrets (cmd = cmd , resource_group_name = resource_group_name , name = name )["value" ]
1725- except Exception as e :
1726- raise ValidationError ("The containerapp {} has no assigned secrets." .format (name )) from e
1732+ except Exception :
1733+ return []
1734+ # raise ValidationError("The containerapp {} has no assigned secrets.".format(name)) from e
17271735
17281736
17291737def show_secret (cmd , name , resource_group_name , secret_name ):
@@ -1816,6 +1824,7 @@ def set_secrets(cmd, name, resource_group_name, secrets,
18161824 try :
18171825 r = ContainerAppClient .create_or_update (
18181826 cmd = cmd , resource_group_name = resource_group_name , name = name , container_app_envelope = containerapp_def , no_wait = no_wait )
1827+ logger .warning ("Containerapp must be restarted in order for secret changes to take effect." )
18191828 return r ["properties" ]["configuration" ]["secrets" ]
18201829 except Exception as e :
18211830 handle_raw_exception (e )
0 commit comments