GithubHelp home page GithubHelp logo

footmark's Introduction

footmark

python sdk for aliyun, used by ansible-module primarily.

Install footmark

footmark can be intalled via pip:

$ sudo pip install footmark

and it can be upgraded via the following command:

$ sudo pip install footmark --upgrade

Config footmark

By default we use two locations for the footmark configurations, which '/etc/footmark/' and '/.footmark'. And location '/.footmark' works on Windows and Unix. All of footmark's configuration files exist in the locations, and you can configure your footmark by modifying them. At present, footmark only supports custom logging. Footmark logs exist in '/var/log/footmark', and it only retains the logs for the last 7 days.

Unittest footmark

If you want to test footmark use unittest, you should use the following command to install dependency packages:

$ sudo pip install mock nose nose_htmloutput importlib

Warning: If you run it in the Mac, it will fail and raise an error 'OSError: [Errno 1] Operation not permitted:'. To solve the problem, please run it in the virtualenv.

Package footmark

When you modify footmark, you need to package and distribute it. First, you need to edit footmark/init.py and set a new version to 'version '. Second, execute commands as follows:

# build footmark package
$ python setup.py sdist

# make sure your enviroment has installed twine, if not, execute command:
$ sudo pip install twine

# distribute new footmark
# upload your project
$ twine upload dist/<your-footmark-package>

Finally, upgrade footmark and check it.

footmark's People

Contributors

atodorov avatar baichenxu3 avatar hugh---- avatar liuyangc3 avatar lixue323 avatar xiaozhu36 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

footmark's Issues

Conflicts between footmark and aliyun-python-sdk-core

Hi, users are unable to run footmark due to dependency conflict with aliyun-python-sdk-core package.
As shown in the following full dependency graph of footmark , footmark requires aliyun-python-sdk-core >=2.9.5,<2.9.6,while aliyun-python-sdk-ess requires aliyun-python-sdk-core=2.11.5.
According to pip’s “first found wins” installation strategy, aliyun-python-sdk-core 2.9.5 is the actually installed version. However, aliyun-python-sdk-core 2.9.5 does not satisfy >=2.11.5, which leads to a build error.

Dependency tree------

footmark<version range:>
| +-aliyun-python-sdk-core<version range:>=2.9.5,<2.9.6>
| +-aliyun-python-sdk-ecs<version range:>=4.11.0,<4.11.1>
| +-aliyun-python-sdk-ess<version range:>=2.1.3>
| | +-aliyun-python-sdk-core<version range:>=2.11.5>
| +-aliyun-python-sdk-rds<version range:>=2.1.0>
| | +-aliyun-python-sdk-core<version range:>=2.11.5>
| +-aliyun-python-sdk-slb<version range:<3.2.8,>=2.0.21>
| | +-aliyun-python-sdk-core<version range:>=2.11.5>
| +-aliyun-python-sdk-vpc<version range:>=3.0.2,<3.0.3>
| +-importlib<version range:>
| +-oss2<version range:>=2.3.3>

Thanks for your help.
Best,
Neolith

ECS Instance exception in version 1.5.0

Hi there, thanks very much for this useful Ansible provider for Alicloud.

I believe I may have found a bug introduced in ed325de.

When using the ali_instance module of https://github.com/alibaba/ansible-provider version 1.5.0, I receive a TypeError: string indices must be integers, not str for the following line (https://github.com/alibaba/footmark/blob/master/footmark/ecs/instance.py#L249):

if value and value["ip_address"]:

It seems that value is a string rather than a dictionary-like object? In case it is relevant, I have the assign_public_ip parameter of ali_instance set to True.

TypeError: the JSON object must be str, not 'bytes' in get_status_new

my code:
ecs = ecs_connect(module)
for inst in ecs.describe_instances(instance_ids=resource):
inst.add_tags(tags)
issue: this tags should added success,but will raise display error
TypeError: the JSON object must be str, not 'bytes' in get_status_new
mabe:
body = json.loads(body, encoding='UTF-8') to
body = json.loads(body.decode('utf-8')) in connection.get_status_new 423 line

UnboundLocalError: local variable 'filters' referenced before assignment

$ ansible localhost -c local -m ali_instance_facts -a 'alicloud_region=us-east-1 availability_zone=us-east-1-a' -vvv
ansible 2.8.0b1.post0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/atodorov/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/atodorov/.virtualenvs/alibaba/lib/python2.7/site-packages/ansible
  executable location = /home/atodorov/.virtualenvs/alibaba/bin/ansible
  python version = 2.7.5 (default, Sep 12 2018, 05:31:16) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
META: ran handlers
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: atodorov
<127.0.0.1> EXEC /bin/sh -c 'echo ~atodorov && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/atodorov/.ansible/tmp/ansible-tmp-1556112722.38-56948253796160 `" && echo ansible-tmp-1556112722.38-56948253796160="` echo /home/atodorov/.ansible/tmp/ansible-tmp-1556112722.38-56948253796160 `" ) && sleep 0'
Using module file /home/atodorov/.virtualenvs/alibaba/lib/python2.7/site-packages/ansible/modules/cloud/alicloud/ali_instance_facts.py
<127.0.0.1> PUT /home/atodorov/.ansible/tmp/ansible-local-269724TbdZ6/tmpiCoiNO TO /home/atodorov/.ansible/tmp/ansible-tmp-1556112722.38-56948253796160/AnsiballZ_ali_instance_facts.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/atodorov/.ansible/tmp/ansible-tmp-1556112722.38-56948253796160/ /home/atodorov/.ansible/tmp/ansible-tmp-1556112722.38-56948253796160/AnsiballZ_ali_instance_facts.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/home/atodorov/.virtualenvs/alibaba/bin/python /home/atodorov/.ansible/tmp/ansible-tmp-1556112722.38-56948253796160/AnsiballZ_ali_instance_facts.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/atodorov/.ansible/tmp/ansible-tmp-1556112722.38-56948253796160/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/home/atodorov/.ansible/tmp/ansible-tmp-1556112722.38-56948253796160/AnsiballZ_ali_instance_facts.py", line 114, in <module>
    _ansiballz_main()
  File "/home/atodorov/.ansible/tmp/ansible-tmp-1556112722.38-56948253796160/AnsiballZ_ali_instance_facts.py", line 106, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/atodorov/.ansible/tmp/ansible-tmp-1556112722.38-56948253796160/AnsiballZ_ali_instance_facts.py", line 49, in invoke_module
    imp.load_module('__main__', mod, module, MOD_DESC)
  File "/tmp/ansible_ali_instance_facts_payload_qZeeM9/__main__.py", line 396, in <module>
  File "/tmp/ansible_ali_instance_facts_payload_qZeeM9/__main__.py", line 388, in main
  File "/home/atodorov/.virtualenvs/alibaba/lib/python2.7/site-packages/footmark/ecs/connection.py", line 267, in get_all_instances
    for inst in self.get_list_new(self.build_request_params(filters), ['Instances', Instance]):
UnboundLocalError: local variable 'filters' referenced before assignment

localhost | FAILED! => {
    "changed": false, 
    "module_stderr": "Traceback (most recent call last):\n  File \"/home/atodorov/.ansible/tmp/ansible-tmp-1556112722.38-56948253796160/AnsiballZ_ali_instance_facts.py\", line 114, in <module>\n    _ansiballz_main()\n  File \"/home/atodorov/.ansible/tmp/ansible-tmp-1556112722.38-56948253796160/AnsiballZ_ali_instance_facts.py\", line 106, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/atodorov/.ansible/tmp/ansible-tmp-1556112722.38-56948253796160/AnsiballZ_ali_instance_facts.py\", line 49, in invoke_module\n    imp.load_module('__main__', mod, module, MOD_DESC)\n  File \"/tmp/ansible_ali_instance_facts_payload_qZeeM9/__main__.py\", line 396, in <module>\n  File \"/tmp/ansible_ali_instance_facts_payload_qZeeM9/__main__.py\", line 388, in main\n  File \"/home/atodorov/.virtualenvs/alibaba/lib/python2.7/site-packages/footmark/ecs/connection.py\", line 267, in get_all_instances\n    for inst in self.get_list_new(self.build_request_params(filters), ['Instances', Instance]):\nUnboundLocalError: local variable 'filters' referenced before assignment\n", 
    "module_stdout": "", 
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", 
    "rc": 1
}

This is with 1.11.0, here's my entire pip freeze b/c I've installed ansible 2.8 from GitHub:

aliyun-python-sdk-core==2.9.5
aliyun-python-sdk-ecs==4.11.0
aliyun-python-sdk-ess==2.3.0
aliyun-python-sdk-kms==2.6.0
aliyun-python-sdk-ossadmin==0.0.2
aliyun-python-sdk-rds==2.3.3
aliyun-python-sdk-slb==3.2.7
aliyun-python-sdk-vpc==3.0.2
ansible==2.8.0b1.post0
asn1crypto==0.24.0
certifi==2019.3.9
cffi==1.12.3
chardet==3.0.4
crcmod==1.7
cryptography==2.6.1
enum34==1.1.6
footmark==1.11.0
idna==2.8
importlib==1.0.4
ipaddress==1.0.22
Jinja2==2.10.1
MarkupSafe==1.1.1
oss2==2.6.1
pycparser==2.19
pycryptodome==3.8.1
PyYAML==5.1
requests==2.21.0
six==1.12.0
urllib3==1.24.2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.