Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Invalid syntax error #30

Closed
tebowy opened this issue Jul 26, 2014 · 6 comments
Closed

Invalid syntax error #30

tebowy opened this issue Jul 26, 2014 · 6 comments

Comments

@tebowy
Copy link

tebowy commented Jul 26, 2014

Freshly cloned streisand and ansible from arch repos (yes, I have dopy).

Streisand will now set up your server. This process usually takes around ten minutes. Press Enter to continue...
: 
 __________________________________________ 
< PLAY [Provision the DigitalOcean Server] >
 ------------------------------------------ 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


 _________________ 
< GATHERING FACTS >
 ----------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


failed: [127.0.0.1] => {"failed": true, "parsed": false}
invalid output was:   File "/home/ssl/.ansible/tmp/ansible-tmp-1406387269.22-70590257918076/setup", line 476
    except OSError, e:
                  ^
SyntaxError: invalid syntax

 ______________________________________________________ 
< TASK: genesis-digitalocean | Get the default SSH key >
 ------------------------------------------------------ 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


failed: [localhost] => {"failed": true, "parsed": false}
invalid output was:   File "/home/ssl/.ansible/tmp/ansible-tmp-1406387269.28-71318004951042/command", line 517
    except OSError, e:
                  ^
SyntaxError: invalid syntax


FATAL: all hosts have already failed -- aborting
 ____________ 
< PLAY RECAP >
 ------------ 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


           to retry, use: --limit @/home/ssl/digitalocean.retry

127.0.0.1                  : ok=0    changed=0    unreachable=0    failed=1   
localhost                  : ok=0    changed=0    unreachable=0    failed=1 
@jlund
Copy link
Member

jlund commented Jul 26, 2014

This error can happen when you try to run Ansible using a Python 3.x interpreter. Using Python 2.6 or 2.7 instead should resolve the problem. I found this information here.

Once you have Python 2.7 installed, you can change the inventory file to look like this:

[localhost]
127.0.0.1 ansible_python_interpreter=python2

Let me know if this works for you. If it does, I will add a section to the README for Arch Linux users.

As a sidenote, does Arch install cowsay alongside Ansible, or did you already have it installed? That's a fun little Ansible easter egg.

@tebowy
Copy link
Author

tebowy commented Jul 26, 2014

does Arch install cowsay alongside Ansible

Nope, I've installed it myself (cuz how I am suposed to live w/o that? ;)

I'll update you later on the inventory file

@tebowy
Copy link
Author

tebowy commented Jul 27, 2014

 __________________________________________ 
< PLAY [Provision the DigitalOcean Server] >
 ------------------------------------------ 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


 _________________ 
< GATHERING FACTS >
 ----------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


ok: [127.0.0.1]
 ______________________________________________________ 
< TASK: genesis-digitalocean | Get the default SSH key >
 ------------------------------------------------------ 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


changed: [127.0.0.1]
 _________________________________________________ 
/ TASK: genesis-digitalocean | Add the SSH key to \
\ DigitalOcean if it doesn't already exist        /
 ------------------------------------------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


ok: [127.0.0.1]
 _________________________________________________________ 
/ TASK: genesis-digitalocean | Get the latest 'Debian 7.0 \
\ x64' image ID from the DigitalOcean API                 /
 --------------------------------------------------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


failed: [127.0.0.1] => {"changed": true, "cmd": "curl -s 'https://api.digitalocean.com/images/?client_id=77888d375054386f360505770d252b57&api_key=3b10a7aa68ed42bb6b11c5e4bc1d443e' | python -c 'import json; import sys; j = json.loads(sys.stdin.read()); print [img for img in j[\"images\"] if img[\"slug\"]==\"debian-7-0-x64\"][0][\"id\"]' ", "delta": "0:00:01.666230", "end": "2014-07-27 19:17:21.866818", "rc": 1, "start": "2014-07-27 19:17:20.200588"}
stderr:   File "<string>", line 1
    import json; import sys; j = json.loads(sys.stdin.read()); print [img for img in j["images"] if img["slug"]=="debian-7-0-x64"][0]["id"]
                                                                            ^
SyntaxError: invalid syntax

FATAL: all hosts have already failed -- aborting
 ____________ 
< PLAY RECAP >
 ------------ 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


           to retry, use: --limit @/home/ssl/digitalocean.retry

127.0.0.1                  : ok=3    changed=1    unreachable=0    failed=1   

I have dopy from sudo pip2 install dopy. The specific inventory file you are talking about is the one in repo, right?

~/hack/streisand (git)-[master] % cat inventory
[localhost]
127.0.0.1 ansible_python_interpreter=python2

@tebowy
Copy link
Author

tebowy commented Jul 27, 2014

I have tried running this in virtualenv, also doesn't work (my venv's python is python2, for reference)

jlund added a commit that referenced this issue Jul 27, 2014
distribution ID API requests in the DigitalOcean and Linode roles.

Partial fix for #30.
@jlund
Copy link
Member

jlund commented Jul 27, 2014

There are two tasks that use Python to parse JSON responses from the DigitalOcean and Linode APIs in order to determine the most up-to-date Debian 7 image IDs to use for newly launched servers. These tasks were using python as the executable, which meant in your case that they were being run through the Python 3 interpreter.

Can you do a git pull and try it again now? Keep the ansible_python_interpreter=python2 line in your streisand/inventory file. The commit that I just pushed changes these API tasks to use the value of the ansible_python_interpreter variable instead, which should work!

Thank you for your help in troubleshooting this so far. I definitely want to support Arch!

@tebowy
Copy link
Author

tebowy commented Jul 27, 2014

Yesss, it works now (for reference: I have fiddled a bit with my setup, my ansible now comes from venv and pip2, not bare packages (which also are avaiable.))

@tebowy tebowy closed this as completed Jul 27, 2014
jlund added a commit that referenced this issue Jul 29, 2014
alimakki added a commit to alimakki/streisand that referenced this issue Apr 29, 2017
# This is the 1st commit message:
initial fr commit

# This is the commit message StreisandEffect#2:

readme completed

# This is the commit message StreisandEffect#3:

corrections

# This is the commit message StreisandEffect#4:

readme done

# This is the commit message StreisandEffect#5:

readme even more done

# This is the commit message StreisandEffect#6:

more corrections

# This is the commit message StreisandEffect#7:

initial commit for translated instructions

# This is the commit message StreisandEffect#8:

fixed typos

# This is the commit message StreisandEffect#9:

fixed markdown

# This is the commit message StreisandEffect#10:

fixed anchor

# This is the commit message StreisandEffect#11:

grammar and typos

# This is the commit message StreisandEffect#12:

fixed markdown

# This is the commit message StreisandEffect#13:

finished french instructions for windows l2tp/ipsec

# This is the commit message StreisandEffect#14:

androïde

# This is the commit message StreisandEffect#15:

finished osx instructions for l2tp/ipsec

# This is the commit message StreisandEffect#16:

finished linux l2tp/ipsec

# This is the commit message StreisandEffect#17:

finished ios l2tp/ipsec

# This is the commit message StreisandEffect#18:

common entries in l2tp translated

# This is the commit message StreisandEffect#19:

minor corrections

# This is the commit message StreisandEffect#20:

android l2tp/ipsec translations done

# This is the commit message StreisandEffect#21:

l2tp/ipsec french done

# This is the commit message StreisandEffect#22:

typos

# This is the commit message StreisandEffect#23:

initial commit for openconnect

# This is the commit message StreisandEffect#24:

partial windows instructions completed

# This is the commit message StreisandEffect#25:

removed idea files

# This is the commit message StreisandEffect#26:

renamed readme_fr to readme-fr

# This is the commit message StreisandEffect#27:

windows oc instructions done

# This is the commit message StreisandEffect#28:

finished osx instructions, updated brew url to https

# This is the commit message StreisandEffect#29:

oc linux instructions done, minor corrections

# This is the commit message StreisandEffect#30:

stuff

# This is the commit message StreisandEffect#31:

oc instructions french done

# This is the commit message StreisandEffect#32:

minor correction

# This is the commit message StreisandEffect#33:

initial commit for openvpn instructions fr

# This is the commit message StreisandEffect#34:

finished windows ovpn instructions

# This is the commit message StreisandEffect#35:

copypasta the common stuff

# This is the commit message StreisandEffect#36:

typos

# This is the commit message StreisandEffect#37:

removed azure from upcoming features fr

# This is the commit message StreisandEffect#38:

updated azure Readme-fr.md

# This is the commit message StreisandEffect#39:

Silence la censure. Automatiser l'effet

# This is the commit message StreisandEffect#40:

minor corrections

# This is the commit message StreisandEffect#41:

minor corrections

# This is the commit message StreisandEffect#42:

more translations

# This is the commit message StreisandEffect#43:

finished macos ovpn instructions

# This is the commit message StreisandEffect#44:

eeeeeeeeee

# This is the commit message StreisandEffect#45:

openvpn linux cli done

# This is the commit message StreisandEffect#46:

finish linux ovpn network manager

# This is the commit message StreisandEffect#47:

ovpn android done

# This is the commit message StreisandEffect#48:

finished ovpn ios instructions

# This is the commit message StreisandEffect#49:

minor correction

# This is the commit message StreisandEffect#50:

initial commit for shadowsocks-fr

# This is the commit message StreisandEffect#51:

windows shadowsocks done

# This is the commit message StreisandEffect#52:

shadowsocks macos done

# This is the commit message StreisandEffect#53:

really macos is done

# This is the commit message StreisandEffect#54:

commit before merge

# This is the commit message StreisandEffect#55:

finished ff shadowsocks instructions

# This is the commit message StreisandEffect#56:

shadowsocks done

# This is the commit message StreisandEffect#57:

initial commit for wg fr

# This is the commit message StreisandEffect#58:

initial commit for ssh fr

# This is the commit message StreisandEffect#59:

windows ssh instructions done

# This is the commit message StreisandEffect#60:

linux-osx ssh done

# This is the commit message StreisandEffect#61:

linux osx alternative ssh done

# This is the commit message StreisandEffect#62:

android almost done

# This is the commit message StreisandEffect#63:

finished instructions for shadowsocks

# This is the commit message StreisandEffect#64:

mirror index fr done

# This is the commit message StreisandEffect#65:

tunnel ssh

# This is the commit message StreisandEffect#66:

progress for streisang-gateway fr

# This is the commit message StreisandEffect#67:

finished windows gateway instructions

# This is the commit message StreisandEffect#68:

manual ssl verification done

# This is the commit message StreisandEffect#69:

one more line

# This is the commit message StreisandEffect#70:

finished osx android gateway fr

# This is the commit message StreisandEffect#71:

ios gateway done

# This is the commit message StreisandEffect#72:

finished all of gateway instructions fr

# This is the commit message StreisandEffect#73:

initial commit for tor-fr

# This is the commit message StreisandEffect#74:

tor done

# This is the commit message StreisandEffect#75:

initial commit for azure-fr.md

# This is the commit message StreisandEffect#76:

azure-fr done

# This is the commit message StreisandEffect#77:

preparing to link it all up

# This is the commit message StreisandEffect#78:

working on i18n generation

# This is the commit message StreisandEffect#79:

Streisand CI Testing

# This is the commit message StreisandEffect#80:

attempt i18n..

# This is the commit message StreisandEffect#81:

removed commented stuff

# This is the commit message StreisandEffect#82:

fixed lang loop in md templates

# This is the commit message StreisandEffect#83:

spelling

# This is the commit message StreisandEffect#84:

regex_replace

# This is the commit message StreisandEffect#85:

regex_replace

# This is the commit message StreisandEffect#86:

langauge_name

# This is the commit message StreisandEffect#87:

item in loop

# This is the commit message StreisandEffect#88:

trying iteritems

# This is the commit message StreisandEffect#89:

ocserv i18n

# This is the commit message StreisandEffect#90:

openvpn i18n

# This is the commit message StreisandEffect#91:

fixed stunnel status

# This is the commit message StreisandEffect#92:

updated shadowsocks instructions

# This is the commit message StreisandEffect#93:

shadowsocks i18n

# This is the commit message StreisandEffect#94:

finished ssh i18n

# This is the commit message StreisandEffect#95:

finished gateway i18n

# This is the commit message StreisandEffect#96:

adding index and firewall fr

# This is the commit message StreisandEffect#97:

finished tor i18n, adding .html to templates

# This is the commit message StreisandEffect#98:

finished wg i18n

# This is the commit message StreisandEffect#99:

wg with_dict not with_items

# This is the commit message StreisandEffect#100:

fixed streisand mirror index task

# This is the commit message StreisandEffect#101:

fixed shadowsocks mirror index fr

# This is the commit message #102:

streisand_markdown_mirror_page removed

# This is the commit message StreisandEffect#103:

streisand_ci = no

# This is the commit message StreisandEffect#104:

fixed tor gateway instructions

# This is the commit message StreisandEffect#105:

hopefully fixes all page generation issues

# This is the commit message StreisandEffect#106:

updated index-fr.html

# This is the commit message StreisandEffect#107:

l2tp oconnect should generate correctly now

# This is the commit message StreisandEffect#108:

fixed mirror links for i18n

# This is the commit message StreisandEffect#109:

finished remaining translation, mirror link fixes

# This is the commit message StreisandEffect#110:

fixed stunnel instructions

# This is the commit message StreisandEffect#111:

hopefully the last of the corrections

# This is the commit message StreisandEffect#112:

typos and grammatics

# This is the commit message StreisandEffect#113:

more corrections

# This is the commit message StreisandEffect#114:

mirroring french localized tor

# This is the commit message StreisandEffect#115:

minor corrections

# This is the commit message StreisandEffect#116:

clarifications

# This is the commit message StreisandEffect#117:

Somme de contrôle

# This is the commit message StreisandEffect#118:

s/potatso/cross

# This is the commit message StreisandEffect#119:

changed google links for fr to hl=fr

# This is the commit message StreisandEffect#120:

copypasta quirk

# This is the commit message StreisandEffect#121:

cleanup, removed shadowsocks OTA

# This is the commit message StreisandEffect#122:

removed shadowsocks from unattended upgrades

# This is the commit message StreisandEffect#123:

removed unecessary stuff from unattended upgrades

# This is the commit message StreisandEffect#124:

Streisand CI Testing

# This is the commit message StreisandEffect#125:

CI updates based on feedback

# This is the commit message StreisandEffect#126:

permissions

# This is the commit message StreisandEffect#127:

updated readme-fr

# This is the commit message StreisandEffect#128:

Update readme-fr

No need for brew update anymore

# This is the commit message StreisandEffect#129:

removed ci
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants