Skip to content
This repository has been archived by the owner on Jan 19, 2018. It is now read-only.

Add "index" command to Atomic App #750

Merged
merged 1 commit into from
Jul 20, 2016
Merged

Conversation

cdrage
Copy link
Member

@cdrage cdrage commented Jun 28, 2016

This adds an index command to list multiple Nulecule's from an external
library that contains an index.yaml file in it's root directory.

Built upon @vpavlin 's work :)

TODO:

  • atomicapp index list --update command
  • "official" index docker image (will need to add this to projectatomic/nulecule-library)
  • script to generate index.yaml
  • integration tests
  • docs going to update via Update CLI docs #768

@cdrage cdrage changed the title Add "index" command to Atomic App [WIP] Add "index" command to Atomic App Jun 28, 2016
@cdrage
Copy link
Member Author

cdrage commented Jun 28, 2016

Here's what it looks like right now if you pull the PR and run atomicapp index list:

▶ atomicapp index list
INFO   :: Atomic App: 0.6.0 - Mode: Index
ID                        VER      PROVIDERS  LOCATION                                             
postgresql-atomicapp      1.0.0    {D,O,K}    docker.io/projectatomic/postgresql-centos7-atomicapp 
flask_redis_nulecule      0.0.1    {D,K}      docker.io/projectatomic/flask-redis-centos7-atomicapp
redis-atomicapp           0.0.1    {D,O,K}    docker.io/projectatomic/redis-centos7-atomicapp      
gocounter                 0.0.1    {D,K}      docker.io/projectatomic/gocounter-scratch-atomicapp  
mariadb-atomicapp         1.0.0    {D,O,K}    docker.io/projectatomic/mariadb-centos7-atomicapp    
helloapache-app           0.0.1    {D,K,M}    docker.io/projectatomic/helloapache                  
mongodb-atomicapp         1.0.0    {D,O,K}    docker.io/projectatomic/mongodb-centos7-atomicapp    
etherpad-app              0.0.1    {D,O,K}    docker.io/projectatomic/etherpad-centos7-atomicapp   
apache-centos7-atomicapp  0.0.1    {D,K,M}    docker.io/projectatomic/apache-centos7-atomicapp     
wordpress-atomicapp       2.0.0    {D,O,K}    docker.io/projectatomic/wordpress-centos7-atomicapp  
skydns-atomicapp          0.0.1    {K}        docker.io/projectatomic/skydns-atomicapp             
guestbookgo-atomicapp     0.0.1    {O,K}      docker.io/projectatomic/guestbookgo-atomicapp        
mariadb-app               0.0.1    {D,K}      docker.io/projectatomic/mariadb-fedora-atomicapp     
gitlab-atomicapp          1.2.0    {D,K}      docker.io/projectatomic/gitlab-centos7-atomicapp   

Updating:

dropbox/dev/atomicapp  add-index ✔                                                                                                                                                                                                                       0m  ⍉
▶ atomicapp index list --update
INFO   :: Atomic App: 0.6.0 - Mode: Index
INFO   :: Updating the index list
INFO   :: Pulling latest index image...
INFO   :: Skipping pulling docker image: cdrage/nulecule-library
INFO   :: Extracting Nulecule data from image cdrage/nulecule-library to /home/wikus/.atomicapp/index.yaml
INFO   :: Index updated

@cdrage cdrage force-pushed the add-index branch 5 times, most recently from e984e61 to 38393aa Compare July 4, 2016 15:05
@cdrage
Copy link
Member Author

cdrage commented Jul 4, 2016

projectatomic/nulecule-library#96 location metadata has been added for updating the information (including docker.io urls)

@cdrage cdrage force-pushed the add-index branch 4 times, most recently from e506577 to b18a177 Compare July 6, 2016 15:27
@cdrage cdrage changed the title [WIP] Add "index" command to Atomic App Add "index" command to Atomic App Jul 6, 2016
@cdrage
Copy link
Member Author

cdrage commented Jul 6, 2016

Hey guys.

Pretty much done at this point in terms of Atomic App code.

Here are the updates

  • Not going to include atomicapp index info for now until I research more on how the output format should look like, also whether or not we should include atomicapp index edit
  • Started work on tests, have two more to go
  • Need to add docs not only on how to use the command, but also that there will now be an .atomicapp/index on your system
  • Haven't tested with atomic cli functionality yet

In order to try out this PR, you must:

# with https://github.com/projectatomic/nulecule-library/pull/97 PR patched
cd nulecule-library
docker build -t projectatomic/nulecule-library .
# then
atomicapp index list # should auto-update (put the index.yaml into your .atomicapp/index.yaml

Hope you guys like it :)
@kadel @rtnpro @dustymabe @vpavlin

@cdrage
Copy link
Member Author

cdrage commented Jul 6, 2016

What I'm waiting for/block with is:

# eliminating the INFO :: Atomic App: X.X.X - Mode: Index
# logging information. If we passed --debug, ignore.
# if not logging.getLogger().getEffectiveLevel() == logging.DEBUG:
# sys.stdout.write("\033[F")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

@coveralls
Copy link

Coverage Status

Coverage increased (+1.5%) to 58.497% when pulling 2b882e1 on cdrage:add-index into d853213 on projectatomic:master.

@cdrage
Copy link
Member Author

cdrage commented Jul 14, 2016

https://hub.docker.com/r/projectatomic/nulecule-library/ has been created with the index.yaml

This has been update and ready for code review + possible merging.

@dustymabe @rtnpro @containscafeine @kadel if ya'll want to try it out / review it :)

@cdrage
Copy link
Member Author

cdrage commented Jul 14, 2016

I'll be updating the docs in a separate PR since we need to update https://github.com/projectatomic/atomicapp/blob/master/docs/cli.md anyways.
Opened up issue #768 for this.

@cdrage
Copy link
Member Author

cdrage commented Jul 14, 2016

#dotests

@coveralls
Copy link

Coverage Status

Coverage increased (+1.5%) to 58.497% when pulling e1e5919 on cdrage:add-index into d853213 on projectatomic:master.


index_list = index_action.add_parser("list")
index_list.add_argument(
"--update",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so what do you think about having this as a separate subcommand rather than an option to --list? seems like atomicapp index update would be more natural than atomicapp index list --update.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about atomicapp index pull ? (It's a docker pull anyway:) )

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That'd be good, what do you think @dustymabe ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ehh i like "update" but don't really care.. potato potato - go with whatever

@coveralls
Copy link

Coverage Status

Coverage increased (+1.5%) to 58.493% when pulling 61ebdc8 on cdrage:add-index into d853213 on projectatomic:master.

@cdrage
Copy link
Member Author

cdrage commented Jul 15, 2016

@dustymabe

updated based on your comments. added the atomicapp index update command (i liked your suggestion better). removed the random utils.py stuff I still had there as well.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.5%) to 58.47% when pulling 9f50616 on cdrage:add-index into d853213 on projectatomic:master.

@cdrage
Copy link
Member Author

cdrage commented Jul 15, 2016

#dotests

index_generate.add_argument(
"location",
help=(
"Path or Git repository link containing Nulecule applications "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'or Git repository' - is that still true?

@coveralls
Copy link

Coverage Status

Coverage increased (+1.5%) to 58.47% when pulling 2cba0b0 on cdrage:add-index into d853213 on projectatomic:master.

@cdrage
Copy link
Member Author

cdrage commented Jul 20, 2016

Hey @dustymabe

So the index_location has been updated in the init of the index.py file to the proper location via:

self.index_location = os.path.join(Utils.getUserHome(), INDEX_LOCATION)
Utils.setFileOwnerGroup(dest)

has also been added to the extract_files function so it properly sets the permission when pulling.

One last review? :)

@cdrage
Copy link
Member Author

cdrage commented Jul 20, 2016

dropbox/dev/atomicapp  add-index ✔                                                                                                                                                                                                                        1m  
▶ atomicapp index list
INFO   :: Atomic App: 0.6.1 - Mode: Index
ID                        VER      PROVIDERS  LOCATION                                             
postgresql-atomicapp      1.0.0    {D,O,K}    docker.io/projectatomic/postgresql-centos7-atomicapp 
flask_redis_nulecule      0.0.1    {D,K}      docker.io/projectatomic/flask-redis-centos7-atomicapp
redis-atomicapp           0.0.1    {D,O,K}    docker.io/projectatomic/redis-centos7-atomicapp      
gocounter                 0.0.1    {D,K}      docker.io/projectatomic/gocounter-scratch-atomicapp  
mariadb-atomicapp         1.0.0    {D,O,K}    docker.io/projectatomic/mariadb-centos7-atomicapp    
helloapache-app           0.0.1    {D,K,M}    docker.io/projectatomic/helloapache                  
mongodb-atomicapp         1.0.0    {D,O,K}    docker.io/projectatomic/mongodb-centos7-atomicapp    
etherpad-app              0.0.1    {D,O,K}    docker.io/projectatomic/etherpad-centos7-atomicapp   
apache-centos7-atomicapp  0.0.1    {D,K,M}    docker.io/projectatomic/apache-centos7-atomicapp     
wordpress-atomicapp       2.0.0    {D,O,K}    docker.io/projectatomic/wordpress-centos7-atomicapp  
skydns-atomicapp          0.0.1    {K}        docker.io/projectatomic/skydns-atomicapp             
guestbookgo-atomicapp     0.0.1    {O,K}      docker.io/projectatomic/guestbookgo-atomicapp        
mariadb-app               0.0.1    {D,K}      docker.io/projectatomic/mariadb-fedora-atomicapp     
gitlab-atomicapp          1.2.0    {D,K}      docker.io/projectatomic/gitlab-centos7-atomicapp     

dropbox/dev/atomicapp  add-index ✔                                                                                                                                                                                                                        1m  
▶ atomicapp index update
INFO   :: Atomic App: 0.6.1 - Mode: Index
INFO   :: Updating the index list
INFO   :: Pulling latest index image...
INFO   :: Skipping pulling docker image: projectatomic/nulecule-library
INFO   :: Copying files from image projectatomic/nulecule-library:/index.yaml to /home/wikus/.atomicapp/index.yaml
INFO   :: Index updated

And the permissions:

▶ tree ~/.atomicapp -ug 
/home/wikus/.atomicapp
└── [wikus    wikus   ]  index.yaml

0 directories, 1 file

@coveralls
Copy link

Coverage Status

Coverage increased (+1.2%) to 58.121% when pulling e51eed5 on cdrage:add-index into 52f96ea on projectatomic:master.

This adds an index command to list multiple Nulecule's from an external
library that contains an index.yaml file in it's root directory.
@coveralls
Copy link

Coverage Status

Coverage increased (+1.2%) to 58.121% when pulling 334cafe on cdrage:add-index into 52f96ea on projectatomic:master.

@dustymabe
Copy link
Contributor

LGTM

@cdrage
Copy link
Member Author

cdrage commented Jul 20, 2016

#dotests

@cdrage cdrage merged commit e241be5 into projectatomic:master Jul 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants