Horizon: service: Default to v2 API
[fuel.git] / mcp / patches / 0004-maas-region-use-authorized_keys-1st-entry.patch
1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2017 Mirantis Inc., Enea AB and others.
3 :
4 : All rights reserved. This program and the accompanying materials
5 : are made available under the terms of the Apache License, Version 2.0
6 : which accompanies this distribution, and is available at
7 : http://www.apache.org/licenses/LICENSE-2.0
8 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
9 From: Charalampos Kominos <Charalampos.Kominos@enea.com>
10 Date: Sat, 5 Aug 2017 02:03:01 +0200
11 Subject: [PATCH] maas: region: use authorized_keys 1st entry
12
13 MaaS custom py modules accepts the "sshprefs" variable via pillar,
14 however we want to read it from ~ubuntu/.ssh/authorized_keys.
15
16 Bypass the py module and call MaaS CLI directly, passing the first
17 authorized key, which should be mcp.rsa.pub.
18
19 Signed-off-by: Charalampos Kominos <Charalampos.Kominos@enea.com>
20 ---
21
22 diff --git a/maas/region.sls b/maas/region.sls
23 index d3227ca..8a2243d 100644
24 --- a/maas/region.sls
25 +++ b/maas/region.sls
26 @@ -179,8 +179,14 @@
27      - module: maas_config
28
29  maas_sshprefs:
30 -  module.run:
31 -  - name: maas.process_sshprefs
32 +# NOTE(armband): maas.process_sshprefs also works, but we need to read the key
33 +#                from authorized_keys. Should be reworked at some point.
34 +# module.run:
35 +# - name: maas.process_sshprefs
36 +# - require:
37 +  cmd.run:
38 +  - name: "maas login {{ region.admin.username }} http://{{ region.bind.host }}:5240/MAAS/api/2.0 - < /var/lib/maas/.maas_credentials && SSH_KEY=$(cat authorized_keys | head -1) && maas opnfv sshkeys create \"key=$SSH_KEY\""
39 +  - cwd: "/home/ubuntu/.ssh"
40    - require:
41      - module: maas_config
42