Skip to end of metadata
Go to start of metadata

To commit to the main repo you need:

Create one or more ssh keys

To commit to the repo the ssh key needed. Usually it located in ~/.ssh/id_dsa.pub.
If you still have no key, create one:

$ ssh-keygen -t dsa

You can commit using different ssh keys on different hosts or usernames.

Send keys to the repo maintainers

Send keys to the repo maintainer (Dmitry Volodin). You'll be granted with access to particular directories

Pull the repo

You must to pull the repo via ssh before starting to commit changes:

$ hg clone ssh://hg@hg.nocproject.org/noc noc

Making changes

This is usual development process. Make sure you have changed only directories to which you have write access.
Always remember, good code must have good documentation and unittests. Canned_Beef is you best friend when testing profile scripts.

Do not forget to check you code according to PEP8

/opt/noc$ ./scripts/check_pep8 sa/profiles/Vendor/OS/script.py

Testing

When changing NOC's applications run full unittests

/opt/noc$ ./noc test

To test particular SA profile

/opt/noc$ ./noc test noc.sa.profiles.Vendor.OS --beef-filter=Vendor.OS

To test canned beefs for particular script

/opt/noc$ ./noc test --beef-filter=Vendor.OS.script noc.stop

To test canned beefs from particular directory

/opt/noc$ ./noc test --beef=<directory> noc.stop

To check script's test coverage

/opt/noc$ ./noc test --coverage-html-out=/tmp/coverage --beef-filter=Vendor.OS.script noc.sa.profiles.Vendor.OS.script

Next, check unittests coverage in /tmp/coverage/index.html file. Try to cover by tests as much code as you can.

If you have made changes, which lead to output changes, part of the beefs became broken. You can try to fix them:
/opt/noc$ ./noc test --beef-filter=Vendor.OS.script noc.stop --fixed-beef-base=/tmp/beef

New "fresh beefs" will be placed into /tmp/beef/ directory

Committing

Common commit sequence:

/opt/noc$ hg pull -u
/opt/noc$ hg status
/opt/noc$ hg commit <files changed>
/opt/noc$ hg push

Note: If you adding file to directory, listed in .hgignore, don't forget to type for each added file:

/opt/noc$ hg add <file added>

Committing canned beef

Import beefs into the repo

/opt/noc$ ./noc beef --import --rm -r sa_public <path1> .. <pathN>

For example:

/opt/noc$ ./noc script --debug get_version managed_object1 -o /tmp/beef1.json
/opt/noc$ ./noc script --debug get_vlans managed_object1 -o /tmp/beef2.json
/opt/noc$ ./noc beef -i --rm -r sa_public --clone-version=/tmp/beef1.json /tmp/beef1.json /tmp/beef2.json

You can use sa_private or your custom repos as well

Finally, push changes

/opt/noc$ ./noc beef --push
  • No labels