所以我正在尝试创建一个aws lambda函数,登录实例并做一些事情.并且该脚本在lambda之外工作正常,但是当我使用与此https://aws.amazon.com/blogs/compute/scheduling-ssh-jobs-using-aws-lambda/相同的说明打包它时,它不会工作.它抛出了这个错误.
libffi-72499c49.so.6.0.4: cannot open shared object file: No such file or directory: ImportError
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 12, in lambda_handler
key = paramiko.RSAKey.from_private_key(key)
File "/var/task/paramiko/pkey.py", line 217, in from_private_key
key = cls(file_obj=file_obj, password=password)
File "/var/task/paramiko/rsakey.py", line 42, in __init__
self._from_private_key(file_obj, password)
File "/var/task/paramiko/rsakey.py", line 168, in _from_private_key
self._decode_key(data)
File "/var/task/paramiko/rsakey.py", line 173, in _decode_key
data, password=None, backend=default_backend()
File "/var/task/cryptography/hazmat/backends/__init__.py", line 35, in default_backend
_default_backend = MultiBackend(_available_backends())
File "/var/task/cryptography/hazmat/backends/__init__.py", line 22, in _available_backends
"cryptography.backends" …Run Code Online (Sandbox Code Playgroud) 我在 k8s 文档中找不到这个,我只是想知道 k8s 在每个容器中创建的默认环境变量是什么。不是用户创建的默认值,而是喜欢(这只是一个例子)可能类似{service_name}_PORT或类似的东西。我只想知道默认情况下容器中可用的信息。
我有一个启动脚本(用户数据),该脚本在具有ubuntu 16.04映像的aws中启动时运行,而我遇到的问题是,当它到达运行ansible剧本的那一部分时,该剧本会失败,并显示此基本错误消息Could not get lock /var/lib/dpkg/lock。现在,当我登录并尝试手动运行ansible脚本时,它可以工作,但是如果我从aws用户数据中运行它,它将失败并显示错误。
这是完整的错误
TASK [rabbitmq : install packages (Ubuntu default repo is used)] ***************
task path: /etc/ansible/roles/rabbitmq/tasks/main.yml:50
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1480352390.01-116502531862586 `" && echo ansible-tmp-1480352390.01-116502531862586="` echo $HOME/.ansible/tmp/ansible-tmp-1480352390.01-116502531862586 `" ) && sleep 0'
<localhost> PUT /tmp/tmpGHaVRP TO /.ansible/tmp/ansible-tmp-1480352390.01-116502531862586/apt
<localhost> EXEC /bin/sh -c 'chmod u+x /.ansible/tmp/ansible-tmp-1480352390.01-116502531862586/ /.ansible/tmp/ansible-tmp-1480352390.01-116502531862586/apt && sleep 0'
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /.ansible/tmp/ansible-tmp-1480352390.01-116502531862586/apt; rm …Run Code Online (Sandbox Code Playgroud) 重命名监视程序中正在监视的文件会生成on_moved事件触发器.我遇到的问题是没有办法告诉文件被移动/重命名的内容(因为重命名文件时也会发生on_moved事件触发器).有什么方法可以将它构建到看门狗中,还是应该在我正在编写的程序中构建一个变通方法?
这是一些示例代码
#!/usr/bin/python
'''
Created on 2014-07-03
'''
import sys
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
'''
Extend FileSystemEventHandler to be able to write custom on_any_event method
'''
class MyHandler(FileSystemEventHandler):
'''
Overwrite the methods for creation, deletion, modification, and moving
to get more information as to what is happening on output
'''
def on_created(self, event):
print("created: " + event.src_path)
def on_deleted(self, event):
print("deleted: " + event.src_path)
def on_modified(self, event):
print("modified: " + event.src_path)
def on_moved(self, event): …Run Code Online (Sandbox Code Playgroud) python ×2
ansible ×1
aws-lambda ×1
containers ×1
dpkg ×1
kubernetes ×1
paramiko ×1
ubuntu-16.04 ×1