Giter Site home page Giter Site logo

yaas's Introduction

yaas

Yet Another Ambari Shell

Installation

pip install yaas

Usage

env YAAS_SERVER=ambari.example.com yaas [options] [command options [...]]

Global Options

  • --help

    $ yaas --help
    usage: yaas ...
    
    $ yaas help
    usage: yaas ...
    
  • --version

    $ yaas --version
    x.x.x
    
    $ yaas version
    x.x.x
    
  • --raw

    $ yaas --raw ...
    (JSON)
    
  • --debug

    $ yaas --debug ...
    (verbose)
    

Commands

All API commands require setting these environment variables:

  • YAAS_SERVER--the address or name of the Ambari server
    • Example: ambari.example.com
    • Default: none (This is required.)
  • YAAS_SCHEME--the scheme to use when connecting to the Ambari server
    • Example: https
    • Default: http
  • YAAS_PORT--the port of the Ambari server
    • Example: 443
    • Default: 8080
  • YAAS_USER--the user to auth with to the Ambari server
    • Example: l337u53r
    • Default: admin
  • YAAS_PASSWORD--the password to auth with to the ambari server
    • Example: l337p455
    • Default: admin
$ export YAAS_SERVER=ambari.example.com
$ yaas ...
$ env YAAS_SERVER=ambari.example.com yaas ...

blueprint

add

POST /api/v1/blueprints/:name

Store a blueprint on YAAS_SERVER.

$ yaas blueprint add blueprint1.json blueprint2.json
$ cat blueprint3.json | yaas blueprint add
Options
  • --validate-topology

    POST /api/v1/blueprints/:name?validate_topology=...

    Toggle topology validation.

list

GET /api/v1/blueprints

Show blueprints that are stored on YAAS_SERVER.

$ yaas blueprint list
blueprint1
blueprint2
blueprint3
  • Note: This will list the name of the actual Blueprint (as specified inside the JSON file) which may differ from the file name.
Options
  • --fields

    GET /api/v1/blueprints?fields=...

    Add blueprint details to the list.

show

GET /api/v1/blueprints/:name

Show details about a blueprint stored on YAAS_SERVER.

$ yaas blueprint show blueprint1
remove

DELETE /api/v1/blueprints/:name

Remove a blueprint stored on YAAS_SERVER.

$ yaas blueprint remove blueprint2
$ yaas blueprint list
blueprint1
blueprint3

cluster

create
$ yaas cluster create cluster1 --template=template1.json
$ cat template2.json | yaas cluster create cluster2
$ yaas cluster create cluster3
Options
  • --template
list
$ yaas cluster list
cluster1
cluster2
cluster3
show
$ yaas cluster show cluster1 --format=blueprint > blueprint1.json
$ yaas cluster show cluster2
...
Options
  • --format
destroy
$ yaas cluster destroy cluster2
$ yaas cluster list
cluster1
cluster3

host

list

GET /api/v1/hosts

Show hosts that are registered with YAAS_SERVER.

$ yaas host list
host1.example.com - cluster1
host2.example.com - cluster1
host3.example.com
Options
show
$ yaas host show [--hardware] host1.example.com host2.example.com ...
...
Options
  • --hardware

repo

add
$ yaas repo add [--verify-baseurls=true] repo.json
list

See all configured repository URLs. Limit output by one or more of these parameters. Note that stack-version and stack-version must be specified together:

  • stack-name (e.g. HDP)
  • stack-version (e.g. 2.2)
  • os-type (e.g. redhat6)
  • repo-name (e.g. HDP-UTILS)
$ yaas repo list
HDP-2.2
  redhat5
    HDP: http://www.example.com/redhat5/HDP
    HDP-UTILS: http://www.example.com/redhat5/HDP
  redhat6
    HDP: http://www.example.com/redhat6/HDP
    HDP-UTILS: http://www.example.com/redhat6/HDP-UTILS-1.1.0.20
  ...
$ yaas repo list --stack-name=HDP --stack-version=2.2 --repo-name=HDP-UTILS
redhat5
  HDP: http://www.example.com/redhat5/HDP-UTILS
redhat6
  HDP: http://www.example.com/redhat6/HDP-UTILS
...
$ yaas repo list --stack-name=HDP --stack-version=2.2 --os-type=redhat6 --repo-name=HDP
http://www.example.com/redhat6/HDP
set
$ yaas repo set [--verify-baseurls=true] repo-changed.json
remove
$ yaas repo remove HDP 2.2

template

create
$ yaas template create [--blueprint=blueprint1] [--host_group=host1.example.com ...] > template1.json
$ cat clueprint2.json | yaas template create [--host_group=host1.example.com ...] > template2.json
WARNING: You have not specified enough hosts to satisfy the blueprint.

yaas's People

Contributors

karth295 avatar dmtucker avatar tucked avatar

Watchers

Jake Low avatar

Forkers

karth295 ro-ket

yaas's Issues

Allow custom names when uploading

$ yaas blueprint add foo.json
$ yaas blueprint list
blueprint_name-in-foo
$ yaas blueprint add foo.json --name=bar
$ yaas blueprint list
blueprint_name-in-foo
bar

Uncaught ValueError when adding a non-JSON blueprint

$ yaas blueprint add README.md 
Traceback (most recent call last):
  File "/usr/local/bin/yaas", line 9, in <module>
    load_entry_point('yaas==0.0.1', 'console_scripts', 'yaas')()
  File "/usr/local/lib/python2.7/dist-packages/yaas-0.0.1-py2.7.egg/yaas/__main__.py", line 75, in main
    commands[args.command](subparsers.choices[args.command], extra)
  File "/usr/local/lib/python2.7/dist-packages/yaas-0.0.1-py2.7.egg/yaas/blueprint.py", line 30, in command
    extra)
  File "/usr/local/lib/python2.7/dist-packages/yaas-0.0.1-py2.7.egg/yaas/blueprint.py", line 48, in _add
    blueprint = json.loads(blueprint)
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Tracebacks should only show when a bug exists.

Blueprint show should not display `content` fields

Ambari blueprint of a concrete cluster includes the contents of *.xml files when you get them from /api/v1/clusters/foo?format=blueprint. However, the same blueprint cannot be posted back to the server to create a new cluster. Yaas should strip the content fields unless --raw is specified.

Ambari Content-Type is incorrect for blueprint add.

https://github.com/dmtucker/yaas/blob/master/yaas/blueprint.py#L53

        response = requests.post(
            config.href(
                '/api/v1/blueprints/{name}'.format(
                    name=blueprint['Blueprints']['blueprint_name'])),
            data=json.dumps(blueprint),  # `json=blueprint` would be better, but it doesn't work!
            params={'validate_topology': subargs.validate_topology},
            **config.requests_opts())

json=blueprint causes requests to use Content-Type: application/json which does not work correctly:

https://issues.apache.org/jira/browse/AMBARI-9016

print_field should not print `index: value` for arrays

            0
                name: OOZIE_CLIENT
            1
                name: HBASE_CLIENT
            2
                name: FALCON_CLIENT
            3
                name: TEZ_CLIENT
            4
                name: MAHOUT
            5
                name: SUPERVISOR
            6
                name: YARN_CLIENT
            7
                name: NODEMANAGER
            8
                name: METRICS_MONITOR
            9
                name: MAPREDUCE2_CLIENT
            10
                name: PIG
            11
                name: ACCUMULO_TSERVER
            12
                name: HIVE_CLIENT
            13
                name: ZOOKEEPER_CLIENT
            14
                name: HCAT
            15
                name: SPARK_CLIENT
            16
                name: HBASE_REGIONSERVER
            17
                name: HDFS_CLIENT
            18
                name: SQOOP
            19
                name: ACCUMULO_CLIENT

Help text isn't working on subcommands

usenpalank3m1:yaas karthik$ yaas host --help
usage: yaas host [-h]

optional arguments:
  -h, --help  show this help message and exit

It should show the help texts of subcommands like list and show.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.