yandex-cloud / examples Goto Github PK
View Code? Open in Web Editor NEWExamples of code, configuration files etc. to be used with Yandex Cloud.
Examples of code, configuration files etc. to be used with Yandex Cloud.
https://github.com/yandex-cloud/examples/blob/master/products-prepare/linux/yc-image-cleanup.sh
if [ ! -z "$YCCLEANUP_SYS_USER" ]; then
...
fi
echo "DONE"
Removing system user... DONE
выводится вне зависимости от того был удален пользователь или нет.
Может стоит выводить предупрежение или писать SKIPPED
вместо DONE
?
Ещё можно было бы добавить опцию, которая возьмет имя системного пользователя из $SUDO_USER
.
Делаю всё, как указано на https://yandex.ru/dev/dialogs/alice/doc/quickstart-programming.html, однако при тестировании parrot.py возникает ошибка:
{
"errorMessage": "argument of type 'NoneType' is not iterable",
"errorType": "TypeError",
"stackTrace": [
" File \"/function/runtime/runtime.py\", line 191, in handle_event\n result = h(r.event, r.context)\n",
" File \"/function/code/parrot.py\", line 9, in handler\n if 'request' in event and 'original_utterance' in event['request'] and len(event['request']['original_utterance']) > 0:\n"
]
}
Вот код:
def handler(event, context):
"""
Entry-point for Serverless Function.
:param event: request payload.
:param context: information about current execution context.
:return: response to be serialized as JSON.
"""
text = 'Hello! I\'ll repeat anything you say to me.'
if 'request' in event and 'original_utterance' in event['request'] and len(event['request']['original_utterance']) > 0:
text = event['request']['original_utterance']
return {
'version': event['version'],
'session': event['session'],
'response': {
# Respond with the original request or welcome the user if this is the beginning of the dialog and the request has not yet been made.
'text': text,
# Don't finish the session after this response.
'end_session': 'false'
},
}
Сейчас yc-image-cleanup.sh -d проверяет, выставлена ли переменная PasswordAuthentication в конфиге sshd в значение no. Но нет кода который бы это мог бы сделать такое выставление автоматом. Нужно сделать по аналогии со сбросом PermitRootLogin:
examples/products-prepare/linux/yc-image-cleanup.sh
Lines 474 to 484 in c1f5d63
There is a python sample https://cloud.yandex.ru/docs/speechkit/stt/api/streaming-examples-v3
Is there a similar code for node.js?
Thanks
Получаю ошибку:
Checking for SSH password authentication is disabled... FAIL;
Проблема в том, что перед этим yc-image-cleanup.sh -с очищает хостовые ключи:
Cама проверяющая функция вызывает sshd -T А sshd -T не стартует из-за очищенных ключей:# sshd -T
sshd: no hostkeys available -- exiting.
В результате проверка по ошибке выдает FAIL.
Ну и в целом такая проверка выглядит не очень логично, т.к. в коде очистки есть только исправление значения PermitRootLogin
но проверка при этом идет на PasswordAuthentication, надо бы эти вещи согласовать )Прошу добавить пример terraform.tfvars, показанный на 45 минуте в видео "Packer, Terraform и PowerShell для развертывания Windows в Яндекс Облаке – Михаил Рыженков"
https://youtu.be/NY9_1pvICyY?t=2699
Сейчас ноутбук невозможно пройти. Подробности в задаче YCDOCIO-457.
I try packer build by packer-ansible-windows
And get error when use "source_image_family": "windows-2019-gvlk",
yandex: fatal: [default]: FAILED! => {"changed": false, "module_version": "9.1.0", "msg": "PowerShell DSC resource DSC_xRemoteFile failed to execute Set-TargetResource functionality with error message: Invoking web request failed with error. The remote server returned an error: (404) Not Found. ", "reboot_required": false}
vars:
uri_exch2016cu12: "https://storage.yandexcloud.net/msft-exchange/ExchangeServer2016-x64-cu12.iso"
But ExchangeServer2016-x64-cu12.iso does not exist in storage
Change subnet CIDR to pod CIDR and service CIDR.
ansible --version
ansible 2.6.17
packer build windows-ansible.json
yandex: output will be in this color.
==> yandex: Creating temporary ssh key for instance...
==> yandex: Using as source image: fd85s1nlcavgdpc16hj3 (name: "windows-2016-gvlk-1556619485", family: "windows-2016-gvlk")
==> yandex: Use provided subnet id b0c8pliu8o98kgtui3r3
==> yandex: Creating instance...
==> yandex: Waiting for instance with id ef333e47f9sh2fdfqd0a to become active...
yandex: Detected instance IP: 178.154.234.144
==> yandex: Using winrm communicator to connect: 178.154.234.144
==> yandex: Waiting for WinRM to become available...
==> yandex: #< CLIXML
yandex: WinRM connected.
==> yandex: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><Obj S="progress" RefId="1"><TNRef RefId="0" /><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>
==> yandex: Connected to WinRM!
==> yandex: Uploading /home/user/examples/packer-ansible-windows/setup_complete/ => C:\Windows\Setup\Scripts\
==> yandex: Provisioning with Ansible...
yandex: Setting up proxy adapter for Ansible....
==> yandex: Executing Ansible: ansible-playbook -e packer_build_name="yandex" -e packer_builder_type=yandex --connection=packer --extra-vars ansible_shell_type=powershell ansible_shell_executable=None ansible_python_interpreter=/usr/bin/python -e ansible_ssh_private_key_file=/tmp/ansible-key064885685 -i /tmp/packer-provisioner-ansible611103632 /home/user/examples/packer-ansible-windows/ansible/exmb_prereq.yml
yandex: /home/user/.local/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
yandex: from cryptography.exceptions import InvalidSignature
yandex:
yandex: PLAY [all] *********************************************************************
yandex:
yandex: TASK [Gathering Facts] *********************************************************
yandex: ok: [default]
yandex:
yandex: TASK [download required modules] ***********************************************
yandex: failed: [default] (item=xActiveDirectory) => {"changed": false, "item": "xActiveDirectory", "msg": "Problems adding package provider: No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.", "nuget_changed": false, "output": "", "repository_changed": false}
yandex: failed: [default] (item=xExchange) => {"changed": false, "item": "xExchange", "msg": "Problems adding package provider: No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.", "nuget_changed": false, "output": "", "repository_changed": false}
yandex: failed: [default] (item=xPSDesiredStateConfiguration) => {"changed": false, "item": "xPSDesiredStateConfiguration", "msg": "Problems adding package provider: No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.", "nuget_changed": false, "output": "", "repository_changed": false}
yandex: failed: [default] (item=NetworkingDsc) => {"changed": false, "item": "NetworkingDsc", "msg": "Problems adding package provider: No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.", "nuget_changed": false, "output": "", "repository_changed": false}
yandex: failed: [default] (item=ComputerManagementDsc) => {"changed": false, "item": "ComputerManagementDsc", "msg": "Problems adding package provider: No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.", "nuget_changed": false, "output": "", "repository_changed": false}
yandex: failed: [default] (item=StorageDsc) => {"changed": false, "item": "StorageDsc", "msg": "Problems adding package provider: No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.", "nuget_changed": false, "output": "", "repository_changed": false}
yandex: to retry, use: --limit @/home/user/examples/packer-ansible-windows/ansible/exmb_prereq.retry
yandex:
yandex: PLAY RECAP *********************************************************************
yandex: default : ok=1 changed=0 unreachable=0 failed=1
yandex:
==> yandex: Provisioning step had errors: Running the cleanup provisioner, if present...
==> yandex: Destroying instance...
yandex: Instance has been destroyed!
==> yandex: Destroying boot disk...
yandex: Disk has been deleted!
Build 'yandex' errored after 7 minutes 57 seconds: Error executing Ansible: Non-zero exit status: exit status 2
После создания версии функции из тестового примера examples/serverless/functions/YDB-connect-from-serverless-function/
при запуске тестирования ошибка (Среда выполнения node js 16, функция запускается в облаке)
{ "errorMessage": "Cannot find module '../package.json'\nRequire stack:\n- /function/code/node_modules/ydb-sdk/build/cjs/version.js\n- /function/code/node_modules/ydb-sdk/build/cjs/utils.js\n- /function/code/node_modules/ydb-sdk/build/cjs/discovery.js\n- /function/code/node_modules/ydb-sdk/build/cjs/driver.js\n- /function/code/node_modules/ydb-sdk/build/cjs/index.js\n- /function/code/database.js\n- /function/code/index.js", "errorType": "Error", "stackTrace": [ { "line": "Require stack:" }, { "line": "- /function/code/node_modules/ydb-sdk/build/cjs/version.js" }, { "line": "- /function/code/node_modules/ydb-sdk/build/cjs/utils.js" }, { "line": "- /function/code/node_modules/ydb-sdk/build/cjs/discovery.js" }, { "line": "- /function/code/node_modules/ydb-sdk/build/cjs/driver.js" }, { "line": "- /function/code/node_modules/ydb-sdk/build/cjs/index.js" }, { "line": "- /function/code/database.js" }, { "line": "- /function/code/index.js" }, { "function": "Function.Module._resolveFilename", "file": "node:internal/modules/cjs/loader", "line": 933, "column": 15 }, { "function": "Function.Module._load", "file": "node:internal/modules/cjs/loader", "line": 778, "column": 27 }, { "function": "Module.require", "file": "node:internal/modules/cjs/loader", "line": 1005, "column": 19 }, { "function": "require", "file": "node:internal/modules/cjs/helpers", "line": 102, "column": 18 }, { "function": "Object.<anonymous>", "file": "/function/code/node_modules/ydb-sdk/build/cjs/version.js", "line": 4, "column": 17 }, { "function": "Module._compile", "file": "node:internal/modules/cjs/loader", "line": 1103, "column": 14 }, { "function": "Object.Module._extensions..js", "file": "node:internal/modules/cjs/loader", "line": 1157, "column": 10 }, { "function": "Module.load", "file": "node:internal/modules/cjs/loader", "line": 981, "column": 32 }, { "function": "Function.Module._load", "file": "node:internal/modules/cjs/loader", "line": 822, "column": 12 }, { "function": "Module.require", "file": "node:internal/modules/cjs/loader", "line": 1005, "column": 19 } ] }
В документации говорится, что приложение должно запускаться на порте, указанном в переменной окружения ENV. Однако в примере, оно запускается на постоянном порте 8080. Это недочёт в примере или я что-то неверно понял?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.