Skip to content
This repository has been archived by the owner. It is now read-only.

Refactor nulecule base [Fixes #145] #278

Merged
merged 35 commits into from Nov 3, 2015

Conversation

@rtnpro
Copy link
Member

@rtnpro rtnpro commented Sep 18, 2015

This includes initial work on refactoring Nulecule base code, as discussed in #145 .


class Nulecule(NuleculeBase):
"""
This represents a Nulecule application. A Nulecule instance can have
Copy link
Contributor

@goern goern Sep 18, 2015

Choose a reason for hiding this comment

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

just this morning a little picky... "an Application compliant with the Nulecule Specification" ;)

@goern goern added this to the CDK 2 beta-3 milestone Sep 18, 2015
@vpavlin
Copy link
Contributor

@vpavlin vpavlin commented Sep 18, 2015

Hmm..you are quick, guys:) I put this together yesterday: https://gist.github.com/vpavlin/f46444efd647e0d8a48f

Maybe I missed some discussion, so if that's the case, can we reiterate on it? Or if that didn't happen, can I have one, please?:)

self.requirements = requirements
self.params = params or []
self.namespace = namespace
self.config = self.load_config(config, self.params, self.namespace)
Copy link
Contributor

@vpavlin vpavlin Sep 21, 2015

Choose a reason for hiding this comment

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

What about moving this to load(), or moving load_components() out of load ?

@aweiteka
Copy link
Contributor

@aweiteka aweiteka commented Sep 22, 2015

I haven't done a full code review but I agree this is in the right direction. It will help with my work in progress #142 .

@vpavlin do you consider this foundational to address your gist?

@vpavlin
Copy link
Contributor

@vpavlin vpavlin commented Sep 23, 2015

@aweiteka Yes, I think this is going into the right direction:)

@landscape-bot
Copy link

@landscape-bot landscape-bot commented Sep 23, 2015

Code Health
Repository health decreased by 1% when pulling 591ac68 on rtnpro:refactor_nulecule_base into cb931ec on projectatomic:master.

@cdrage
Copy link
Member

@cdrage cdrage commented Sep 23, 2015

👍 on the docker-py, if we decide to use that we can interact with the docker commands more programatically.

although this does add another dependancy...

@goern thoughts?

@landscape-bot
Copy link

@landscape-bot landscape-bot commented Sep 27, 2015

Code Health
Repository health decreased by 2% when pulling ef755c0 on rtnpro:refactor_nulecule_base into cb931ec on projectatomic:master.

@landscape-bot
Copy link

@landscape-bot landscape-bot commented Oct 6, 2015

Code Health
Repository health decreased by 5% when pulling fa2aa73 on rtnpro:refactor_nulecule_base into 80d17bf on projectatomic:master.

@aweiteka
Copy link
Contributor

@aweiteka aweiteka commented Oct 7, 2015

@rtnpro nice work! LGTM

@cdrage
Copy link
Member

@cdrage cdrage commented Oct 7, 2015

@rtnpro

Few questions,

  • Is there any possibility to add some testing?
  • Is it bad naming practice to have both a NuleculeBase and Nulecule_Base? As that's what we currently have

self.app_name = '{}-{}'.format(
Utils.sanitizeName(self.image), uuid.uuid1())
self.nulecule = None
self.unpack_path = os.path.join(CACHE_DIR, self.app_name)
Copy link
Member

@cdrage cdrage Oct 7, 2015

Choose a reason for hiding this comment

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

What is /var/atomicapp doesn't exist? fails?

@cdrage
Copy link
Member

@cdrage cdrage commented Oct 7, 2015

@rtnpro can you rebase too so I can git clone your branch and test it :)

@rtnpro rtnpro force-pushed the refactor_nulecule_base branch from fa2aa73 to 783940c Oct 7, 2015
@rtnpro
Copy link
Member Author

@rtnpro rtnpro commented Oct 7, 2015

@charliedrage I just rebased the branch :)

@rtnpro
Copy link
Member Author

@rtnpro rtnpro commented Oct 7, 2015

On Wed, Oct 7, 2015 at 6:20 PM, Charlie Drage notifications@github.com wrote:

@rtnpro

Few questions,

Is there any possibility to add some testing?

Yes, of course, and I will start to work on it, to wire up this new
package and cover all edge cases.

Is it bad naming practice to have both a NuleculeBase and Nulecule_Base? As that's what we currently have

It is, indeed. Python suggests use of CapWords for class names and
_ (underscore) separated names for variable and function names for
better readability. You can read more about it here:
https://www.python.org/dev/peps/pep-0008/#function-names. However, in
our current code, we have a mix of various styles. I'm more inclined
to stick to the PEP8 guidelines, and it reflects in the newer code of
nulecule package. In time, we'll refactor the entire code base to
follow a consistent naming convention. Does it make sense?

@rtnpro
Copy link
Member Author

@rtnpro rtnpro commented Oct 7, 2015

@charliedrage ^^

@landscape-bot
Copy link

@landscape-bot landscape-bot commented Oct 9, 2015

Code Health
Repository health decreased by 4% when pulling dd0e7be on rtnpro:refactor_nulecule_base into 5d81806 on projectatomic:master.

@LalatenduMohanty
Copy link
Member

@LalatenduMohanty LalatenduMohanty commented Oct 9, 2015

@rtnpro Code is more readable now :)

@@ -29,6 +29,7 @@
EXTERNAL_APP_DIR = "external"
GLOBAL_CONF = "general"
APP_ENT_PATH = "application-entity"
CACHE_DIR = "/var/atomicapp"
Copy link
Contributor

@vpavlin vpavlin Oct 9, 2015

Choose a reason for hiding this comment

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

Make it /var/lib/atomicapp, please:)

Copy link
Member Author

@rtnpro rtnpro Oct 13, 2015

Choose a reason for hiding this comment

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

Done!

rtnpro added 21 commits Oct 15, 2015
Running a Nulecule application now generates a file
named "answers.conf.gen" in the application directory, which
contains all config data (answers + user input) used to run
the application. The same data is loaded and used to stop
the application without asking the user for any input.
- use 'in' to find a char in string rather than str.find
- strip of 'docker://' prefix in source image name using Utils.getSourceImage
- Update CACHE_DIR to '/var/lib/atomicapp'
- added docs
- added logs
- fixed dry-run, nodeps argument handling
- Fix generating paths for rendered artifacts, to feed to provider
- Prevent deploying external application multipled times.
If at all it is needed to copy a Nulecule application directory
to another path, when --destination option is provided in
atomicapp install command, then the caller will copy the application
directory to the destination first, and then call Nulecule.load_from_path
to load the Nulecule application from the destination path.
and fix 'ask' option for load_config as well. This commit allows us to load_config
parameters for the entire nulecule application during install and dumping it to
answers.conf.sample without prompting the user for any input.
@rtnpro rtnpro force-pushed the refactor_nulecule_base branch from 2501bad to 54bf04c Oct 15, 2015
@rtnpro
Copy link
Member Author

@rtnpro rtnpro commented Oct 15, 2015

Rebased!

@dustymabe
Copy link
Contributor

@dustymabe dustymabe commented Oct 15, 2015

Ok this has been incorporated in https://github.com/projectatomic/atomicapp/commits/cdk2-beta3-rc1 I'm going to lock comments here.. new things can go into issues/PRs to https://github.com/projectatomic/atomicapp/commits/cdk2-beta3-rc1.

@projectatomic projectatomic locked and limited conversation to collaborators Oct 15, 2015
@goern goern added the blocked label Oct 15, 2015
@cdrage cdrage removed the blocked label Oct 29, 2015
@dustymabe dustymabe merged commit 54bf04c into projectatomic:master Nov 3, 2015
0 of 2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

8 participants