Comments (6)
I haven't done enough development on linch-pin to be authoritative on the best way to implement this, but what @herlo just suggested sounds like it will work just fine for my use case.
from linchpin.
@robled : Good catch . Linchpin cli as of now just initiates the Ansible API and does not return anything. I guess we can return Ansible API exit status through linchpin.
from linchpin.
@robled can you look at this with regard to the latest develop tree?
from linchpin.
Just tested using the latest code from develop as of the time of this post, but I still get exit code zero if I simulate a provisioning failure:
(linchpindevelop) [vagrant@localhost openstack-slave]$ git -C ~/linch-pin/ branch
* develop
(linchpindevelop) [vagrant@localhost openstack-slave]$ linchpin --version
linchpin version 1.0.0a4
(linchpindevelop) [vagrant@localhost openstack-slave]$ linchpin rise
target: cinch, action: up
PLAY [schema check and Pre Provisioning Activities on topology_file] ***********
<snip>
TASK [openstack : Including credentials of current resource cinch-group] *******
fatal: [localhost]: FAILED! => {"ansible_facts": {}, "changed": false, "failed": true, "message": "Unable to find 'roles/openstack/vars/os_creds.yml' in expected paths."}
to retry, use: --limit @/home/vagrant/linch-pin/linchpin/provision/site.retry
PLAY RECAP *********************************************************************
localhost : ok=13 changed=0 unreachable=0 failed=1
(linchpindevelop) [vagrant@localhost openstack-slave]$ echo $?
0
from linchpin.
After pondering this some, it's clear this is not a simple thing to resolve. In fact, there are many things to consider. For instance, what if the provisioning works for one of the topologies, but not the other. Is that still a failure? And if so, what error code do we assign? It also brings up the question of whether or not things should continue running on a failure of one particular action. Some of these can be managed by flags or options for sure, but a return code is a pretty vague representation of what actually happened.
Currently, I'm thinking that linchpin needs to manage error handling differently at the api level than from the cli level. We can definitely fail (exit 1, sort of thing) in the runcli
functionality. If this is all you need, that can be adapted easily enough. If the playbooks fail, or the cli fails, exit 1. Additionally, we're going to be putting together a RESTful api at some point in the future (probably around 1.2), which will handle errors differently as well.
What I want to understand, from the perspective of this issue, is if exit 1 is good enough for you when ANYTHING fails?
from linchpin.
Per discussions with @robled and @samvarankashyap and others, we decided to approach this piecemeal. For the command line interface, a return code will be given if any failure happens along the way. Essentially, each command-line function will be wrapped in a try/except clause. When an exception is raised, the cli tooling will return error codes that match the ones here: https://github.com/ansible/ansible/blob/devel/bin/ansible#L115
from linchpin.
Related Issues (20)
- AWS EC2 provisioning fails when `count` is not set
- Example link deprecated
- no_monitor option cannot be set in linchpin.conf
- Error message showing up during linchpin container build HOT 1
- Linchpin installation fails on centos8 due to openstacksdk error
- Linchpin 1.7.2 failing on openstack provisioning on python 2.7 release
- Linchpin 2.0 fails on latest version of tinydb 4.0
- Packaging process disabled HOT 7
- Beaker payload definition - Add support for reservesys XML element
- Failed to provision openstack port with os_port due to missing network param
- can't successfully buildh linchpin container followed by official documentation HOT 7
- failed: [localhost] (item=None) => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false} HOT 4
- TypeError: get() got an unexpected keyword argument 'eid' HOT 5
- Can't successfully destroy provisioned VM based on contrainfra/linchpin HOT 4
- Support and document how to create blank libvirt VMs HOT 5
- 'linchpin_mock' is undefined HOT 5
- Failed to destroy beaker machine HOT 9
- [OpenStack] Additional Volumes should be cleaned when I hit linchpin destroy HOT 4
- Provisioning from beaker is failed on fedora 33 HOT 3
- Possible Improvement Scope: Leftover Installation in the Ansible test scripts HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linchpin.