cloudfoundry-community / cloudfoundry-community/cf-python-client
NoneType' object has no attribute 'items'
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 55
- Fork
- 54
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hi There
Stumbled upon this issue when building out a flask application but have also noticed this when just testing the code in a simple consistent loop.
Looking for pointers if there is something obvious I am missing in this.
Using Username/Password to authenticate.
Error usually occurs after 10-15 mins of running without issue.
SCRIPT CODE
foundation_name = 'lab'
target_endpoint = '<URL>'
proxy = dict(http=os.environ.get('HTTP_PROXY', ''), https=os.environ.get('HTTPS_PROXY', ''))
client = CloudFoundryClient(target_endpoint, proxy=proxy, verify=False)
client.init_with_user_credentials('<USERNAME>','<PAASWORD>')
def app_buildpacks():
app_buildpack_usage = []
app_buildpack_table_field_names = ['App Name', 'Buildpack Used', ' Buildpack Stack', 'GUID', 'Filename' , 'Locked']
for app in client.v2.apps:
app_name = app['entity']['name']
app_buildpack_name = app['entity']['detected_buildpack'] or app['entity']['buildpack']
app_buildpack_guid = app['entity']['detected_buildpack_guid']
for buildpack in client.v2.buildpacks:
buildpack_guid = buildpack['metadata']['guid']
if app_buildpack_guid == buildpack_guid:
buildpack_name = buildpack['entity']['name']
buildpack_stack = buildpack['entity']['stack']
buildpack_filename = buildpack['entity']['filename']
buildpack_lock = buildpack['entity']['locked']
d = {
'app_name' : app_name ,
'buildpack_name' : buildpack_name,
'buildpack_stack' : buildpack_stack ,
'buildpack_guid' : buildpack_guid,
'buildpack_filename': buildpack_filename,
'buildpack_lock' : buildpack_lock
}
app_buildpack_usage.append(d)
# Sort the list by name
app_buildpack_usage = sorted(app_buildpack_usage, key = lambda i: i['buildpack_name'])
# Return the two values ( Builpack usage list of dicts and table headers )
return app_buildpack_usage,app_buildpack_table_field_names
def background():
global app_buildpack_usage, app_buildpack_table_field_names
while True:
try:
app_buildpack_usage,app_buildpack_table_field_names = app_buildpacks()
def foreground():
@app.route('/app_buildpacks')
def app_buildpacks_page():
return render_template('app_buildpack_table.html', colnames=app_buildpack_table_field_names, app_buildpack_usage=app_buildpack_usage)
b = threading.Thread(name='background', target=background)
f = threading.Thread(name='foreground', target=foreground)
b.start()
f.start()
ERROR
\Python37\lib\site-packages\cloudfoundry_client\v2\entities.py", line 66, in _list
yield entity_builder(list(resource.items()))
\Python37\lib\site-packages\cloudfoundry_client\v2\apps.py", line 51, in <lambda>
lambda pairs: _Application(target_endpoint, client, pairs))
\Python37\lib\site-packages\cloudfoundry_client\v2\entities.py", line 17, in __init__
for attribute, value in list(self['entity'].items()):
AttributeError: 'NoneType' object has no attribute 'items'
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia da cloudfoundry_client/v2/entities.py in _list e dal costruttore _Application in cloudfoundry_client/v2/apps.py, usando il traceback fornito e i cicli ripetuti client.v2.apps e client.v2.buildpacks come percorso di riproduzione. Determina perché una risorsa elencata ha un’entità null dopo 10–15 minuti e aggiungi un test di regressione per quella risposta; il lavoro è completato quando il ciclo non solleva più AttributeError.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- api, backend
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100