vespene-io / _old_vespene

DISCONTINUED: a frozen fork will exist forever at mpdehaan/vespene
http://vespene.io/
Apache License 2.0
650 stars 66 forks source link

Simplest project throws 'NoneType' object has no attribute 'append_message' #66

Closed muki closed 6 years ago

muki commented 6 years ago

Bug description Any type of script I can come up with errors with the same output. More details here: https://talk.vespene.io/t/simplest-project-throws-nonetype-object-has-no-attribute-append-message/46

Steps to reproduce Install on Debian 9, create a new project, in the script echo anything.

Expected behavior The script should successfully execute and show the intended echo stuff in output.

Actual behavior The script dies with the message 'NoneType' object has no attribute 'append_message'

Any additional info Logging output from the worker log:

2018-11-01 23:27:35,204 - vespene - DEBUG - building: 9, project: stanovanja-build
2018-11-01 23:27:35,270 - vespene - DEBUG - executing: mkdir -p 9
2018-11-01 23:27:35,294 - vespene - DEBUG - executing: chmod 770 9
2018-11-01 23:27:35,342 - vespene - DEBUG - adding SSH key with passphrase!
2018-11-01 23:27:35,344 - vespene - DEBUG - /tmp/tmpegsf1c2o
2018-11-01 23:27:35,345 - vespene - DEBUG - /tmp/tmpb4q8bbs2
2018-11-01 23:27:35,345 - vespene - DEBUG - executing: /usr/bin/expect -f /tmp/tmpegsf1c2o
2018-11-01 23:27:35,353 - vespene - ERROR - an error occurred
Traceback (most recent call last):
  File "/opt/vespene/vespene/workers/builder.py", line 158, in go
    self.main()
  File "/opt/vespene/vespene/workers/builder.py", line 63, in main
    self.ssh_manager.add_all_keys()
  File "/opt/vespene/vespene/workers/ssh_agent.py", line 30, in add_all_keys
    self.add_key(access)
  File "/opt/vespene/vespene/workers/ssh_agent.py", line 48, in add_key
    self.ssh_add_with_passphrase(keyfile, access.get_unlock_password())
  File "/opt/vespene/vespene/workers/ssh_agent.py", line 86, in ssh_add_with_passphrase
    commands.execute_command(None, "/usr/bin/expect -f %s" % fname)
  File "/opt/vespene/vespene/workers/commands.py", line 128, in execute_command
    build.append_message("build failed with exit code %s" % process.returncode)
AttributeError: 'NoneType' object has no attribute 'append_message'
2018-11-01 23:27:35,355 - vespene - DEBUG - flagging build as failure
2018-11-01 23:27:35,387 - vespene - DEBUG - flagging build as done
mpdehaan commented 6 years ago

Hi @muki

This error was an error down the error path, which occurs when the combination of the key and passphrase did not work well together. Because it was down the error path, I neglected to find an error in my code here.

I've fixed the error, so if you update the code, you should now get a failure message.

By guess is that either you pasted the public key (it needs the private one) or the unlock password was not the correct unlock password for the private key.

I am going to close this ticket but let us know if you have further setup problems on the message board, and thanks again for the report!

mpdehaan commented 6 years ago

(The app should probably provide a hint in this case about the likely cause as well, this is on my list to upgrade in the near future as well)

muki commented 6 years ago

Unfortunately this did not solve the issue for me. The log was still (largely) the same:

2018-11-01 23:27:35,204 - vespene - DEBUG - building: 9, project: stanovanja-build
2018-11-01 23:27:35,270 - vespene - DEBUG - executing: mkdir -p 9
2018-11-01 23:27:35,294 - vespene - DEBUG - executing: chmod 770 9
2018-11-01 23:27:35,342 - vespene - DEBUG - adding SSH key with passphrase!
2018-11-01 23:27:35,344 - vespene - DEBUG - /tmp/tmpegsf1c2o
2018-11-01 23:27:35,345 - vespene - DEBUG - /tmp/tmpb4q8bbs2
2018-11-01 23:27:35,345 - vespene - DEBUG - executing: /usr/bin/expect -f /tmp/tmpegsf1c2o
2018-11-01 23:27:35,353 - vespene - ERROR - an error occurred
Traceback (most recent call last):
  File "/opt/vespene/vespene/workers/builder.py", line 158, in go
    self.main()
  File "/opt/vespene/vespene/workers/builder.py", line 63, in main
    self.ssh_manager.add_all_keys()
  File "/opt/vespene/vespene/workers/ssh_agent.py", line 30, in add_all_keys
    self.add_key(access)
  File "/opt/vespene/vespene/workers/ssh_agent.py", line 48, in add_key
    self.ssh_add_with_passphrase(keyfile, access.get_unlock_password())
  File "/opt/vespene/vespene/workers/ssh_agent.py", line 86, in ssh_add_with_passphrase
    commands.execute_command(None, "/usr/bin/expect -f %s" % fname)
  File "/opt/vespene/vespene/workers/commands.py", line 128, in execute_command
    build.append_message("build failed with exit code %s" % process.returncode)
AttributeError: 'NoneType' object has no attribute 'append_message'
2018-11-01 23:27:35,355 - vespene - DEBUG - flagging build as failure
2018-11-01 23:27:35,387 - vespene - DEBUG - flagging build as done

So I poked around the ssh_agent.py and added some extra logging to it and made sure that both the key and the password were correct. After that I looked at the temporary files the script creates and tried executing them by hand. It turned out I didn't have expect installed on the machine in question. I guess this should be added to an install script? I'm guessing 1_prepare.sh?

mpdehaan commented 6 years ago

Line 86 shows that you didn't update the code in /opt/vespene with my changes, looks like.

I agree logging here should be upgraded.

Yes Debian will need to install expect I'll reference this the Debian ticket.

mpdehaan commented 6 years ago

Sorry for short reply on this one - I think most of my comments are over here: https://talk.vespene.io/t/simplest-project-throws-nonetype-object-has-no-attribute-append-message/46/10

I don't get notifications on closed tickets, so if you have thoughts please post over there!

I think I may have also gotten you confused with the Debian ticket so if this is NOT Debian let me know.