@@ -133,13 +133,13 @@ def create_blueprint(client, mapping, template, var_file, no_prompt):
133133 raise click .UsageError ('Missing \' blueprint_dir\' in config. Please run `configure`.' )
134134
135135 if mapping :
136- mapping = yaml .safe_load (open (os .path .join (blueprint_dir , 'mappings.yaml' ), 'r' ))
137- if not mapping or mapping not in mapping :
136+ mappings = yaml .safe_load (open (os .path .join (blueprint_dir , 'mappings.yaml' ), 'r' ))
137+ if not mappings or mapping not in mappings :
138138 click .secho ('You gave an invalid mapping.' , fg = 'red' )
139139 return
140140 else :
141- template = mapping [mapping ].get ('template' )
142- var_file = mapping [mapping ].get ('var_files' , [])
141+ template = mappings [mapping ].get ('template' )
142+ var_file = mappings [mapping ].get ('var_files' , [])
143143 if not template :
144144 click .secho ('Your mapping must specify a template.' , fg = 'red' )
145145 return
@@ -217,3 +217,19 @@ def delete_all_blueprints(client):
217217 for blueprint in client .list_blueprints ():
218218 client .delete_blueprint (blueprint ['id' ])
219219 click .secho ('Deleted blueprint {0}' .format (blueprint ['title' ]), fg = 'magenta' )
220+
221+
222+ @blueprints .command (name = 'create-label' )
223+ @pass_client
224+ @click .argument ('title' )
225+ @click .argument ('key' )
226+ @click .argument ('value' )
227+ def create_label (client , title , key , value ):
228+ """
229+ Create a key:value label on a blueprint
230+ """
231+ blueprint_id = get_blueprint_id (client , title )
232+
233+ client .add_blueprint_label (blueprint_id , key , value )
234+
235+ click .echo ('Created label on {0}' .format (title ))
0 commit comments