QualiSystems / shellfoundry

:shell::factory: CloudShell package CLI build tool
Apache License 2.0
11 stars 20 forks source link

Shellfoundry Install crashes when shell-definition.yaml contains Japanese symbols. #257

Closed turkovda closed 2 years ago

turkovda commented 3 years ago

Issue details

Shellfoundry Install crashes when shell-definition.yaml contains Japanese symbols.

(shellfoundry_1.2.17) C:\Users\dmit\Documents\Temp\japanese>shellfoundry pack
Traceback (most recent call last):
  File "C:\Users\dmit\Documents\Virtual_env\shellfoundry_1.2.17\Scripts\shellfoundry-script.py", line 11, in 
    load_entry_point('shellfoundry==1.2.17', 'console_scripts', 'shellfoundry')()
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\shellfoundry\bootstrap.py", line 67, in pack
    PackCommandExecutor().pack()
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\shellfoundry\commands\pack_command.py", line 29, in pack
    self.shell_package_builder.pack(current_path)
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\shellfoundry\utilities\shell_package_builder.py", line 28, in pack
    shell_real_name = shell_package.get_name_from_definition()
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\shellfoundry\utilities\shell_package.py", line 31, in get_name_from_definition
    self._reload_name()
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\shellfoundry\utilities\shell_package.py", line 72, in _reload_name
    definition = yaml.safe_load(stream)
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\yaml\__init__.py", line 162, in safe_load
    return load(stream, SafeLoader)
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\yaml\__init__.py", line 112, in load
    loader = Loader(stream)
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\yaml\loader.py", line 34, in __init__
    Reader.__init__(self, stream)
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\yaml\reader.py", line 85, in __init__
    self.determine_encoding()
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\yaml\reader.py", line 124, in determine_encoding
    self.update_raw()
  File "c:\users\dmit\documents\virtual_env\shellfoundry_1.2.17\lib\site-packages\yaml\reader.py", line 178, in update_raw
    data = self.stream.read(size)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1085: character maps to 

Steps to reproduce

  1. Create some shell based on any templates
  2. Edit shell-definition.yaml file by writing Japanese symbols string (e.g. これはサンプル)in inventory_description: field
    capabilities:
      auto_discovery_capability:
        type: cloudshell.capabilities.AutoDiscovery
        properties:
          enable_auto_discovery:
            type: boolean
            default: true
          auto_discovery_description:
            type: string
            default: Describe the auto discovery
          inventory_description:
            type: string
            default: これはサンプル
    
  3. Perform shellfoundry pack/install command
  4. Observe output

Affected version: 1.2.17

turkovda commented 2 years ago

Fixed in 1.2.20