You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by jun aoki <ja...@apache.org> on 2015/09/16 22:00:53 UTC

How can repoinfo.xml information be loaded every time ambari-server is started

Hi Ambari community,

Is it possible on Ambari 2.1 to load repoinfo.xml to refresh repo_version
table every time ambari-server is restarted?
Our use case is to add a service to an existing ambari cluster.
1. There is an existing ambari cluster.
2. Stop the cluster
3. Install a new service plugin (in rpm) under
/var/lib/ambari-server/resources/stacks/stack1/version1
4. Which requires a new yum repo url so the rpm's postinstall scriptlet add
the url to
/var/lib/ambari-server/resources/stacks/stack1/version1/repos/repoinfo.xml
5. Start the cluster
6. Ambari 1.7 used to load the repoinfo.xml every time it was started, so
the repo info in UI is refreshed.
7. Now with Ambari 2.1, it does not seem happening, since I believe the
repo info is versioned and stored in repo_version table.

Q1
Is there any options for ambari-server start that can load repoinfo.xml on
every startup? One allows backward compatible behavior with 1.7?

Q2
Is there any way that we can ADD a new repoinfo? UI does not have a Add
button, so clearly not through UI. repository_versions API seems to add
more repos since "repositories" column is blob[1], but it does not add
additional .repo files to all cluster nodes [2]. How can we let ambari
create the new .repo file?

[1] repository_version rest API with a new repository called "SOME". This
is adds it in the UI
```
curl '
http://ip-10-32-36-172.ore1.vpc.pivotal.io:8080/api/v1/stacks/PHD/versions/3.3/repository_versions/1'
-X PUT -H 'Pragma: no-cache' -H 'Origin:
http://ip-10-32-36-172.ore1.vpc.pivotal.io:8080' -H 'Accept-Encoding: gzip,
deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,et;q=0.6,ja;q=0.4' -H
'X-Requested-By: X-Requested-By' -H 'User-Agent: Mozilla/5.0 (Windows NT
6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85
Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded;
charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01'
-H 'Cache-Control: no-cache' -H 'X-Requested-With: XMLHttpRequest' -H
'Cookie: __utma=105804546.1805197850.1436908328.1440795651.1441054079.4;
__utmc=105804546;
__utmz=105804546.1441054079.4.4.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided);
_ga=GA1.2.1805197850.1436908328;
_mkto_trk=id:625-IUJ-009&token:_mch-pivotal.io-1438991171603-70536;
__unam=d0e70e0-14f6b71122d-cca27b6-3;
crowd.token_key=0ujsY9020uRSyRadoADPWQ00;
AMBARISESSIONID=w4ekrylwwrrh1wvqbo3l3p9wu' -H 'Connection: keep-alive' -H
'Referer: http://ip-10-32-36-172.ore1.vpc.pivotal.io:8080/' --data
'{"operating_systems":[{"OperatingSystems":{"os_type":"redhat6"},"repositories":[
{"Repositories":{"base_url":"http://ip-10-32-36-172.ore1.vpc.pivotal.io/PADS","repo_id":"PADS","repo_name":"PADS"}},
{"Repositories":{"base_url":"http://ip-10-32-36-172.ore1.vpc.pivotal.io/SOME","repo_id":"SOME","repo_name":"SOME"}},
{"Repositories":{"base_url":"
http://ip-10-32-36-172.ore1.vpc.pivotal.io/PHD-3.3.0.2","repo_id":"PHD-3.3.0.0","repo_name":"PHD"}},
{"Repositories":{"base_url":"
http://ip-10-32-36-172.ore1.vpc.pivotal.io/PHD-UTILS-1.1.0.20","repo_id":"PHD-UTILS-1.1.0.20","repo_name":"PHD-UTILS"}}
]}]}' --compressed

```

[2] this won't add a new repo calld SOME.repo here
```
ls /etc/yum.repos.d/
ambari.repo  CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo
 CentOS-Vault.repo  PADS.repo  PHD.repo  PHD-UTILS.repo
```

-- 
-jun