Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: recipe_modules/properties/api.py

Issue 2710923003: Include slavename in properties.legacy() (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The LUCI Authors. All rights reserved. 1 # Copyright 2013 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 from recipe_engine import recipe_api 5 from recipe_engine import recipe_api
6 from recipe_engine.types import freeze 6 from recipe_engine.types import freeze
7 import collections 7 import collections
8 8
9 # Use RecipeApiPlain because collections.Mapping has its own metaclass. 9 # Use RecipeApiPlain because collections.Mapping has its own metaclass.
10 # Additionally, nothing in this class is a composite_step (nothing in this class 10 # Additionally, nothing in this class is a composite_step (nothing in this class
(...skipping 24 matching lines...) Expand all
35 def __getitem__(self, key): 35 def __getitem__(self, key):
36 return self._properties[key] 36 return self._properties[key]
37 37
38 def __len__(self): 38 def __len__(self):
39 return len(self._properties) 39 return len(self._properties)
40 40
41 def __iter__(self): 41 def __iter__(self):
42 return iter(self._properties) 42 return iter(self._properties)
43 43
44 def legacy(self): # pragma: no cover 44 def legacy(self): # pragma: no cover
45 """Returns a reduced set of properties, possibly used by legacy scripts.""" 45 """Returns a set of properties, possibly used by legacy scripts."""
46 46
47 # Add all properties to this blacklist that are required for testing, but 47 # Add all properties to this blacklist that are required for testing, but
48 # not used by any lecacy scripts, in order to avoid vast expecation 48 # not used by any lecacy scripts, in order to avoid vast expecation
49 # changes. 49 # changes.
50 blacklist = set([ 50 blacklist = set([
51 'buildbotURL', 51 'buildbotURL',
52 ]) 52 ])
53 return {k: v for k, v in self.iteritems() if k not in blacklist} 53 props = {k: v for k, v in self.iteritems() if k not in blacklist}
54 if props.get('bot_id') and not props.get('slavename'):
55 props['slavename'] = props['bot_id']
56 return props
54 57
55 def thaw(self): 58 def thaw(self):
56 """Returns a vanilla python jsonish dictionary of properties.""" 59 """Returns a vanilla python jsonish dictionary of properties."""
57 return self.properties_client.get_properties() 60 return self.properties_client.get_properties()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698