Merge lp:~gz/ubuntu/raring/juju/0.7 into lp:ubuntu/raring/juju
- Raring (13.04)
- 0.7
- Merge into raring
Status: | Merged | ||||
---|---|---|---|---|---|
Merge reported by: | James Page | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~gz/ubuntu/raring/juju/0.7 | ||||
Merge into: | lp:ubuntu/raring/juju | ||||
Diff against target: |
146313 lines (+742/-72218) 437 files modified
.bzrignore (+12/-0) .pc/applied-patches (+1/-0) .pc/disable-failing-zookeeper-test.patch/juju/agents/tests/test_unit.py (+6/-0) .pc/workaround-lxc-python-env.patch/juju/lib/lxc/__init__.py (+308/-0) .testr.conf (+0/-4) COPYING (+0/-661) Makefile (+0/-44) README (+0/-34) bin/close-port (+0/-11) bin/config-get (+0/-12) bin/juju (+0/-10) bin/juju-admin (+0/-10) bin/juju-log (+0/-12) bin/open-port (+0/-11) bin/relation-get (+0/-12) bin/relation-ids (+0/-11) bin/relation-list (+0/-13) bin/relation-set (+0/-13) bin/unit-get (+0/-12) debian/changelog (+13/-2) debian/control (+11/-2) debian/juju.install (+0/-1) debian/juju.manpages (+0/-1) debian/juju.postinst.in (+43/-0) debian/juju.prerm.in (+23/-0) debian/patches/series (+1/-0) debian/patches/workaround-lxc-python-env.patch (+26/-0) debian/rules (+36/-8) examples/README (+0/-24) examples/precise/mysql/config.yaml (+0/-1) examples/precise/mysql/hooks/db-relation-joined (+0/-40) examples/precise/mysql/hooks/install (+0/-32) examples/precise/mysql/hooks/start (+0/-3) examples/precise/mysql/hooks/stop (+0/-3) examples/precise/mysql/metadata.yaml (+0/-17) examples/precise/mysql/revision (+0/-1) examples/precise/php/config.yaml (+0/-5) examples/precise/php/hooks/config-changed (+0/-14) examples/precise/php/hooks/install (+0/-49) examples/precise/php/hooks/start (+0/-1) examples/precise/php/hooks/stop (+0/-3) examples/precise/php/metadata.yaml (+0/-4) examples/precise/php/revision (+0/-1) examples/precise/recorder/hooks/install (+0/-3) examples/precise/recorder/hooks/juju-info-relation-changed (+0/-5) examples/precise/recorder/hooks/juju-info-relation-departed (+0/-3) examples/precise/recorder/hooks/juju-info-relation-joined (+0/-6) examples/precise/recorder/metadata.yaml (+0/-9) examples/precise/recorder/revision (+0/-1) examples/precise/wordpress/config.yaml (+0/-7) examples/precise/wordpress/hooks/config-changed (+0/-19) examples/precise/wordpress/hooks/db-relation-changed (+0/-100) examples/precise/wordpress/hooks/install (+0/-6) examples/precise/wordpress/hooks/start (+0/-1) examples/precise/wordpress/hooks/stop (+0/-3) examples/precise/wordpress/metadata.yaml (+0/-10) examples/precise/wordpress/revision (+0/-1) juju/__init__.py (+0/-2) juju/agents/__init__.py (+0/-1) juju/agents/base.py (+0/-345) juju/agents/dummy.py (+0/-16) juju/agents/machine.py (+0/-126) juju/agents/provision.py (+0/-239) juju/agents/tests/__init__.py (+0/-1) juju/agents/tests/common.py (+0/-52) juju/agents/tests/test_base.py (+0/-633) juju/agents/tests/test_dummy.py (+0/-13) juju/agents/tests/test_machine.py (+0/-241) juju/agents/tests/test_provision.py (+0/-527) juju/agents/tests/test_unit.py (+0/-718) juju/agents/unit.py (+0/-230) juju/charm/__init__.py (+0/-3) juju/charm/base.py (+0/-62) juju/charm/bundle.py (+0/-85) juju/charm/config.py (+0/-220) juju/charm/directory.py (+0/-135) juju/charm/errors.py (+0/-91) juju/charm/metadata.py (+0/-264) juju/charm/provider.py (+0/-28) juju/charm/publisher.py (+0/-123) juju/charm/repository.py (+0/-214) juju/charm/tests/__init__.py (+0/-3) juju/charm/tests/repository/series/configtest/config.yaml (+0/-9) juju/charm/tests/repository/series/configtest/metadata.yaml (+0/-8) juju/charm/tests/repository/series/configtest/revision (+0/-1) juju/charm/tests/repository/series/dummy/.ignored (+0/-1) juju/charm/tests/repository/series/dummy/config.yaml (+0/-5) juju/charm/tests/repository/series/dummy/hooks/install (+0/-2) juju/charm/tests/repository/series/dummy/metadata.yaml (+0/-5) juju/charm/tests/repository/series/dummy/revision (+0/-1) juju/charm/tests/repository/series/dummy/src/hello.c (+0/-7) juju/charm/tests/repository/series/funkyblog/config.yaml (+0/-3) juju/charm/tests/repository/series/funkyblog/metadata.yaml (+0/-17) juju/charm/tests/repository/series/funkyblog/revision (+0/-1) juju/charm/tests/repository/series/mysql-alternative/metadata.yaml (+0/-9) juju/charm/tests/repository/series/mysql-alternative/revision (+0/-1) juju/charm/tests/repository/series/mysql-format-v2/config.yaml (+0/-17) juju/charm/tests/repository/series/mysql-format-v2/metadata.yaml (+0/-6) juju/charm/tests/repository/series/mysql-format-v2/revision (+0/-1) juju/charm/tests/repository/series/mysql/config.yaml (+0/-17) juju/charm/tests/repository/series/mysql/metadata.yaml (+0/-6) juju/charm/tests/repository/series/mysql/revision (+0/-1) juju/charm/tests/repository/series/new/metadata.yaml (+0/-5) juju/charm/tests/repository/series/new/revision (+0/-1) juju/charm/tests/repository/series/old/metadata.yaml (+0/-5) juju/charm/tests/repository/series/old/revision (+0/-1) juju/charm/tests/repository/series/riak/metadata.yaml (+0/-11) juju/charm/tests/repository/series/riak/revision (+0/-1) juju/charm/tests/repository/series/varnish-alternative/hooks/install (+0/-3) juju/charm/tests/repository/series/varnish-alternative/metadata.yaml (+0/-5) juju/charm/tests/repository/series/varnish-alternative/revision (+0/-1) juju/charm/tests/repository/series/varnish/metadata.yaml (+0/-5) juju/charm/tests/repository/series/varnish/revision (+0/-1) juju/charm/tests/repository/series/wordpress/config.yaml (+0/-3) juju/charm/tests/repository/series/wordpress/metadata.yaml (+0/-19) juju/charm/tests/repository/series/wordpress/revision (+0/-1) juju/charm/tests/test_base.py (+0/-80) juju/charm/tests/test_bundle.py (+0/-240) juju/charm/tests/test_config.py (+0/-223) juju/charm/tests/test_directory.py (+0/-227) juju/charm/tests/test_errors.py (+0/-68) juju/charm/tests/test_metadata.py (+0/-370) juju/charm/tests/test_provider.py (+0/-31) juju/charm/tests/test_publisher.py (+0/-223) juju/charm/tests/test_repository.py (+0/-579) juju/charm/tests/test_url.py (+0/-140) juju/charm/url.py (+0/-148) juju/control/__init__.py (+0/-192) juju/control/add_relation.py (+0/-70) juju/control/add_unit.py (+0/-65) juju/control/bootstrap.py (+0/-39) juju/control/command.py (+0/-75) juju/control/config_get.py (+0/-95) juju/control/config_set.py (+0/-113) juju/control/constraints_get.py (+0/-76) juju/control/debug_hooks.py (+0/-182) juju/control/debug_log.py (+0/-138) juju/control/deploy.py (+0/-194) juju/control/destroy_environment.py (+0/-35) juju/control/destroy_service.py (+0/-68) juju/control/expose.py (+0/-48) juju/control/initialize.py (+0/-46) juju/control/legacy.py (+0/-41) juju/control/open_tunnel.py (+0/-32) juju/control/options.py (+0/-133) juju/control/remove_relation.py (+0/-92) juju/control/remove_unit.py (+0/-54) juju/control/resolved.py (+0/-114) juju/control/scp.py (+0/-88) juju/control/ssh.py (+0/-102) juju/control/status.py (+0/-726) juju/control/terminate_machine.py (+0/-71) juju/control/tests/__init__.py (+0/-1) juju/control/tests/common.py (+0/-60) juju/control/tests/sample_cluster.yaml (+0/-60) juju/control/tests/test_add_relation.py (+0/-226) juju/control/tests/test_add_unit.py (+0/-199) juju/control/tests/test_admin.py (+0/-53) juju/control/tests/test_bootstrap.py (+0/-118) juju/control/tests/test_config_get.py (+0/-98) juju/control/tests/test_config_set.py (+0/-291) juju/control/tests/test_constraints_get.py (+0/-115) juju/control/tests/test_control.py (+0/-319) juju/control/tests/test_debug_hooks.py (+0/-218) juju/control/tests/test_debug_log.py (+0/-271) juju/control/tests/test_deploy.py (+0/-595) juju/control/tests/test_destroy_environment.py (+0/-137) juju/control/tests/test_destroy_service.py (+0/-152) juju/control/tests/test_expose.py (+0/-93) juju/control/tests/test_initialize.py (+0/-55) juju/control/tests/test_open_tunnel.py (+0/-45) juju/control/tests/test_remove_relation.py (+0/-215) juju/control/tests/test_remove_unit.py (+0/-238) juju/control/tests/test_resolved.py (+0/-392) juju/control/tests/test_scp.py (+0/-138) juju/control/tests/test_ssh.py (+0/-380) juju/control/tests/test_status.py (+0/-925) juju/control/tests/test_terminate_machine.py (+0/-200) juju/control/tests/test_unexpose.py (+0/-93) juju/control/tests/test_upgrade_charm.py (+0/-523) juju/control/tests/test_utils.py (+0/-203) juju/control/unexpose.py (+0/-48) juju/control/upgrade_charm.py (+0/-141) juju/control/utils.py (+0/-137) juju/environment/config.py (+0/-313) juju/environment/environment.py (+0/-58) juju/environment/errors.py (+0/-9) juju/environment/tests/data/lsb-release (+0/-4) juju/environment/tests/test_config.py (+0/-796) juju/environment/tests/test_environment.py (+0/-80) juju/errors.py (+0/-225) juju/ftests/__init__.py (+0/-1) juju/ftests/test_aws.py (+0/-117) juju/ftests/test_connection.py (+0/-91) juju/ftests/test_ec2_provider.py (+0/-258) juju/hooks/cli.py (+0/-297) juju/hooks/commands.py (+0/-286) juju/hooks/executor.py (+0/-291) juju/hooks/invoker.py (+0/-376) juju/hooks/protocol.py (+0/-527) juju/hooks/scheduler.py (+0/-361) juju/hooks/tests/hooks/echo-hook (+0/-5) juju/hooks/tests/hooks/fail-hook (+0/-4) juju/hooks/tests/hooks/hanging-hook (+0/-3) juju/hooks/tests/hooks/sleep-hook (+0/-3) juju/hooks/tests/hooks/success-hook (+0/-3) juju/hooks/tests/test_arguments.py (+0/-163) juju/hooks/tests/test_cli.py (+0/-444) juju/hooks/tests/test_communications.py (+0/-431) juju/hooks/tests/test_executor.py (+0/-397) juju/hooks/tests/test_invoker.py (+0/-2142) juju/hooks/tests/test_scheduler.py (+0/-738) juju/lib/cache.py (+0/-18) juju/lib/filehash.py (+0/-18) juju/lib/format.py (+0/-137) juju/lib/loader.py (+0/-38) juju/lib/lxc/__init__.py (+0/-308) juju/lib/lxc/tests/data/sample_fstab (+0/-2) juju/lib/lxc/tests/data/sample_fstab_withdevtmpfs (+0/-3) juju/lib/lxc/tests/test_lxc.py (+0/-300) juju/lib/mocker.py (+0/-2162) juju/lib/pick.py (+0/-49) juju/lib/port.py (+13/-0) juju/lib/schema.py (+0/-326) juju/lib/serializer.py (+0/-21) juju/lib/service.py (+0/-160) juju/lib/statemachine.py (+0/-417) juju/lib/testing.py (+0/-230) juju/lib/tests/test_cache.py (+0/-20) juju/lib/tests/test_filehash.py (+0/-13) juju/lib/tests/test_format.py (+0/-308) juju/lib/tests/test_loader.py (+0/-33) juju/lib/tests/test_pick.py (+0/-59) juju/lib/tests/test_port.py (+32/-0) juju/lib/tests/test_schema.py (+0/-484) juju/lib/tests/test_service.py (+0/-116) juju/lib/tests/test_statemachine.py (+0/-473) juju/lib/tests/test_twistutils.py (+0/-157) juju/lib/tests/test_under.py (+0/-29) juju/lib/tests/test_zk.py (+0/-123) juju/lib/tests/test_zklog.py (+0/-259) juju/lib/twistutils.py (+0/-69) juju/lib/under.py (+0/-12) juju/lib/zk.py (+0/-253) juju/lib/zklog.py (+0/-187) juju/machine/__init__.py (+0/-17) juju/machine/errors.py (+0/-6) juju/machine/tests/__init__.py (+0/-1) juju/machine/tests/data/test_get_container (+0/-44) juju/machine/tests/test_constraints.py (+1/-0) juju/machine/tests/test_machine.py (+0/-20) juju/machine/tests/test_unit_deployment.py (+0/-428) juju/machine/unit.py (+0/-296) juju/providers/__init__.py (+0/-1) juju/providers/common/__init__.py (+0/-1) juju/providers/common/base.py (+0/-224) juju/providers/common/bootstrap.py (+0/-58) juju/providers/common/cloudinit.py (+0/-410) juju/providers/common/connect.py (+0/-86) juju/providers/common/files.py (+0/-40) juju/providers/common/findzookeepers.py (+0/-41) juju/providers/common/instance_type.py (+0/-55) juju/providers/common/launch.py (+0/-117) juju/providers/common/state.py (+0/-56) juju/providers/common/tests/data/cloud_init_bootstrap (+0/-61) juju/providers/common/tests/data/cloud_init_bootstrap_testing (+64/-0) juju/providers/common/tests/data/cloud_init_bootstrap_zookeepers (+0/-61) juju/providers/common/tests/data/cloud_init_branch (+0/-39) juju/providers/common/tests/data/cloud_init_branch_trunk (+0/-39) juju/providers/common/tests/data/cloud_init_distro (+0/-36) juju/providers/common/tests/data/cloud_init_no_machine_id (+0/-10) juju/providers/common/tests/data/cloud_init_normal (+0/-13) juju/providers/common/tests/data/cloud_init_ppa (+0/-38) juju/providers/common/tests/data/cloud_init_ppa_apt_proxy (+0/-39) juju/providers/common/tests/data/cloud_init_proposed (+0/-37) juju/providers/common/tests/test_base.py (+0/-155) juju/providers/common/tests/test_bootstrap.py (+0/-117) juju/providers/common/tests/test_cloudinit.py (+0/-332) juju/providers/common/tests/test_connect.py (+0/-239) juju/providers/common/tests/test_files.py (+0/-62) juju/providers/common/tests/test_findzookeepers.py (+0/-128) juju/providers/common/tests/test_instance_type.py (+0/-71) juju/providers/common/tests/test_launch.py (+0/-105) juju/providers/common/tests/test_state.py (+0/-108) juju/providers/common/tests/test_utils.py (+0/-117) juju/providers/common/utils.py (+0/-148) juju/providers/dummy.py (+0/-206) juju/providers/ec2/__init__.py (+0/-225) juju/providers/ec2/files.py (+0/-122) juju/providers/ec2/launch.py (+0/-104) juju/providers/ec2/machine.py (+0/-22) juju/providers/ec2/securitygroup.py (+0/-136) juju/providers/ec2/tests/__init__.py (+0/-1) juju/providers/ec2/tests/common.py (+0/-209) juju/providers/ec2/tests/data/bootstrap_cloud_init (+0/-61) juju/providers/ec2/tests/data/launch_cloud_init (+0/-35) juju/providers/ec2/tests/data/launch_cloud_init_branch (+0/-39) juju/providers/ec2/tests/data/launch_cloud_init_ppa (+0/-37) juju/providers/ec2/tests/data/lucid.txt (+0/-16) juju/providers/ec2/tests/data/natty.txt (+0/-21) juju/providers/ec2/tests/test_bootstrap.py (+0/-153) juju/providers/ec2/tests/test_files.py (+0/-237) juju/providers/ec2/tests/test_findzookeeper.py (+0/-138) juju/providers/ec2/tests/test_getmachines.py (+0/-177) juju/providers/ec2/tests/test_launch.py (+0/-313) juju/providers/ec2/tests/test_machine.py (+0/-21) juju/providers/ec2/tests/test_provider.py (+0/-288) juju/providers/ec2/tests/test_securitygroup.py (+0/-164) juju/providers/ec2/tests/test_shutdown.py (+0/-221) juju/providers/ec2/tests/test_state.py (+0/-129) juju/providers/ec2/tests/test_utils.py (+0/-283) juju/providers/ec2/utils.py (+0/-171) juju/providers/local/__init__.py (+0/-272) juju/providers/local/agent.py (+0/-82) juju/providers/local/files.py (+0/-117) juju/providers/local/machine.py (+0/-10) juju/providers/local/network.py (+0/-101) juju/providers/local/pkg.py (+0/-18) juju/providers/local/tests/__init__.py (+0/-1) juju/providers/local/tests/test_agent.py (+0/-97) juju/providers/local/tests/test_container.py (+0/-37) juju/providers/local/tests/test_files.py (+0/-142) juju/providers/local/tests/test_machine.py (+0/-12) juju/providers/local/tests/test_network.py (+0/-137) juju/providers/local/tests/test_pkg.py (+0/-27) juju/providers/local/tests/test_provider.py (+0/-217) juju/providers/maas/maas.py (+29/-8) juju/providers/maas/provider.py (+4/-3) juju/providers/maas/tests/test_launch.py (+23/-4) juju/providers/maas/tests/test_maas.py (+38/-2) juju/providers/maas/tests/test_provider.py (+28/-3) juju/providers/openstack/__init__.py (+0/-5) juju/providers/openstack/_ssl.py (+0/-21) juju/providers/openstack/client.py (+0/-526) juju/providers/openstack/credentials.py (+0/-101) juju/providers/openstack/files.py (+0/-84) juju/providers/openstack/launch.py (+0/-152) juju/providers/openstack/machine.py (+0/-68) juju/providers/openstack/ports.py (+0/-180) juju/providers/openstack/provider.py (+0/-218) juju/providers/openstack/tests/__init__.py (+0/-233) juju/providers/openstack/tests/test_bootstrap.py (+0/-222) juju/providers/openstack/tests/test_client.py (+0/-315) juju/providers/openstack/tests/test_credentials.py (+0/-216) juju/providers/openstack/tests/test_files.py (+0/-100) juju/providers/openstack/tests/test_getmachines.py (+0/-115) juju/providers/openstack/tests/test_launch.py (+0/-188) juju/providers/openstack/tests/test_machine.py (+0/-110) juju/providers/openstack/tests/test_ports.py (+0/-408) juju/providers/openstack/tests/test_provider.py (+0/-194) juju/providers/openstack/tests/test_shutdown.py (+0/-130) juju/providers/openstack/tests/test_state.py (+0/-57) juju/providers/openstack_s3/__init__.py (+0/-58) juju/providers/openstack_s3/tests/test_provider.py (+0/-89) juju/providers/orchestra/__init__.py (+0/-132) juju/providers/orchestra/cobbler.py (+0/-284) juju/providers/orchestra/digestauth.py (+0/-106) juju/providers/orchestra/files.py (+0/-84) juju/providers/orchestra/launch.py (+0/-57) juju/providers/orchestra/machine.py (+0/-17) juju/providers/orchestra/tests/__init__.py (+0/-1) juju/providers/orchestra/tests/common.py (+0/-179) juju/providers/orchestra/tests/data/bootstrap_user_data (+0/-61) juju/providers/orchestra/tests/data/launch_user_data (+0/-34) juju/providers/orchestra/tests/data/server.crt (+0/-12) juju/providers/orchestra/tests/data/server.key (+0/-15) juju/providers/orchestra/tests/test_bootstrap.py (+0/-158) juju/providers/orchestra/tests/test_cobbler.py (+0/-1033) juju/providers/orchestra/tests/test_digestauth.py (+0/-304) juju/providers/orchestra/tests/test_files.py (+0/-205) juju/providers/orchestra/tests/test_findzookeepers.py (+0/-88) juju/providers/orchestra/tests/test_getmachines.py (+0/-105) juju/providers/orchestra/tests/test_launch.py (+0/-163) juju/providers/orchestra/tests/test_machine.py (+0/-25) juju/providers/orchestra/tests/test_provider.py (+0/-146) juju/providers/orchestra/tests/test_shutdown.py (+0/-192) juju/providers/orchestra/tests/test_state.py (+0/-48) juju/providers/tests/__init__.py (+0/-1) juju/providers/tests/test_dummy.py (+0/-175) juju/state/__init__.py (+0/-1) juju/state/agent.py (+0/-42) juju/state/auth.py (+0/-56) juju/state/base.py (+0/-143) juju/state/charm.py (+0/-116) juju/state/endpoint.py (+0/-47) juju/state/environment.py (+0/-204) juju/state/errors.py (+0/-428) juju/state/firewall.py (+0/-314) juju/state/hook.py (+0/-434) juju/state/initialize.py (+0/-77) juju/state/machine.py (+0/-282) juju/state/placement.py (+0/-89) juju/state/relation.py (+0/-927) juju/state/security.py (+0/-444) juju/state/service.py (+0/-1592) juju/state/sshclient.py (+0/-135) juju/state/sshforward.py (+0/-160) juju/state/tests/__init__.py (+0/-1) juju/state/tests/common.py (+0/-55) juju/state/tests/test_agent.py (+0/-94) juju/state/tests/test_auth.py (+0/-89) juju/state/tests/test_base.py (+0/-435) juju/state/tests/test_charm.py (+0/-183) juju/state/tests/test_endpoint.py (+0/-37) juju/state/tests/test_environment.py (+0/-255) juju/state/tests/test_errors.py (+0/-283) juju/state/tests/test_firewall.py (+0/-697) juju/state/tests/test_hook.py (+0/-896) juju/state/tests/test_initialize.py (+0/-92) juju/state/tests/test_machine.py (+0/-784) juju/state/tests/test_placement.py (+0/-91) juju/state/tests/test_relation.py (+0/-1916) juju/state/tests/test_security.py (+0/-546) juju/state/tests/test_service.py (+0/-2909) juju/state/tests/test_sshclient.py (+0/-326) juju/state/tests/test_sshforward.py (+0/-244) juju/state/tests/test_topology.py (+0/-1266) juju/state/tests/test_utils.py (+0/-708) juju/state/topology.py (+0/-574) juju/state/utils.py (+0/-279) juju/tests/common.py (+0/-53) juju/tests/test_errors.py (+0/-165) juju/unit/__init__.py (+0/-1) juju/unit/address.py (+0/-124) juju/unit/charm.py (+0/-40) juju/unit/deploy.py (+5/-2) juju/unit/lifecycle.py (+0/-756) juju/unit/tests/test_address.py (+0/-206) juju/unit/tests/test_charm.py (+0/-167) juju/unit/tests/test_deploy.py (+25/-10) juju/unit/tests/test_lifecycle.py (+0/-1444) juju/unit/tests/test_workflow.py (+0/-1074) juju/unit/workflow.py (+0/-598) misc/bash_completion.d/juju (+0/-107) misc/devel-tools/juju-inspect-local-provider (+0/-63) setup.py (+0/-43) test (+0/-52) |
||||
To merge this branch: | bzr merge lp:~gz/ubuntu/raring/juju/0.7 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Page | Needs Fixing | ||
Ubuntu branches | Pending | ||
Review via email: mp+158088@code.launchpad.net |
Commit message
Description of the change
Update python juju for raring
Includes new upstream release with several added features and bug fixes, use of update-alternatives to allow installing of the go juju on the same mahcine (Mark and I would appreciate any comments on how this is done), and a workaround for an lxc regression.
Unfortunately due to bug 985285 requiring some big hammering to get around, the diff in this merge proposal is likely to be useless. Running a straight diff on this branch compared to the existing state should be more enlightening.
- 31. By Martin Packman
-
Add patch working around local provider issue with Python 3 lxc scripts
- 32. By Martin Packman
-
Unbreak agent tests after quilt mishap
- 33. By Martin Packman
-
Collapse debian changelog to one distro relevent update for raring
- 34. By Mark Mims
-
Templatify and update postinst and prerm scripts as suggested by jamespage in review
- 35. By Martin Packman
-
Fix get-orig-source rule
- 36. By Martin Packman
-
Merge in alternatives support for manpages and bash completion
- 37. By Martin Packman
-
Rename binary package to juju-0.7 and add virtual package juju that depends on it
Martin Packman (gz) wrote : | # |
Pushed up changes as suggested, Mark and I think everything is covered now. Also included is the rename of the binary package to juju-0.7.
- 38. By Martin Packman
-
Fixup rules file after binary package rename
Iain Lane (laney) wrote : | # |
Hmm, this is really quite late for raring given the scale of the refactoring. Do you consider this essential to be in Raring (and not suitable for, say, a backport from S)?
If so, please file a freeze exception with strong rationale.
Iain Lane (laney) wrote : | # |
My bad, I didn't see https:/
- 39. By Martin Packman
-
Add reference to ffe bug in changelog as requested by laney in review
- 40. By Martin Packman
-
Move update-alternatives scripts to juju-0.7 as requested by stgraber
Preview Diff
1 | === added file '.bzrignore' | |||
2 | --- .bzrignore 1970-01-01 00:00:00 +0000 | |||
3 | +++ .bzrignore 2013-04-22 11:00:38 +0000 | |||
4 | @@ -0,0 +1,12 @@ | |||
5 | 1 | /docs/build | ||
6 | 2 | /docs/source/generated | ||
7 | 3 | /_trial_temp | ||
8 | 4 | /_trial_temp-* | ||
9 | 5 | /tags | ||
10 | 6 | zookeeper.log | ||
11 | 7 | .emacs.desktop | ||
12 | 8 | .emacs.desktop.lock | ||
13 | 9 | .coverage | ||
14 | 10 | htmlcov | ||
15 | 11 | /TAGS | ||
16 | 12 | /.testrepository | ||
17 | 0 | 13 | ||
18 | === modified file '.pc/applied-patches' | |||
19 | --- .pc/applied-patches 2012-11-06 20:44:41 +0000 | |||
20 | +++ .pc/applied-patches 2013-04-22 11:00:38 +0000 | |||
21 | @@ -1,1 +1,2 @@ | |||
22 | 1 | disable-failing-zookeeper-test.patch | 1 | disable-failing-zookeeper-test.patch |
23 | 2 | workaround-lxc-python-env.patch | ||
24 | 2 | 3 | ||
25 | === modified file '.pc/disable-failing-zookeeper-test.patch/juju/agents/tests/test_unit.py' | |||
26 | --- .pc/disable-failing-zookeeper-test.patch/juju/agents/tests/test_unit.py 2012-10-02 13:05:17 +0000 | |||
27 | +++ .pc/disable-failing-zookeeper-test.patch/juju/agents/tests/test_unit.py 2013-04-22 11:00:38 +0000 | |||
28 | @@ -9,7 +9,9 @@ | |||
29 | 9 | from juju.charm import get_charm_from_path | 9 | from juju.charm import get_charm_from_path |
30 | 10 | from juju.charm.url import CharmURL | 10 | from juju.charm.url import CharmURL |
31 | 11 | from juju.errors import JujuError | 11 | from juju.errors import JujuError |
32 | 12 | from juju.hooks.executor import HookExecutor | ||
33 | 12 | from juju.lib import serializer | 13 | from juju.lib import serializer |
34 | 14 | |||
35 | 13 | from juju.state.environment import GlobalSettingsStateManager | 15 | from juju.state.environment import GlobalSettingsStateManager |
36 | 14 | from juju.state.errors import ServiceStateNotFound | 16 | from juju.state.errors import ServiceStateNotFound |
37 | 15 | from juju.state.service import NO_HOOKS, RETRY_HOOKS | 17 | from juju.state.service import NO_HOOKS, RETRY_HOOKS |
38 | @@ -30,11 +32,15 @@ | |||
39 | 30 | 32 | ||
40 | 31 | @inlineCallbacks | 33 | @inlineCallbacks |
41 | 32 | def setUp(self): | 34 | def setUp(self): |
42 | 35 | self.patch(HookExecutor, | ||
43 | 36 | "LOCK_PATH", | ||
44 | 37 | os.path.join(self.makeDir(), "hook.lock")) | ||
45 | 33 | yield super(UnitAgentTestBase, self).setUp() | 38 | yield super(UnitAgentTestBase, self).setUp() |
46 | 34 | settings = GlobalSettingsStateManager(self.client) | 39 | settings = GlobalSettingsStateManager(self.client) |
47 | 35 | yield settings.set_provider_type("dummy") | 40 | yield settings.set_provider_type("dummy") |
48 | 36 | self.change_environment( | 41 | self.change_environment( |
49 | 37 | PATH=get_cli_environ_path(), | 42 | PATH=get_cli_environ_path(), |
50 | 43 | JUJU_ENV_UUID="snowflake", | ||
51 | 38 | JUJU_UNIT_NAME="mysql/0") | 44 | JUJU_UNIT_NAME="mysql/0") |
52 | 39 | 45 | ||
53 | 40 | @inlineCallbacks | 46 | @inlineCallbacks |
54 | 41 | 47 | ||
55 | === added directory '.pc/workaround-lxc-python-env.patch' | |||
56 | === added file '.pc/workaround-lxc-python-env.patch/.timestamp' | |||
57 | === added directory '.pc/workaround-lxc-python-env.patch/juju' | |||
58 | === added directory '.pc/workaround-lxc-python-env.patch/juju/lib' | |||
59 | === added directory '.pc/workaround-lxc-python-env.patch/juju/lib/lxc' | |||
60 | === added file '.pc/workaround-lxc-python-env.patch/juju/lib/lxc/__init__.py' | |||
61 | --- .pc/workaround-lxc-python-env.patch/juju/lib/lxc/__init__.py 1970-01-01 00:00:00 +0000 | |||
62 | +++ .pc/workaround-lxc-python-env.patch/juju/lib/lxc/__init__.py 2013-04-22 11:00:38 +0000 | |||
63 | @@ -0,0 +1,308 @@ | |||
64 | 1 | import os | ||
65 | 2 | import pipes | ||
66 | 3 | import subprocess | ||
67 | 4 | import sys | ||
68 | 5 | import tempfile | ||
69 | 6 | |||
70 | 7 | from twisted.internet.defer import inlineCallbacks, returnValue | ||
71 | 8 | from twisted.internet.threads import deferToThread | ||
72 | 9 | |||
73 | 10 | from juju.errors import JujuError | ||
74 | 11 | |||
75 | 12 | DATA_PATH = os.path.abspath( | ||
76 | 13 | os.path.join(os.path.dirname(__file__), "data")) | ||
77 | 14 | |||
78 | 15 | CONTAINER_OPTIONS_DOC = """ | ||
79 | 16 | The following options are expected. | ||
80 | 17 | |||
81 | 18 | JUJU_CONTAINER_NAME: Applied as the hostname of the machine. | ||
82 | 19 | |||
83 | 20 | JUJU_ORIGIN: Where to obtain the containers version of juju from. | ||
84 | 21 | (ppa, distro or branch). When 'branch' JUJU_SOURCE should | ||
85 | 22 | be set to the location of a bzr(1) accessible branch. | ||
86 | 23 | |||
87 | 24 | JUJU_PUBLIC_KEY: An SSH public key used by the ubuntu account for | ||
88 | 25 | interaction with the container. | ||
89 | 26 | |||
90 | 27 | """ | ||
91 | 28 | |||
92 | 29 | DEVTMPFS_LINE = """devtmpfs dev devtmpfs mode=0755,nosuid 0 0""" | ||
93 | 30 | |||
94 | 31 | # Used to specify the name of the default LXC template used | ||
95 | 32 | # for container creation | ||
96 | 33 | DEFAULT_TEMPLATE = "ubuntu-cloud" | ||
97 | 34 | |||
98 | 35 | |||
99 | 36 | class LXCError(JujuError): | ||
100 | 37 | """Indicates a low level error with an LXC container""" | ||
101 | 38 | |||
102 | 39 | |||
103 | 40 | def _cmd(args): | ||
104 | 41 | p = subprocess.Popen( | ||
105 | 42 | args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | ||
106 | 43 | stdout_data, _ = p.communicate() | ||
107 | 44 | r = p.returncode | ||
108 | 45 | if r != 0: | ||
109 | 46 | # read the stdout/err streams and show the user | ||
110 | 47 | print >>sys.stderr, stdout_data | ||
111 | 48 | raise LXCError(stdout_data) | ||
112 | 49 | return (r, stdout_data) | ||
113 | 50 | |||
114 | 51 | |||
115 | 52 | # Wrapped lxc cli primitives | ||
116 | 53 | def _lxc_create(container_name, | ||
117 | 54 | template, | ||
118 | 55 | release, | ||
119 | 56 | cloud_init_file=None, | ||
120 | 57 | auth_key=None, | ||
121 | 58 | release_stream=None): | ||
122 | 59 | # the -- argument indicates the last parameters are passed | ||
123 | 60 | # to the template and not handled by lxc-create | ||
124 | 61 | args = ["sudo", "lxc-create", | ||
125 | 62 | "-n", container_name, | ||
126 | 63 | "-t", template, | ||
127 | 64 | "--", | ||
128 | 65 | "--debug", # Debug erors / set -x | ||
129 | 66 | "--hostid", container_name, | ||
130 | 67 | "-r", release] | ||
131 | 68 | if cloud_init_file: | ||
132 | 69 | args.extend(("--userdata", cloud_init_file)) | ||
133 | 70 | if auth_key: | ||
134 | 71 | args.extend(("-S", auth_key)) | ||
135 | 72 | if release_stream: | ||
136 | 73 | args.extend(("-s", release_stream)) | ||
137 | 74 | return _cmd(args) | ||
138 | 75 | |||
139 | 76 | |||
140 | 77 | def _lxc_start(container_name, debug_log=None, console_log=None): | ||
141 | 78 | args = ["sudo", "lxc-start", "--daemon", "-n", container_name] | ||
142 | 79 | if console_log: | ||
143 | 80 | args.extend(["-c", console_log]) | ||
144 | 81 | if debug_log: | ||
145 | 82 | args.extend(["-l", "DEBUG", "-o", debug_log]) | ||
146 | 83 | return _cmd(args) | ||
147 | 84 | |||
148 | 85 | |||
149 | 86 | def _lxc_stop(container_name): | ||
150 | 87 | _cmd(["sudo", "lxc-stop", "-n", container_name]) | ||
151 | 88 | |||
152 | 89 | |||
153 | 90 | def _lxc_destroy(container_name): | ||
154 | 91 | return _cmd(["sudo", "lxc-destroy", "-n", container_name]) | ||
155 | 92 | |||
156 | 93 | |||
157 | 94 | def _lxc_ls(): | ||
158 | 95 | _, output = _cmd(["lxc-ls"]) | ||
159 | 96 | output = output.replace("\n", " ") | ||
160 | 97 | return set([c for c in output.split(" ") if c]) | ||
161 | 98 | |||
162 | 99 | |||
163 | 100 | def _lxc_wait(container_name, state="RUNNING"): | ||
164 | 101 | """Wait for container to be in a given state RUNNING|STOPPED.""" | ||
165 | 102 | |||
166 | 103 | def wait(container_name): | ||
167 | 104 | rc, _ = _cmd(["sudo", "lxc-wait", | ||
168 | 105 | "-n", container_name, | ||
169 | 106 | "-s", state]) | ||
170 | 107 | return rc == 0 | ||
171 | 108 | |||
172 | 109 | return deferToThread(wait, container_name) | ||
173 | 110 | |||
174 | 111 | |||
175 | 112 | def _lxc_clone(existing_container_name, new_container_name): | ||
176 | 113 | return _cmd(["sudo", "lxc-clone", "-o", existing_container_name, "-n", | ||
177 | 114 | new_container_name]) | ||
178 | 115 | |||
179 | 116 | |||
180 | 117 | def _customize_container(customize_script, container_root): | ||
181 | 118 | if not os.path.isdir(container_root): | ||
182 | 119 | raise LXCError("Expect container root directory: %s" % | ||
183 | 120 | container_root) | ||
184 | 121 | |||
185 | 122 | # write the container scripts into the container | ||
186 | 123 | fd, in_path = tempfile.mkstemp(prefix=os.path.basename(customize_script), | ||
187 | 124 | dir=os.path.join(container_root, "tmp")) | ||
188 | 125 | |||
189 | 126 | os.write(fd, open(customize_script, "r").read()) | ||
190 | 127 | os.close(fd) | ||
191 | 128 | os.chmod(in_path, 0755) | ||
192 | 129 | |||
193 | 130 | args = ["sudo", "chroot", container_root, | ||
194 | 131 | os.path.join("/tmp", os.path.basename(in_path))] | ||
195 | 132 | return _cmd(args) | ||
196 | 133 | |||
197 | 134 | |||
198 | 135 | def validate_path(pathname): | ||
199 | 136 | if not os.access(pathname, os.R_OK): | ||
200 | 137 | raise LXCError("Invalid or unreadable file: %s" % pathname) | ||
201 | 138 | |||
202 | 139 | |||
203 | 140 | @inlineCallbacks | ||
204 | 141 | def get_containers(prefix): | ||
205 | 142 | """Return a dictionary of containers key names to runtime boolean value. | ||
206 | 143 | |||
207 | 144 | :param prefix: Optionally specify a prefix that the container should | ||
208 | 145 | match any returned containers. | ||
209 | 146 | """ | ||
210 | 147 | _, output = yield deferToThread(_cmd, ["lxc-ls"]) | ||
211 | 148 | |||
212 | 149 | containers = {} | ||
213 | 150 | for i in filter(None, output.split("\n")): | ||
214 | 151 | if i in containers: | ||
215 | 152 | containers[i] = True | ||
216 | 153 | else: | ||
217 | 154 | containers[i] = False | ||
218 | 155 | |||
219 | 156 | if prefix: | ||
220 | 157 | remove = [k for k in containers.keys() if not | ||
221 | 158 | k.startswith(prefix)] | ||
222 | 159 | map(containers.pop, remove) | ||
223 | 160 | |||
224 | 161 | returnValue(containers) | ||
225 | 162 | |||
226 | 163 | |||
227 | 164 | def ensure_devtmpfs_fstab(container_home): | ||
228 | 165 | """ Workaround for bug in older LXC - We need to force mounting devtmpfs | ||
229 | 166 | if it is not already in the rootfs, before starting. | ||
230 | 167 | """ | ||
231 | 168 | rootfs = os.path.join(container_home, 'rootfs') | ||
232 | 169 | devpts = os.path.join(rootfs, 'dev', 'pts') | ||
233 | 170 | if not os.path.exists(devpts): | ||
234 | 171 | fstab_path = os.path.join(container_home, 'fstab') | ||
235 | 172 | if os.path.exists(fstab_path): | ||
236 | 173 | with open(fstab_path) as fstab: | ||
237 | 174 | for line in fstab: | ||
238 | 175 | if line.startswith('devtmpfs'): | ||
239 | 176 | # Line already there, we are done | ||
240 | 177 | return | ||
241 | 178 | mode = 'a' | ||
242 | 179 | else: | ||
243 | 180 | mode = 'w' | ||
244 | 181 | with open(fstab_path, mode) as fstab: | ||
245 | 182 | print >>fstab, DEVTMPFS_LINE | ||
246 | 183 | |||
247 | 184 | |||
248 | 185 | class LXCContainer(object): | ||
249 | 186 | def __init__(self, | ||
250 | 187 | container_name, | ||
251 | 188 | series, | ||
252 | 189 | cloud_init=None, | ||
253 | 190 | debug_log=None, | ||
254 | 191 | console_log=None, | ||
255 | 192 | release_stream="released"): | ||
256 | 193 | """Create an LXCContainer | ||
257 | 194 | |||
258 | 195 | :param container_name: should be unique within the system | ||
259 | 196 | |||
260 | 197 | :param series: distro release series (oneiric, precise, etc) | ||
261 | 198 | |||
262 | 199 | :param cloud_init: full string of cloud-init userdata | ||
263 | 200 | |||
264 | 201 | See :data CONFIG_OPTIONS_DOC: explain how these values map | ||
265 | 202 | into the container in more detail. | ||
266 | 203 | """ | ||
267 | 204 | self.container_name = container_name | ||
268 | 205 | self.debug_log = debug_log | ||
269 | 206 | self.console_log = console_log | ||
270 | 207 | self.cloud_init = cloud_init | ||
271 | 208 | self.series = series | ||
272 | 209 | self.release_stream = release_stream | ||
273 | 210 | |||
274 | 211 | @property | ||
275 | 212 | def container_home(self): | ||
276 | 213 | return "/var/lib/lxc/%s" % self.container_name | ||
277 | 214 | |||
278 | 215 | @property | ||
279 | 216 | def rootfs(self): | ||
280 | 217 | return "%s/rootfs/" % self.container_home | ||
281 | 218 | |||
282 | 219 | def _p(self, path): | ||
283 | 220 | if path[0] == "/": | ||
284 | 221 | path = path[1:] | ||
285 | 222 | return os.path.join(self.rootfs, path) | ||
286 | 223 | |||
287 | 224 | def is_constructed(self): | ||
288 | 225 | """Does the lxc image exist """ | ||
289 | 226 | return os.path.exists(self.rootfs) | ||
290 | 227 | |||
291 | 228 | @inlineCallbacks | ||
292 | 229 | def is_running(self): | ||
293 | 230 | """Is the lxc image running.""" | ||
294 | 231 | state = yield get_containers(None) | ||
295 | 232 | returnValue(state.get(self.container_name)) | ||
296 | 233 | |||
297 | 234 | def execute(self, args): | ||
298 | 235 | if not isinstance(args, (list, tuple)): | ||
299 | 236 | args = [args, ] | ||
300 | 237 | |||
301 | 238 | args = ["sudo", "chroot", self.rootfs] + args | ||
302 | 239 | return _cmd(args) | ||
303 | 240 | |||
304 | 241 | def _create_wait(self): | ||
305 | 242 | """Create the container synchronously.""" | ||
306 | 243 | if self.is_constructed(): | ||
307 | 244 | return | ||
308 | 245 | |||
309 | 246 | with tempfile.NamedTemporaryFile() as fh: | ||
310 | 247 | if self.cloud_init: | ||
311 | 248 | fh.write(self.cloud_init.render()) | ||
312 | 249 | cloud_init_file = fh.name | ||
313 | 250 | else: | ||
314 | 251 | cloud_init_file = None | ||
315 | 252 | fh.flush() | ||
316 | 253 | _lxc_create(self.container_name, | ||
317 | 254 | template=DEFAULT_TEMPLATE, | ||
318 | 255 | cloud_init_file=cloud_init_file, | ||
319 | 256 | release=self.series) | ||
320 | 257 | |||
321 | 258 | ensure_devtmpfs_fstab(self.container_home) | ||
322 | 259 | |||
323 | 260 | @inlineCallbacks | ||
324 | 261 | def create(self): | ||
325 | 262 | # open the template file and create a new temp processed | ||
326 | 263 | yield deferToThread(self._create_wait) | ||
327 | 264 | |||
328 | 265 | def _clone_wait(self, container_name): | ||
329 | 266 | """Return a cloned LXCContainer with a the new container name. | ||
330 | 267 | |||
331 | 268 | This method is synchronous and will provision the new image | ||
332 | 269 | blocking till done. | ||
333 | 270 | """ | ||
334 | 271 | if not self.is_constructed(): | ||
335 | 272 | raise LXCError("Attempted to clone container " | ||
336 | 273 | "that hasn't been had create() called") | ||
337 | 274 | |||
338 | 275 | container = LXCContainer(container_name, | ||
339 | 276 | series=self.series, | ||
340 | 277 | cloud_init=self.cloud_init, | ||
341 | 278 | debug_log=self.debug_log, | ||
342 | 279 | console_log=self.console_log, | ||
343 | 280 | release_stream=self.release_stream) | ||
344 | 281 | |||
345 | 282 | if not container.is_constructed(): | ||
346 | 283 | _lxc_clone(self.container_name, container_name) | ||
347 | 284 | return container | ||
348 | 285 | |||
349 | 286 | def clone(self, container_name): | ||
350 | 287 | return deferToThread(self._clone_wait, container_name) | ||
351 | 288 | |||
352 | 289 | @inlineCallbacks | ||
353 | 290 | def run(self): | ||
354 | 291 | if not self.is_constructed(): | ||
355 | 292 | raise LXCError("Attempting to run a container that " | ||
356 | 293 | "hasn't been created or cloned.") | ||
357 | 294 | |||
358 | 295 | yield deferToThread( | ||
359 | 296 | _lxc_start, self.container_name, | ||
360 | 297 | debug_log=self.debug_log, console_log=self.console_log) | ||
361 | 298 | yield _lxc_wait(self.container_name, "RUNNING") | ||
362 | 299 | |||
363 | 300 | @inlineCallbacks | ||
364 | 301 | def stop(self): | ||
365 | 302 | yield deferToThread(_lxc_stop, self.container_name) | ||
366 | 303 | yield _lxc_wait(self.container_name, "STOPPED") | ||
367 | 304 | |||
368 | 305 | @inlineCallbacks | ||
369 | 306 | def destroy(self): | ||
370 | 307 | yield self.stop() | ||
371 | 308 | yield deferToThread(_lxc_destroy, self.container_name) | ||
372 | 0 | 309 | ||
373 | === added file '.testr.conf' | |||
374 | --- .testr.conf 1970-01-01 00:00:00 +0000 | |||
375 | +++ .testr.conf 2013-04-22 11:00:38 +0000 | |||
376 | @@ -0,0 +1,4 @@ | |||
377 | 1 | [DEFAULT] | ||
378 | 2 | test_command=./test --reporter=subunit $LISTOPT $IDLIST | ||
379 | 3 | test_list_option=-n | ||
380 | 4 | |||
381 | 0 | 5 | ||
382 | === removed file '.testr.conf' | |||
383 | --- .testr.conf 2012-07-19 11:01:09 +0000 | |||
384 | +++ .testr.conf 1970-01-01 00:00:00 +0000 | |||
385 | @@ -1,4 +0,0 @@ | |||
386 | 1 | [DEFAULT] | ||
387 | 2 | test_command=./test --reporter=subunit $LISTOPT $IDLIST | ||
388 | 3 | test_list_option=-n | ||
389 | 4 | |||
390 | 5 | 0 | ||
391 | === added file 'COPYING' | |||
392 | --- COPYING 1970-01-01 00:00:00 +0000 | |||
393 | +++ COPYING 2013-04-22 11:00:38 +0000 | |||
394 | @@ -0,0 +1,661 @@ | |||
395 | 1 | GNU AFFERO GENERAL PUBLIC LICENSE | ||
396 | 2 | Version 3, 19 November 2007 | ||
397 | 3 | |||
398 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | ||
399 | 5 | Everyone is permitted to copy and distribute verbatim copies | ||
400 | 6 | of this license document, but changing it is not allowed. | ||
401 | 7 | |||
402 | 8 | Preamble | ||
403 | 9 | |||
404 | 10 | The GNU Affero General Public License is a free, copyleft license for | ||
405 | 11 | software and other kinds of works, specifically designed to ensure | ||
406 | 12 | cooperation with the community in the case of network server software. | ||
407 | 13 | |||
408 | 14 | The licenses for most software and other practical works are designed | ||
409 | 15 | to take away your freedom to share and change the works. By contrast, | ||
410 | 16 | our General Public Licenses are intended to guarantee your freedom to | ||
411 | 17 | share and change all versions of a program--to make sure it remains free | ||
412 | 18 | software for all its users. | ||
413 | 19 | |||
414 | 20 | When we speak of free software, we are referring to freedom, not | ||
415 | 21 | price. Our General Public Licenses are designed to make sure that you | ||
416 | 22 | have the freedom to distribute copies of free software (and charge for | ||
417 | 23 | them if you wish), that you receive source code or can get it if you | ||
418 | 24 | want it, that you can change the software or use pieces of it in new | ||
419 | 25 | free programs, and that you know you can do these things. | ||
420 | 26 | |||
421 | 27 | Developers that use our General Public Licenses protect your rights | ||
422 | 28 | with two steps: (1) assert copyright on the software, and (2) offer | ||
423 | 29 | you this License which gives you legal permission to copy, distribute | ||
424 | 30 | and/or modify the software. | ||
425 | 31 | |||
426 | 32 | A secondary benefit of defending all users' freedom is that | ||
427 | 33 | improvements made in alternate versions of the program, if they | ||
428 | 34 | receive widespread use, become available for other developers to | ||
429 | 35 | incorporate. Many developers of free software are heartened and | ||
430 | 36 | encouraged by the resulting cooperation. However, in the case of | ||
431 | 37 | software used on network servers, this result may fail to come about. | ||
432 | 38 | The GNU General Public License permits making a modified version and | ||
433 | 39 | letting the public access it on a server without ever releasing its | ||
434 | 40 | source code to the public. | ||
435 | 41 | |||
436 | 42 | The GNU Affero General Public License is designed specifically to | ||
437 | 43 | ensure that, in such cases, the modified source code becomes available | ||
438 | 44 | to the community. It requires the operator of a network server to | ||
439 | 45 | provide the source code of the modified version running there to the | ||
440 | 46 | users of that server. Therefore, public use of a modified version, on | ||
441 | 47 | a publicly accessible server, gives the public access to the source | ||
442 | 48 | code of the modified version. | ||
443 | 49 | |||
444 | 50 | An older license, called the Affero General Public License and | ||
445 | 51 | published by Affero, was designed to accomplish similar goals. This is | ||
446 | 52 | a different license, not a version of the Affero GPL, but Affero has | ||
447 | 53 | released a new version of the Affero GPL which permits relicensing under | ||
448 | 54 | this license. | ||
449 | 55 | |||
450 | 56 | The precise terms and conditions for copying, distribution and | ||
451 | 57 | modification follow. | ||
452 | 58 | |||
453 | 59 | TERMS AND CONDITIONS | ||
454 | 60 | |||
455 | 61 | 0. Definitions. | ||
456 | 62 | |||
457 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. | ||
458 | 64 | |||
459 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of | ||
460 | 66 | works, such as semiconductor masks. | ||
461 | 67 | |||
462 | 68 | "The Program" refers to any copyrightable work licensed under this | ||
463 | 69 | License. Each licensee is addressed as "you". "Licensees" and | ||
464 | 70 | "recipients" may be individuals or organizations. | ||
465 | 71 | |||
466 | 72 | To "modify" a work means to copy from or adapt all or part of the work | ||
467 | 73 | in a fashion requiring copyright permission, other than the making of an | ||
468 | 74 | exact copy. The resulting work is called a "modified version" of the | ||
469 | 75 | earlier work or a work "based on" the earlier work. | ||
470 | 76 | |||
471 | 77 | A "covered work" means either the unmodified Program or a work based | ||
472 | 78 | on the Program. | ||
473 | 79 | |||
474 | 80 | To "propagate" a work means to do anything with it that, without | ||
475 | 81 | permission, would make you directly or secondarily liable for | ||
476 | 82 | infringement under applicable copyright law, except executing it on a | ||
477 | 83 | computer or modifying a private copy. Propagation includes copying, | ||
478 | 84 | distribution (with or without modification), making available to the | ||
479 | 85 | public, and in some countries other activities as well. | ||
480 | 86 | |||
481 | 87 | To "convey" a work means any kind of propagation that enables other | ||
482 | 88 | parties to make or receive copies. Mere interaction with a user through | ||
483 | 89 | a computer network, with no transfer of a copy, is not conveying. | ||
484 | 90 | |||
485 | 91 | An interactive user interface displays "Appropriate Legal Notices" | ||
486 | 92 | to the extent that it includes a convenient and prominently visible | ||
487 | 93 | feature that (1) displays an appropriate copyright notice, and (2) | ||
488 | 94 | tells the user that there is no warranty for the work (except to the | ||
489 | 95 | extent that warranties are provided), that licensees may convey the | ||
490 | 96 | work under this License, and how to view a copy of this License. If | ||
491 | 97 | the interface presents a list of user commands or options, such as a | ||
492 | 98 | menu, a prominent item in the list meets this criterion. | ||
493 | 99 | |||
494 | 100 | 1. Source Code. | ||
495 | 101 | |||
496 | 102 | The "source code" for a work means the preferred form of the work | ||
497 | 103 | for making modifications to it. "Object code" means any non-source | ||
498 | 104 | form of a work. | ||
499 | 105 | |||
500 | 106 | A "Standard Interface" means an interface that either is an official | ||
501 | 107 | standard defined by a recognized standards body, or, in the case of | ||
502 | 108 | interfaces specified for a particular programming language, one that | ||
503 | 109 | is widely used among developers working in that language. | ||
504 | 110 | |||
505 | 111 | The "System Libraries" of an executable work include anything, other | ||
506 | 112 | than the work as a whole, that (a) is included in the normal form of | ||
507 | 113 | packaging a Major Component, but which is not part of that Major | ||
508 | 114 | Component, and (b) serves only to enable use of the work with that | ||
509 | 115 | Major Component, or to implement a Standard Interface for which an | ||
510 | 116 | implementation is available to the public in source code form. A | ||
511 | 117 | "Major Component", in this context, means a major essential component | ||
512 | 118 | (kernel, window system, and so on) of the specific operating system | ||
513 | 119 | (if any) on which the executable work runs, or a compiler used to | ||
514 | 120 | produce the work, or an object code interpreter used to run it. | ||
515 | 121 | |||
516 | 122 | The "Corresponding Source" for a work in object code form means all | ||
517 | 123 | the source code needed to generate, install, and (for an executable | ||
518 | 124 | work) run the object code and to modify the work, including scripts to | ||
519 | 125 | control those activities. However, it does not include the work's | ||
520 | 126 | System Libraries, or general-purpose tools or generally available free | ||
521 | 127 | programs which are used unmodified in performing those activities but | ||
522 | 128 | which are not part of the work. For example, Corresponding Source | ||
523 | 129 | includes interface definition files associated with source files for | ||
524 | 130 | the work, and the source code for shared libraries and dynamically | ||
525 | 131 | linked subprograms that the work is specifically designed to require, | ||
526 | 132 | such as by intimate data communication or control flow between those | ||
527 | 133 | subprograms and other parts of the work. | ||
528 | 134 | |||
529 | 135 | The Corresponding Source need not include anything that users | ||
530 | 136 | can regenerate automatically from other parts of the Corresponding | ||
531 | 137 | Source. | ||
532 | 138 | |||
533 | 139 | The Corresponding Source for a work in source code form is that | ||
534 | 140 | same work. | ||
535 | 141 | |||
536 | 142 | 2. Basic Permissions. | ||
537 | 143 | |||
538 | 144 | All rights granted under this License are granted for the term of | ||
539 | 145 | copyright on the Program, and are irrevocable provided the stated | ||
540 | 146 | conditions are met. This License explicitly affirms your unlimited | ||
541 | 147 | permission to run the unmodified Program. The output from running a | ||
542 | 148 | covered work is covered by this License only if the output, given its | ||
543 | 149 | content, constitutes a covered work. This License acknowledges your | ||
544 | 150 | rights of fair use or other equivalent, as provided by copyright law. | ||
545 | 151 | |||
546 | 152 | You may make, run and propagate covered works that you do not | ||
547 | 153 | convey, without conditions so long as your license otherwise remains | ||
548 | 154 | in force. You may convey covered works to others for the sole purpose | ||
549 | 155 | of having them make modifications exclusively for you, or provide you | ||
550 | 156 | with facilities for running those works, provided that you comply with | ||
551 | 157 | the terms of this License in conveying all material for which you do | ||
552 | 158 | not control copyright. Those thus making or running the covered works | ||
553 | 159 | for you must do so exclusively on your behalf, under your direction | ||
554 | 160 | and control, on terms that prohibit them from making any copies of | ||
555 | 161 | your copyrighted material outside their relationship with you. | ||
556 | 162 | |||
557 | 163 | Conveying under any other circumstances is permitted solely under | ||
558 | 164 | the conditions stated below. Sublicensing is not allowed; section 10 | ||
559 | 165 | makes it unnecessary. | ||
560 | 166 | |||
561 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. | ||
562 | 168 | |||
563 | 169 | No covered work shall be deemed part of an effective technological | ||
564 | 170 | measure under any applicable law fulfilling obligations under article | ||
565 | 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or | ||
566 | 172 | similar laws prohibiting or restricting circumvention of such | ||
567 | 173 | measures. | ||
568 | 174 | |||
569 | 175 | When you convey a covered work, you waive any legal power to forbid | ||
570 | 176 | circumvention of technological measures to the extent such circumvention | ||
571 | 177 | is effected by exercising rights under this License with respect to | ||
572 | 178 | the covered work, and you disclaim any intention to limit operation or | ||
573 | 179 | modification of the work as a means of enforcing, against the work's | ||
574 | 180 | users, your or third parties' legal rights to forbid circumvention of | ||
575 | 181 | technological measures. | ||
576 | 182 | |||
577 | 183 | 4. Conveying Verbatim Copies. | ||
578 | 184 | |||
579 | 185 | You may convey verbatim copies of the Program's source code as you | ||
580 | 186 | receive it, in any medium, provided that you conspicuously and | ||
581 | 187 | appropriately publish on each copy an appropriate copyright notice; | ||
582 | 188 | keep intact all notices stating that this License and any | ||
583 | 189 | non-permissive terms added in accord with section 7 apply to the code; | ||
584 | 190 | keep intact all notices of the absence of any warranty; and give all | ||
585 | 191 | recipients a copy of this License along with the Program. | ||
586 | 192 | |||
587 | 193 | You may charge any price or no price for each copy that you convey, | ||
588 | 194 | and you may offer support or warranty protection for a fee. | ||
589 | 195 | |||
590 | 196 | 5. Conveying Modified Source Versions. | ||
591 | 197 | |||
592 | 198 | You may convey a work based on the Program, or the modifications to | ||
593 | 199 | produce it from the Program, in the form of source code under the | ||
594 | 200 | terms of section 4, provided that you also meet all of these conditions: | ||
595 | 201 | |||
596 | 202 | a) The work must carry prominent notices stating that you modified | ||
597 | 203 | it, and giving a relevant date. | ||
598 | 204 | |||
599 | 205 | b) The work must carry prominent notices stating that it is | ||
600 | 206 | released under this License and any conditions added under section | ||
601 | 207 | 7. This requirement modifies the requirement in section 4 to | ||
602 | 208 | "keep intact all notices". | ||
603 | 209 | |||
604 | 210 | c) You must license the entire work, as a whole, under this | ||
605 | 211 | License to anyone who comes into possession of a copy. This | ||
606 | 212 | License will therefore apply, along with any applicable section 7 | ||
607 | 213 | additional terms, to the whole of the work, and all its parts, | ||
608 | 214 | regardless of how they are packaged. This License gives no | ||
609 | 215 | permission to license the work in any other way, but it does not | ||
610 | 216 | invalidate such permission if you have separately received it. | ||
611 | 217 | |||
612 | 218 | d) If the work has interactive user interfaces, each must display | ||
613 | 219 | Appropriate Legal Notices; however, if the Program has interactive | ||
614 | 220 | interfaces that do not display Appropriate Legal Notices, your | ||
615 | 221 | work need not make them do so. | ||
616 | 222 | |||
617 | 223 | A compilation of a covered work with other separate and independent | ||
618 | 224 | works, which are not by their nature extensions of the covered work, | ||
619 | 225 | and which are not combined with it such as to form a larger program, | ||
620 | 226 | in or on a volume of a storage or distribution medium, is called an | ||
621 | 227 | "aggregate" if the compilation and its resulting copyright are not | ||
622 | 228 | used to limit the access or legal rights of the compilation's users | ||
623 | 229 | beyond what the individual works permit. Inclusion of a covered work | ||
624 | 230 | in an aggregate does not cause this License to apply to the other | ||
625 | 231 | parts of the aggregate. | ||
626 | 232 | |||
627 | 233 | 6. Conveying Non-Source Forms. | ||
628 | 234 | |||
629 | 235 | You may convey a covered work in object code form under the terms | ||
630 | 236 | of sections 4 and 5, provided that you also convey the | ||
631 | 237 | machine-readable Corresponding Source under the terms of this License, | ||
632 | 238 | in one of these ways: | ||
633 | 239 | |||
634 | 240 | a) Convey the object code in, or embodied in, a physical product | ||
635 | 241 | (including a physical distribution medium), accompanied by the | ||
636 | 242 | Corresponding Source fixed on a durable physical medium | ||
637 | 243 | customarily used for software interchange. | ||
638 | 244 | |||
639 | 245 | b) Convey the object code in, or embodied in, a physical product | ||
640 | 246 | (including a physical distribution medium), accompanied by a | ||
641 | 247 | written offer, valid for at least three years and valid for as | ||
642 | 248 | long as you offer spare parts or customer support for that product | ||
643 | 249 | model, to give anyone who possesses the object code either (1) a | ||
644 | 250 | copy of the Corresponding Source for all the software in the | ||
645 | 251 | product that is covered by this License, on a durable physical | ||
646 | 252 | medium customarily used for software interchange, for a price no | ||
647 | 253 | more than your reasonable cost of physically performing this | ||
648 | 254 | conveying of source, or (2) access to copy the | ||
649 | 255 | Corresponding Source from a network server at no charge. | ||
650 | 256 | |||
651 | 257 | c) Convey individual copies of the object code with a copy of the | ||
652 | 258 | written offer to provide the Corresponding Source. This | ||
653 | 259 | alternative is allowed only occasionally and noncommercially, and | ||
654 | 260 | only if you received the object code with such an offer, in accord | ||
655 | 261 | with subsection 6b. | ||
656 | 262 | |||
657 | 263 | d) Convey the object code by offering access from a designated | ||
658 | 264 | place (gratis or for a charge), and offer equivalent access to the | ||
659 | 265 | Corresponding Source in the same way through the same place at no | ||
660 | 266 | further charge. You need not require recipients to copy the | ||
661 | 267 | Corresponding Source along with the object code. If the place to | ||
662 | 268 | copy the object code is a network server, the Corresponding Source | ||
663 | 269 | may be on a different server (operated by you or a third party) | ||
664 | 270 | that supports equivalent copying facilities, provided you maintain | ||
665 | 271 | clear directions next to the object code saying where to find the | ||
666 | 272 | Corresponding Source. Regardless of what server hosts the | ||
667 | 273 | Corresponding Source, you remain obligated to ensure that it is | ||
668 | 274 | available for as long as needed to satisfy these requirements. | ||
669 | 275 | |||
670 | 276 | e) Convey the object code using peer-to-peer transmission, provided | ||
671 | 277 | you inform other peers where the object code and Corresponding | ||
672 | 278 | Source of the work are being offered to the general public at no | ||
673 | 279 | charge under subsection 6d. | ||
674 | 280 | |||
675 | 281 | A separable portion of the object code, whose source code is excluded | ||
676 | 282 | from the Corresponding Source as a System Library, need not be | ||
677 | 283 | included in conveying the object code work. | ||
678 | 284 | |||
679 | 285 | A "User Product" is either (1) a "consumer product", which means any | ||
680 | 286 | tangible personal property which is normally used for personal, family, | ||
681 | 287 | or household purposes, or (2) anything designed or sold for incorporation | ||
682 | 288 | into a dwelling. In determining whether a product is a consumer product, | ||
683 | 289 | doubtful cases shall be resolved in favor of coverage. For a particular | ||
684 | 290 | product received by a particular user, "normally used" refers to a | ||
685 | 291 | typical or common use of that class of product, regardless of the status | ||
686 | 292 | of the particular user or of the way in which the particular user | ||
687 | 293 | actually uses, or expects or is expected to use, the product. A product | ||
688 | 294 | is a consumer product regardless of whether the product has substantial | ||
689 | 295 | commercial, industrial or non-consumer uses, unless such uses represent | ||
690 | 296 | the only significant mode of use of the product. | ||
691 | 297 | |||
692 | 298 | "Installation Information" for a User Product means any methods, | ||
693 | 299 | procedures, authorization keys, or other information required to install | ||
694 | 300 | and execute modified versions of a covered work in that User Product from | ||
695 | 301 | a modified version of its Corresponding Source. The information must | ||
696 | 302 | suffice to ensure that the continued functioning of the modified object | ||
697 | 303 | code is in no case prevented or interfered with solely because | ||
698 | 304 | modification has been made. | ||
699 | 305 | |||
700 | 306 | If you convey an object code work under this section in, or with, or | ||
701 | 307 | specifically for use in, a User Product, and the conveying occurs as | ||
702 | 308 | part of a transaction in which the right of possession and use of the | ||
703 | 309 | User Product is transferred to the recipient in perpetuity or for a | ||
704 | 310 | fixed term (regardless of how the transaction is characterized), the | ||
705 | 311 | Corresponding Source conveyed under this section must be accompanied | ||
706 | 312 | by the Installation Information. But this requirement does not apply | ||
707 | 313 | if neither you nor any third party retains the ability to install | ||
708 | 314 | modified object code on the User Product (for example, the work has | ||
709 | 315 | been installed in ROM). | ||
710 | 316 | |||
711 | 317 | The requirement to provide Installation Information does not include a | ||
712 | 318 | requirement to continue to provide support service, warranty, or updates | ||
713 | 319 | for a work that has been modified or installed by the recipient, or for | ||
714 | 320 | the User Product in which it has been modified or installed. Access to a | ||
715 | 321 | network may be denied when the modification itself materially and | ||
716 | 322 | adversely affects the operation of the network or violates the rules and | ||
717 | 323 | protocols for communication across the network. | ||
718 | 324 | |||
719 | 325 | Corresponding Source conveyed, and Installation Information provided, | ||
720 | 326 | in accord with this section must be in a format that is publicly | ||
721 | 327 | documented (and with an implementation available to the public in | ||
722 | 328 | source code form), and must require no special password or key for | ||
723 | 329 | unpacking, reading or copying. | ||
724 | 330 | |||
725 | 331 | 7. Additional Terms. | ||
726 | 332 | |||
727 | 333 | "Additional permissions" are terms that supplement the terms of this | ||
728 | 334 | License by making exceptions from one or more of its conditions. | ||
729 | 335 | Additional permissions that are applicable to the entire Program shall | ||
730 | 336 | be treated as though they were included in this License, to the extent | ||
731 | 337 | that they are valid under applicable law. If additional permissions | ||
732 | 338 | apply only to part of the Program, that part may be used separately | ||
733 | 339 | under those permissions, but the entire Program remains governed by | ||
734 | 340 | this License without regard to the additional permissions. | ||
735 | 341 | |||
736 | 342 | When you convey a copy of a covered work, you may at your option | ||
737 | 343 | remove any additional permissions from that copy, or from any part of | ||
738 | 344 | it. (Additional permissions may be written to require their own | ||
739 | 345 | removal in certain cases when you modify the work.) You may place | ||
740 | 346 | additional permissions on material, added by you to a covered work, | ||
741 | 347 | for which you have or can give appropriate copyright permission. | ||
742 | 348 | |||
743 | 349 | Notwithstanding any other provision of this License, for material you | ||
744 | 350 | add to a covered work, you may (if authorized by the copyright holders of | ||
745 | 351 | that material) supplement the terms of this License with terms: | ||
746 | 352 | |||
747 | 353 | a) Disclaiming warranty or limiting liability differently from the | ||
748 | 354 | terms of sections 15 and 16 of this License; or | ||
749 | 355 | |||
750 | 356 | b) Requiring preservation of specified reasonable legal notices or | ||
751 | 357 | author attributions in that material or in the Appropriate Legal | ||
752 | 358 | Notices displayed by works containing it; or | ||
753 | 359 | |||
754 | 360 | c) Prohibiting misrepresentation of the origin of that material, or | ||
755 | 361 | requiring that modified versions of such material be marked in | ||
756 | 362 | reasonable ways as different from the original version; or | ||
757 | 363 | |||
758 | 364 | d) Limiting the use for publicity purposes of names of licensors or | ||
759 | 365 | authors of the material; or | ||
760 | 366 | |||
761 | 367 | e) Declining to grant rights under trademark law for use of some | ||
762 | 368 | trade names, trademarks, or service marks; or | ||
763 | 369 | |||
764 | 370 | f) Requiring indemnification of licensors and authors of that | ||
765 | 371 | material by anyone who conveys the material (or modified versions of | ||
766 | 372 | it) with contractual assumptions of liability to the recipient, for | ||
767 | 373 | any liability that these contractual assumptions directly impose on | ||
768 | 374 | those licensors and authors. | ||
769 | 375 | |||
770 | 376 | All other non-permissive additional terms are considered "further | ||
771 | 377 | restrictions" within the meaning of section 10. If the Program as you | ||
772 | 378 | received it, or any part of it, contains a notice stating that it is | ||
773 | 379 | governed by this License along with a term that is a further | ||
774 | 380 | restriction, you may remove that term. If a license document contains | ||
775 | 381 | a further restriction but permits relicensing or conveying under this | ||
776 | 382 | License, you may add to a covered work material governed by the terms | ||
777 | 383 | of that license document, provided that the further restriction does | ||
778 | 384 | not survive such relicensing or conveying. | ||
779 | 385 | |||
780 | 386 | If you add terms to a covered work in accord with this section, you | ||
781 | 387 | must place, in the relevant source files, a statement of the | ||
782 | 388 | additional terms that apply to those files, or a notice indicating | ||
783 | 389 | where to find the applicable terms. | ||
784 | 390 | |||
785 | 391 | Additional terms, permissive or non-permissive, may be stated in the | ||
786 | 392 | form of a separately written license, or stated as exceptions; | ||
787 | 393 | the above requirements apply either way. | ||
788 | 394 | |||
789 | 395 | 8. Termination. | ||
790 | 396 | |||
791 | 397 | You may not propagate or modify a covered work except as expressly | ||
792 | 398 | provided under this License. Any attempt otherwise to propagate or | ||
793 | 399 | modify it is void, and will automatically terminate your rights under | ||
794 | 400 | this License (including any patent licenses granted under the third | ||
795 | 401 | paragraph of section 11). | ||
796 | 402 | |||
797 | 403 | However, if you cease all violation of this License, then your | ||
798 | 404 | license from a particular copyright holder is reinstated (a) | ||
799 | 405 | provisionally, unless and until the copyright holder explicitly and | ||
800 | 406 | finally terminates your license, and (b) permanently, if the copyright | ||
801 | 407 | holder fails to notify you of the violation by some reasonable means | ||
802 | 408 | prior to 60 days after the cessation. | ||
803 | 409 | |||
804 | 410 | Moreover, your license from a particular copyright holder is | ||
805 | 411 | reinstated permanently if the copyright holder notifies you of the | ||
806 | 412 | violation by some reasonable means, this is the first time you have | ||
807 | 413 | received notice of violation of this License (for any work) from that | ||
808 | 414 | copyright holder, and you cure the violation prior to 30 days after | ||
809 | 415 | your receipt of the notice. | ||
810 | 416 | |||
811 | 417 | Termination of your rights under this section does not terminate the | ||
812 | 418 | licenses of parties who have received copies or rights from you under | ||
813 | 419 | this License. If your rights have been terminated and not permanently | ||
814 | 420 | reinstated, you do not qualify to receive new licenses for the same | ||
815 | 421 | material under section 10. | ||
816 | 422 | |||
817 | 423 | 9. Acceptance Not Required for Having Copies. | ||
818 | 424 | |||
819 | 425 | You are not required to accept this License in order to receive or | ||
820 | 426 | run a copy of the Program. Ancillary propagation of a covered work | ||
821 | 427 | occurring solely as a consequence of using peer-to-peer transmission | ||
822 | 428 | to receive a copy likewise does not require acceptance. However, | ||
823 | 429 | nothing other than this License grants you permission to propagate or | ||
824 | 430 | modify any covered work. These actions infringe copyright if you do | ||
825 | 431 | not accept this License. Therefore, by modifying or propagating a | ||
826 | 432 | covered work, you indicate your acceptance of this License to do so. | ||
827 | 433 | |||
828 | 434 | 10. Automatic Licensing of Downstream Recipients. | ||
829 | 435 | |||
830 | 436 | Each time you convey a covered work, the recipient automatically | ||
831 | 437 | receives a license from the original licensors, to run, modify and | ||
832 | 438 | propagate that work, subject to this License. You are not responsible | ||
833 | 439 | for enforcing compliance by third parties with this License. | ||
834 | 440 | |||
835 | 441 | An "entity transaction" is a transaction transferring control of an | ||
836 | 442 | organization, or substantially all assets of one, or subdividing an | ||
837 | 443 | organization, or merging organizations. If propagation of a covered | ||
838 | 444 | work results from an entity transaction, each party to that | ||
839 | 445 | transaction who receives a copy of the work also receives whatever | ||
840 | 446 | licenses to the work the party's predecessor in interest had or could | ||
841 | 447 | give under the previous paragraph, plus a right to possession of the | ||
842 | 448 | Corresponding Source of the work from the predecessor in interest, if | ||
843 | 449 | the predecessor has it or can get it with reasonable efforts. | ||
844 | 450 | |||
845 | 451 | You may not impose any further restrictions on the exercise of the | ||
846 | 452 | rights granted or affirmed under this License. For example, you may | ||
847 | 453 | not impose a license fee, royalty, or other charge for exercise of | ||
848 | 454 | rights granted under this License, and you may not initiate litigation | ||
849 | 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that | ||
850 | 456 | any patent claim is infringed by making, using, selling, offering for | ||
851 | 457 | sale, or importing the Program or any portion of it. | ||
852 | 458 | |||
853 | 459 | 11. Patents. | ||
854 | 460 | |||
855 | 461 | A "contributor" is a copyright holder who authorizes use under this | ||
856 | 462 | License of the Program or a work on which the Program is based. The | ||
857 | 463 | work thus licensed is called the contributor's "contributor version". | ||
858 | 464 | |||
859 | 465 | A contributor's "essential patent claims" are all patent claims | ||
860 | 466 | owned or controlled by the contributor, whether already acquired or | ||
861 | 467 | hereafter acquired, that would be infringed by some manner, permitted | ||
862 | 468 | by this License, of making, using, or selling its contributor version, | ||
863 | 469 | but do not include claims that would be infringed only as a | ||
864 | 470 | consequence of further modification of the contributor version. For | ||
865 | 471 | purposes of this definition, "control" includes the right to grant | ||
866 | 472 | patent sublicenses in a manner consistent with the requirements of | ||
867 | 473 | this License. | ||
868 | 474 | |||
869 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free | ||
870 | 476 | patent license under the contributor's essential patent claims, to | ||
871 | 477 | make, use, sell, offer for sale, import and otherwise run, modify and | ||
872 | 478 | propagate the contents of its contributor version. | ||
873 | 479 | |||
874 | 480 | In the following three paragraphs, a "patent license" is any express | ||
875 | 481 | agreement or commitment, however denominated, not to enforce a patent | ||
876 | 482 | (such as an express permission to practice a patent or covenant not to | ||
877 | 483 | sue for patent infringement). To "grant" such a patent license to a | ||
878 | 484 | party means to make such an agreement or commitment not to enforce a | ||
879 | 485 | patent against the party. | ||
880 | 486 | |||
881 | 487 | If you convey a covered work, knowingly relying on a patent license, | ||
882 | 488 | and the Corresponding Source of the work is not available for anyone | ||
883 | 489 | to copy, free of charge and under the terms of this License, through a | ||
884 | 490 | publicly available network server or other readily accessible means, | ||
885 | 491 | then you must either (1) cause the Corresponding Source to be so | ||
886 | 492 | available, or (2) arrange to deprive yourself of the benefit of the | ||
887 | 493 | patent license for this particular work, or (3) arrange, in a manner | ||
888 | 494 | consistent with the requirements of this License, to extend the patent | ||
889 | 495 | license to downstream recipients. "Knowingly relying" means you have | ||
890 | 496 | actual knowledge that, but for the patent license, your conveying the | ||
891 | 497 | covered work in a country, or your recipient's use of the covered work | ||
892 | 498 | in a country, would infringe one or more identifiable patents in that | ||
893 | 499 | country that you have reason to believe are valid. | ||
894 | 500 | |||
895 | 501 | If, pursuant to or in connection with a single transaction or | ||
896 | 502 | arrangement, you convey, or propagate by procuring conveyance of, a | ||
897 | 503 | covered work, and grant a patent license to some of the parties | ||
898 | 504 | receiving the covered work authorizing them to use, propagate, modify | ||
899 | 505 | or convey a specific copy of the covered work, then the patent license | ||
900 | 506 | you grant is automatically extended to all recipients of the covered | ||
901 | 507 | work and works based on it. | ||
902 | 508 | |||
903 | 509 | A patent license is "discriminatory" if it does not include within | ||
904 | 510 | the scope of its coverage, prohibits the exercise of, or is | ||
905 | 511 | conditioned on the non-exercise of one or more of the rights that are | ||
906 | 512 | specifically granted under this License. You may not convey a covered | ||
907 | 513 | work if you are a party to an arrangement with a third party that is | ||
908 | 514 | in the business of distributing software, under which you make payment | ||
909 | 515 | to the third party based on the extent of your activity of conveying | ||
910 | 516 | the work, and under which the third party grants, to any of the | ||
911 | 517 | parties who would receive the covered work from you, a discriminatory | ||
912 | 518 | patent license (a) in connection with copies of the covered work | ||
913 | 519 | conveyed by you (or copies made from those copies), or (b) primarily | ||
914 | 520 | for and in connection with specific products or compilations that | ||
915 | 521 | contain the covered work, unless you entered into that arrangement, | ||
916 | 522 | or that patent license was granted, prior to 28 March 2007. | ||
917 | 523 | |||
918 | 524 | Nothing in this License shall be construed as excluding or limiting | ||
919 | 525 | any implied license or other defenses to infringement that may | ||
920 | 526 | otherwise be available to you under applicable patent law. | ||
921 | 527 | |||
922 | 528 | 12. No Surrender of Others' Freedom. | ||
923 | 529 | |||
924 | 530 | If conditions are imposed on you (whether by court order, agreement or | ||
925 | 531 | otherwise) that contradict the conditions of this License, they do not | ||
926 | 532 | excuse you from the conditions of this License. If you cannot convey a | ||
927 | 533 | covered work so as to satisfy simultaneously your obligations under this | ||
928 | 534 | License and any other pertinent obligations, then as a consequence you may | ||
929 | 535 | not convey it at all. For example, if you agree to terms that obligate you | ||
930 | 536 | to collect a royalty for further conveying from those to whom you convey | ||
931 | 537 | the Program, the only way you could satisfy both those terms and this | ||
932 | 538 | License would be to refrain entirely from conveying the Program. | ||
933 | 539 | |||
934 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. | ||
935 | 541 | |||
936 | 542 | Notwithstanding any other provision of this License, if you modify the | ||
937 | 543 | Program, your modified version must prominently offer all users | ||
938 | 544 | interacting with it remotely through a computer network (if your version | ||
939 | 545 | supports such interaction) an opportunity to receive the Corresponding | ||
940 | 546 | Source of your version by providing access to the Corresponding Source | ||
941 | 547 | from a network server at no charge, through some standard or customary | ||
942 | 548 | means of facilitating copying of software. This Corresponding Source | ||
943 | 549 | shall include the Corresponding Source for any work covered by version 3 | ||
944 | 550 | of the GNU General Public License that is incorporated pursuant to the | ||
945 | 551 | following paragraph. | ||
946 | 552 | |||
947 | 553 | Notwithstanding any other provision of this License, you have | ||
948 | 554 | permission to link or combine any covered work with a work licensed | ||
949 | 555 | under version 3 of the GNU General Public License into a single | ||
950 | 556 | combined work, and to convey the resulting work. The terms of this | ||
951 | 557 | License will continue to apply to the part which is the covered work, | ||
952 | 558 | but the work with which it is combined will remain governed by version | ||
953 | 559 | 3 of the GNU General Public License. | ||
954 | 560 | |||
955 | 561 | 14. Revised Versions of this License. | ||
956 | 562 | |||
957 | 563 | The Free Software Foundation may publish revised and/or new versions of | ||
958 | 564 | the GNU Affero General Public License from time to time. Such new versions | ||
959 | 565 | will be similar in spirit to the present version, but may differ in detail to | ||
960 | 566 | address new problems or concerns. | ||
961 | 567 | |||
962 | 568 | Each version is given a distinguishing version number. If the | ||
963 | 569 | Program specifies that a certain numbered version of the GNU Affero General | ||
964 | 570 | Public License "or any later version" applies to it, you have the | ||
965 | 571 | option of following the terms and conditions either of that numbered | ||
966 | 572 | version or of any later version published by the Free Software | ||
967 | 573 | Foundation. If the Program does not specify a version number of the | ||
968 | 574 | GNU Affero General Public License, you may choose any version ever published | ||
969 | 575 | by the Free Software Foundation. | ||
970 | 576 | |||
971 | 577 | If the Program specifies that a proxy can decide which future | ||
972 | 578 | versions of the GNU Affero General Public License can be used, that proxy's | ||
973 | 579 | public statement of acceptance of a version permanently authorizes you | ||
974 | 580 | to choose that version for the Program. | ||
975 | 581 | |||
976 | 582 | Later license versions may give you additional or different | ||
977 | 583 | permissions. However, no additional obligations are imposed on any | ||
978 | 584 | author or copyright holder as a result of your choosing to follow a | ||
979 | 585 | later version. | ||
980 | 586 | |||
981 | 587 | 15. Disclaimer of Warranty. | ||
982 | 588 | |||
983 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY | ||
984 | 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT | ||
985 | 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY | ||
986 | 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, | ||
987 | 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
988 | 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM | ||
989 | 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF | ||
990 | 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | ||
991 | 597 | |||
992 | 598 | 16. Limitation of Liability. | ||
993 | 599 | |||
994 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | ||
995 | 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS | ||
996 | 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY | ||
997 | 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE | ||
998 | 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF | ||
999 | 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD | ||
1000 | 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), | ||
1001 | 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF | ||
1002 | 608 | SUCH DAMAGES. | ||
1003 | 609 | |||
1004 | 610 | 17. Interpretation of Sections 15 and 16. | ||
1005 | 611 | |||
1006 | 612 | If the disclaimer of warranty and limitation of liability provided | ||
1007 | 613 | above cannot be given local legal effect according to their terms, | ||
1008 | 614 | reviewing courts shall apply local law that most closely approximates | ||
1009 | 615 | an absolute waiver of all civil liability in connection with the | ||
1010 | 616 | Program, unless a warranty or assumption of liability accompanies a | ||
1011 | 617 | copy of the Program in return for a fee. | ||
1012 | 618 | |||
1013 | 619 | END OF TERMS AND CONDITIONS | ||
1014 | 620 | |||
1015 | 621 | How to Apply These Terms to Your New Programs | ||
1016 | 622 | |||
1017 | 623 | If you develop a new program, and you want it to be of the greatest | ||
1018 | 624 | possible use to the public, the best way to achieve this is to make it | ||
1019 | 625 | free software which everyone can redistribute and change under these terms. | ||
1020 | 626 | |||
1021 | 627 | To do so, attach the following notices to the program. It is safest | ||
1022 | 628 | to attach them to the start of each source file to most effectively | ||
1023 | 629 | state the exclusion of warranty; and each file should have at least | ||
1024 | 630 | the "copyright" line and a pointer to where the full notice is found. | ||
1025 | 631 | |||
1026 | 632 | <one line to give the program's name and a brief idea of what it does.> | ||
1027 | 633 | Copyright (C) <year> <name of author> | ||
1028 | 634 | |||
1029 | 635 | This program is free software: you can redistribute it and/or modify | ||
1030 | 636 | it under the terms of the GNU Affero General Public License as published by | ||
1031 | 637 | the Free Software Foundation, either version 3 of the License, or | ||
1032 | 638 | (at your option) any later version. | ||
1033 | 639 | |||
1034 | 640 | This program is distributed in the hope that it will be useful, | ||
1035 | 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1036 | 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1037 | 643 | GNU Affero General Public License for more details. | ||
1038 | 644 | |||
1039 | 645 | You should have received a copy of the GNU Affero General Public License | ||
1040 | 646 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1041 | 647 | |||
1042 | 648 | Also add information on how to contact you by electronic and paper mail. | ||
1043 | 649 | |||
1044 | 650 | If your software can interact with users remotely through a computer | ||
1045 | 651 | network, you should also make sure that it provides a way for users to | ||
1046 | 652 | get its source. For example, if your program is a web application, its | ||
1047 | 653 | interface could display a "Source" link that leads users to an archive | ||
1048 | 654 | of the code. There are many ways you could offer source, and different | ||
1049 | 655 | solutions will be better for different programs; see section 13 for the | ||
1050 | 656 | specific requirements. | ||
1051 | 657 | |||
1052 | 658 | You should also get your employer (if you work as a programmer) or school, | ||
1053 | 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. | ||
1054 | 660 | For more information on this, and how to apply and follow the GNU AGPL, see | ||
1055 | 661 | <http://www.gnu.org/licenses/>. | ||
1056 | 0 | 662 | ||
1057 | === removed file 'COPYING' | |||
1058 | --- COPYING 2012-06-11 15:40:48 +0000 | |||
1059 | +++ COPYING 1970-01-01 00:00:00 +0000 | |||
1060 | @@ -1,661 +0,0 @@ | |||
1061 | 1 | GNU AFFERO GENERAL PUBLIC LICENSE | ||
1062 | 2 | Version 3, 19 November 2007 | ||
1063 | 3 | |||
1064 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | ||
1065 | 5 | Everyone is permitted to copy and distribute verbatim copies | ||
1066 | 6 | of this license document, but changing it is not allowed. | ||
1067 | 7 | |||
1068 | 8 | Preamble | ||
1069 | 9 | |||
1070 | 10 | The GNU Affero General Public License is a free, copyleft license for | ||
1071 | 11 | software and other kinds of works, specifically designed to ensure | ||
1072 | 12 | cooperation with the community in the case of network server software. | ||
1073 | 13 | |||
1074 | 14 | The licenses for most software and other practical works are designed | ||
1075 | 15 | to take away your freedom to share and change the works. By contrast, | ||
1076 | 16 | our General Public Licenses are intended to guarantee your freedom to | ||
1077 | 17 | share and change all versions of a program--to make sure it remains free | ||
1078 | 18 | software for all its users. | ||
1079 | 19 | |||
1080 | 20 | When we speak of free software, we are referring to freedom, not | ||
1081 | 21 | price. Our General Public Licenses are designed to make sure that you | ||
1082 | 22 | have the freedom to distribute copies of free software (and charge for | ||
1083 | 23 | them if you wish), that you receive source code or can get it if you | ||
1084 | 24 | want it, that you can change the software or use pieces of it in new | ||
1085 | 25 | free programs, and that you know you can do these things. | ||
1086 | 26 | |||
1087 | 27 | Developers that use our General Public Licenses protect your rights | ||
1088 | 28 | with two steps: (1) assert copyright on the software, and (2) offer | ||
1089 | 29 | you this License which gives you legal permission to copy, distribute | ||
1090 | 30 | and/or modify the software. | ||
1091 | 31 | |||
1092 | 32 | A secondary benefit of defending all users' freedom is that | ||
1093 | 33 | improvements made in alternate versions of the program, if they | ||
1094 | 34 | receive widespread use, become available for other developers to | ||
1095 | 35 | incorporate. Many developers of free software are heartened and | ||
1096 | 36 | encouraged by the resulting cooperation. However, in the case of | ||
1097 | 37 | software used on network servers, this result may fail to come about. | ||
1098 | 38 | The GNU General Public License permits making a modified version and | ||
1099 | 39 | letting the public access it on a server without ever releasing its | ||
1100 | 40 | source code to the public. | ||
1101 | 41 | |||
1102 | 42 | The GNU Affero General Public License is designed specifically to | ||
1103 | 43 | ensure that, in such cases, the modified source code becomes available | ||
1104 | 44 | to the community. It requires the operator of a network server to | ||
1105 | 45 | provide the source code of the modified version running there to the | ||
1106 | 46 | users of that server. Therefore, public use of a modified version, on | ||
1107 | 47 | a publicly accessible server, gives the public access to the source | ||
1108 | 48 | code of the modified version. | ||
1109 | 49 | |||
1110 | 50 | An older license, called the Affero General Public License and | ||
1111 | 51 | published by Affero, was designed to accomplish similar goals. This is | ||
1112 | 52 | a different license, not a version of the Affero GPL, but Affero has | ||
1113 | 53 | released a new version of the Affero GPL which permits relicensing under | ||
1114 | 54 | this license. | ||
1115 | 55 | |||
1116 | 56 | The precise terms and conditions for copying, distribution and | ||
1117 | 57 | modification follow. | ||
1118 | 58 | |||
1119 | 59 | TERMS AND CONDITIONS | ||
1120 | 60 | |||
1121 | 61 | 0. Definitions. | ||
1122 | 62 | |||
1123 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. | ||
1124 | 64 | |||
1125 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of | ||
1126 | 66 | works, such as semiconductor masks. | ||
1127 | 67 | |||
1128 | 68 | "The Program" refers to any copyrightable work licensed under this | ||
1129 | 69 | License. Each licensee is addressed as "you". "Licensees" and | ||
1130 | 70 | "recipients" may be individuals or organizations. | ||
1131 | 71 | |||
1132 | 72 | To "modify" a work means to copy from or adapt all or part of the work | ||
1133 | 73 | in a fashion requiring copyright permission, other than the making of an | ||
1134 | 74 | exact copy. The resulting work is called a "modified version" of the | ||
1135 | 75 | earlier work or a work "based on" the earlier work. | ||
1136 | 76 | |||
1137 | 77 | A "covered work" means either the unmodified Program or a work based | ||
1138 | 78 | on the Program. | ||
1139 | 79 | |||
1140 | 80 | To "propagate" a work means to do anything with it that, without | ||
1141 | 81 | permission, would make you directly or secondarily liable for | ||
1142 | 82 | infringement under applicable copyright law, except executing it on a | ||
1143 | 83 | computer or modifying a private copy. Propagation includes copying, | ||
1144 | 84 | distribution (with or without modification), making available to the | ||
1145 | 85 | public, and in some countries other activities as well. | ||
1146 | 86 | |||
1147 | 87 | To "convey" a work means any kind of propagation that enables other | ||
1148 | 88 | parties to make or receive copies. Mere interaction with a user through | ||
1149 | 89 | a computer network, with no transfer of a copy, is not conveying. | ||
1150 | 90 | |||
1151 | 91 | An interactive user interface displays "Appropriate Legal Notices" | ||
1152 | 92 | to the extent that it includes a convenient and prominently visible | ||
1153 | 93 | feature that (1) displays an appropriate copyright notice, and (2) | ||
1154 | 94 | tells the user that there is no warranty for the work (except to the | ||
1155 | 95 | extent that warranties are provided), that licensees may convey the | ||
1156 | 96 | work under this License, and how to view a copy of this License. If | ||
1157 | 97 | the interface presents a list of user commands or options, such as a | ||
1158 | 98 | menu, a prominent item in the list meets this criterion. | ||
1159 | 99 | |||
1160 | 100 | 1. Source Code. | ||
1161 | 101 | |||
1162 | 102 | The "source code" for a work means the preferred form of the work | ||
1163 | 103 | for making modifications to it. "Object code" means any non-source | ||
1164 | 104 | form of a work. | ||
1165 | 105 | |||
1166 | 106 | A "Standard Interface" means an interface that either is an official | ||
1167 | 107 | standard defined by a recognized standards body, or, in the case of | ||
1168 | 108 | interfaces specified for a particular programming language, one that | ||
1169 | 109 | is widely used among developers working in that language. | ||
1170 | 110 | |||
1171 | 111 | The "System Libraries" of an executable work include anything, other | ||
1172 | 112 | than the work as a whole, that (a) is included in the normal form of | ||
1173 | 113 | packaging a Major Component, but which is not part of that Major | ||
1174 | 114 | Component, and (b) serves only to enable use of the work with that | ||
1175 | 115 | Major Component, or to implement a Standard Interface for which an | ||
1176 | 116 | implementation is available to the public in source code form. A | ||
1177 | 117 | "Major Component", in this context, means a major essential component | ||
1178 | 118 | (kernel, window system, and so on) of the specific operating system | ||
1179 | 119 | (if any) on which the executable work runs, or a compiler used to | ||
1180 | 120 | produce the work, or an object code interpreter used to run it. | ||
1181 | 121 | |||
1182 | 122 | The "Corresponding Source" for a work in object code form means all | ||
1183 | 123 | the source code needed to generate, install, and (for an executable | ||
1184 | 124 | work) run the object code and to modify the work, including scripts to | ||
1185 | 125 | control those activities. However, it does not include the work's | ||
1186 | 126 | System Libraries, or general-purpose tools or generally available free | ||
1187 | 127 | programs which are used unmodified in performing those activities but | ||
1188 | 128 | which are not part of the work. For example, Corresponding Source | ||
1189 | 129 | includes interface definition files associated with source files for | ||
1190 | 130 | the work, and the source code for shared libraries and dynamically | ||
1191 | 131 | linked subprograms that the work is specifically designed to require, | ||
1192 | 132 | such as by intimate data communication or control flow between those | ||
1193 | 133 | subprograms and other parts of the work. | ||
1194 | 134 | |||
1195 | 135 | The Corresponding Source need not include anything that users | ||
1196 | 136 | can regenerate automatically from other parts of the Corresponding | ||
1197 | 137 | Source. | ||
1198 | 138 | |||
1199 | 139 | The Corresponding Source for a work in source code form is that | ||
1200 | 140 | same work. | ||
1201 | 141 | |||
1202 | 142 | 2. Basic Permissions. | ||
1203 | 143 | |||
1204 | 144 | All rights granted under this License are granted for the term of | ||
1205 | 145 | copyright on the Program, and are irrevocable provided the stated | ||
1206 | 146 | conditions are met. This License explicitly affirms your unlimited | ||
1207 | 147 | permission to run the unmodified Program. The output from running a | ||
1208 | 148 | covered work is covered by this License only if the output, given its | ||
1209 | 149 | content, constitutes a covered work. This License acknowledges your | ||
1210 | 150 | rights of fair use or other equivalent, as provided by copyright law. | ||
1211 | 151 | |||
1212 | 152 | You may make, run and propagate covered works that you do not | ||
1213 | 153 | convey, without conditions so long as your license otherwise remains | ||
1214 | 154 | in force. You may convey covered works to others for the sole purpose | ||
1215 | 155 | of having them make modifications exclusively for you, or provide you | ||
1216 | 156 | with facilities for running those works, provided that you comply with | ||
1217 | 157 | the terms of this License in conveying all material for which you do | ||
1218 | 158 | not control copyright. Those thus making or running the covered works | ||
1219 | 159 | for you must do so exclusively on your behalf, under your direction | ||
1220 | 160 | and control, on terms that prohibit them from making any copies of | ||
1221 | 161 | your copyrighted material outside their relationship with you. | ||
1222 | 162 | |||
1223 | 163 | Conveying under any other circumstances is permitted solely under | ||
1224 | 164 | the conditions stated below. Sublicensing is not allowed; section 10 | ||
1225 | 165 | makes it unnecessary. | ||
1226 | 166 | |||
1227 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. | ||
1228 | 168 | |||
1229 | 169 | No covered work shall be deemed part of an effective technological | ||
1230 | 170 | measure under any applicable law fulfilling obligations under article | ||
1231 | 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or | ||
1232 | 172 | similar laws prohibiting or restricting circumvention of such | ||
1233 | 173 | measures. | ||
1234 | 174 | |||
1235 | 175 | When you convey a covered work, you waive any legal power to forbid | ||
1236 | 176 | circumvention of technological measures to the extent such circumvention | ||
1237 | 177 | is effected by exercising rights under this License with respect to | ||
1238 | 178 | the covered work, and you disclaim any intention to limit operation or | ||
1239 | 179 | modification of the work as a means of enforcing, against the work's | ||
1240 | 180 | users, your or third parties' legal rights to forbid circumvention of | ||
1241 | 181 | technological measures. | ||
1242 | 182 | |||
1243 | 183 | 4. Conveying Verbatim Copies. | ||
1244 | 184 | |||
1245 | 185 | You may convey verbatim copies of the Program's source code as you | ||
1246 | 186 | receive it, in any medium, provided that you conspicuously and | ||
1247 | 187 | appropriately publish on each copy an appropriate copyright notice; | ||
1248 | 188 | keep intact all notices stating that this License and any | ||
1249 | 189 | non-permissive terms added in accord with section 7 apply to the code; | ||
1250 | 190 | keep intact all notices of the absence of any warranty; and give all | ||
1251 | 191 | recipients a copy of this License along with the Program. | ||
1252 | 192 | |||
1253 | 193 | You may charge any price or no price for each copy that you convey, | ||
1254 | 194 | and you may offer support or warranty protection for a fee. | ||
1255 | 195 | |||
1256 | 196 | 5. Conveying Modified Source Versions. | ||
1257 | 197 | |||
1258 | 198 | You may convey a work based on the Program, or the modifications to | ||
1259 | 199 | produce it from the Program, in the form of source code under the | ||
1260 | 200 | terms of section 4, provided that you also meet all of these conditions: | ||
1261 | 201 | |||
1262 | 202 | a) The work must carry prominent notices stating that you modified | ||
1263 | 203 | it, and giving a relevant date. | ||
1264 | 204 | |||
1265 | 205 | b) The work must carry prominent notices stating that it is | ||
1266 | 206 | released under this License and any conditions added under section | ||
1267 | 207 | 7. This requirement modifies the requirement in section 4 to | ||
1268 | 208 | "keep intact all notices". | ||
1269 | 209 | |||
1270 | 210 | c) You must license the entire work, as a whole, under this | ||
1271 | 211 | License to anyone who comes into possession of a copy. This | ||
1272 | 212 | License will therefore apply, along with any applicable section 7 | ||
1273 | 213 | additional terms, to the whole of the work, and all its parts, | ||
1274 | 214 | regardless of how they are packaged. This License gives no | ||
1275 | 215 | permission to license the work in any other way, but it does not | ||
1276 | 216 | invalidate such permission if you have separately received it. | ||
1277 | 217 | |||
1278 | 218 | d) If the work has interactive user interfaces, each must display | ||
1279 | 219 | Appropriate Legal Notices; however, if the Program has interactive | ||
1280 | 220 | interfaces that do not display Appropriate Legal Notices, your | ||
1281 | 221 | work need not make them do so. | ||
1282 | 222 | |||
1283 | 223 | A compilation of a covered work with other separate and independent | ||
1284 | 224 | works, which are not by their nature extensions of the covered work, | ||
1285 | 225 | and which are not combined with it such as to form a larger program, | ||
1286 | 226 | in or on a volume of a storage or distribution medium, is called an | ||
1287 | 227 | "aggregate" if the compilation and its resulting copyright are not | ||
1288 | 228 | used to limit the access or legal rights of the compilation's users | ||
1289 | 229 | beyond what the individual works permit. Inclusion of a covered work | ||
1290 | 230 | in an aggregate does not cause this License to apply to the other | ||
1291 | 231 | parts of the aggregate. | ||
1292 | 232 | |||
1293 | 233 | 6. Conveying Non-Source Forms. | ||
1294 | 234 | |||
1295 | 235 | You may convey a covered work in object code form under the terms | ||
1296 | 236 | of sections 4 and 5, provided that you also convey the | ||
1297 | 237 | machine-readable Corresponding Source under the terms of this License, | ||
1298 | 238 | in one of these ways: | ||
1299 | 239 | |||
1300 | 240 | a) Convey the object code in, or embodied in, a physical product | ||
1301 | 241 | (including a physical distribution medium), accompanied by the | ||
1302 | 242 | Corresponding Source fixed on a durable physical medium | ||
1303 | 243 | customarily used for software interchange. | ||
1304 | 244 | |||
1305 | 245 | b) Convey the object code in, or embodied in, a physical product | ||
1306 | 246 | (including a physical distribution medium), accompanied by a | ||
1307 | 247 | written offer, valid for at least three years and valid for as | ||
1308 | 248 | long as you offer spare parts or customer support for that product | ||
1309 | 249 | model, to give anyone who possesses the object code either (1) a | ||
1310 | 250 | copy of the Corresponding Source for all the software in the | ||
1311 | 251 | product that is covered by this License, on a durable physical | ||
1312 | 252 | medium customarily used for software interchange, for a price no | ||
1313 | 253 | more than your reasonable cost of physically performing this | ||
1314 | 254 | conveying of source, or (2) access to copy the | ||
1315 | 255 | Corresponding Source from a network server at no charge. | ||
1316 | 256 | |||
1317 | 257 | c) Convey individual copies of the object code with a copy of the | ||
1318 | 258 | written offer to provide the Corresponding Source. This | ||
1319 | 259 | alternative is allowed only occasionally and noncommercially, and | ||
1320 | 260 | only if you received the object code with such an offer, in accord | ||
1321 | 261 | with subsection 6b. | ||
1322 | 262 | |||
1323 | 263 | d) Convey the object code by offering access from a designated | ||
1324 | 264 | place (gratis or for a charge), and offer equivalent access to the | ||
1325 | 265 | Corresponding Source in the same way through the same place at no | ||
1326 | 266 | further charge. You need not require recipients to copy the | ||
1327 | 267 | Corresponding Source along with the object code. If the place to | ||
1328 | 268 | copy the object code is a network server, the Corresponding Source | ||
1329 | 269 | may be on a different server (operated by you or a third party) | ||
1330 | 270 | that supports equivalent copying facilities, provided you maintain | ||
1331 | 271 | clear directions next to the object code saying where to find the | ||
1332 | 272 | Corresponding Source. Regardless of what server hosts the | ||
1333 | 273 | Corresponding Source, you remain obligated to ensure that it is | ||
1334 | 274 | available for as long as needed to satisfy these requirements. | ||
1335 | 275 | |||
1336 | 276 | e) Convey the object code using peer-to-peer transmission, provided | ||
1337 | 277 | you inform other peers where the object code and Corresponding | ||
1338 | 278 | Source of the work are being offered to the general public at no | ||
1339 | 279 | charge under subsection 6d. | ||
1340 | 280 | |||
1341 | 281 | A separable portion of the object code, whose source code is excluded | ||
1342 | 282 | from the Corresponding Source as a System Library, need not be | ||
1343 | 283 | included in conveying the object code work. | ||
1344 | 284 | |||
1345 | 285 | A "User Product" is either (1) a "consumer product", which means any | ||
1346 | 286 | tangible personal property which is normally used for personal, family, | ||
1347 | 287 | or household purposes, or (2) anything designed or sold for incorporation | ||
1348 | 288 | into a dwelling. In determining whether a product is a consumer product, | ||
1349 | 289 | doubtful cases shall be resolved in favor of coverage. For a particular | ||
1350 | 290 | product received by a particular user, "normally used" refers to a | ||
1351 | 291 | typical or common use of that class of product, regardless of the status | ||
1352 | 292 | of the particular user or of the way in which the particular user | ||
1353 | 293 | actually uses, or expects or is expected to use, the product. A product | ||
1354 | 294 | is a consumer product regardless of whether the product has substantial | ||
1355 | 295 | commercial, industrial or non-consumer uses, unless such uses represent | ||
1356 | 296 | the only significant mode of use of the product. | ||
1357 | 297 | |||
1358 | 298 | "Installation Information" for a User Product means any methods, | ||
1359 | 299 | procedures, authorization keys, or other information required to install | ||
1360 | 300 | and execute modified versions of a covered work in that User Product from | ||
1361 | 301 | a modified version of its Corresponding Source. The information must | ||
1362 | 302 | suffice to ensure that the continued functioning of the modified object | ||
1363 | 303 | code is in no case prevented or interfered with solely because | ||
1364 | 304 | modification has been made. | ||
1365 | 305 | |||
1366 | 306 | If you convey an object code work under this section in, or with, or | ||
1367 | 307 | specifically for use in, a User Product, and the conveying occurs as | ||
1368 | 308 | part of a transaction in which the right of possession and use of the | ||
1369 | 309 | User Product is transferred to the recipient in perpetuity or for a | ||
1370 | 310 | fixed term (regardless of how the transaction is characterized), the | ||
1371 | 311 | Corresponding Source conveyed under this section must be accompanied | ||
1372 | 312 | by the Installation Information. But this requirement does not apply | ||
1373 | 313 | if neither you nor any third party retains the ability to install | ||
1374 | 314 | modified object code on the User Product (for example, the work has | ||
1375 | 315 | been installed in ROM). | ||
1376 | 316 | |||
1377 | 317 | The requirement to provide Installation Information does not include a | ||
1378 | 318 | requirement to continue to provide support service, warranty, or updates | ||
1379 | 319 | for a work that has been modified or installed by the recipient, or for | ||
1380 | 320 | the User Product in which it has been modified or installed. Access to a | ||
1381 | 321 | network may be denied when the modification itself materially and | ||
1382 | 322 | adversely affects the operation of the network or violates the rules and | ||
1383 | 323 | protocols for communication across the network. | ||
1384 | 324 | |||
1385 | 325 | Corresponding Source conveyed, and Installation Information provided, | ||
1386 | 326 | in accord with this section must be in a format that is publicly | ||
1387 | 327 | documented (and with an implementation available to the public in | ||
1388 | 328 | source code form), and must require no special password or key for | ||
1389 | 329 | unpacking, reading or copying. | ||
1390 | 330 | |||
1391 | 331 | 7. Additional Terms. | ||
1392 | 332 | |||
1393 | 333 | "Additional permissions" are terms that supplement the terms of this | ||
1394 | 334 | License by making exceptions from one or more of its conditions. | ||
1395 | 335 | Additional permissions that are applicable to the entire Program shall | ||
1396 | 336 | be treated as though they were included in this License, to the extent | ||
1397 | 337 | that they are valid under applicable law. If additional permissions | ||
1398 | 338 | apply only to part of the Program, that part may be used separately | ||
1399 | 339 | under those permissions, but the entire Program remains governed by | ||
1400 | 340 | this License without regard to the additional permissions. | ||
1401 | 341 | |||
1402 | 342 | When you convey a copy of a covered work, you may at your option | ||
1403 | 343 | remove any additional permissions from that copy, or from any part of | ||
1404 | 344 | it. (Additional permissions may be written to require their own | ||
1405 | 345 | removal in certain cases when you modify the work.) You may place | ||
1406 | 346 | additional permissions on material, added by you to a covered work, | ||
1407 | 347 | for which you have or can give appropriate copyright permission. | ||
1408 | 348 | |||
1409 | 349 | Notwithstanding any other provision of this License, for material you | ||
1410 | 350 | add to a covered work, you may (if authorized by the copyright holders of | ||
1411 | 351 | that material) supplement the terms of this License with terms: | ||
1412 | 352 | |||
1413 | 353 | a) Disclaiming warranty or limiting liability differently from the | ||
1414 | 354 | terms of sections 15 and 16 of this License; or | ||
1415 | 355 | |||
1416 | 356 | b) Requiring preservation of specified reasonable legal notices or | ||
1417 | 357 | author attributions in that material or in the Appropriate Legal | ||
1418 | 358 | Notices displayed by works containing it; or | ||
1419 | 359 | |||
1420 | 360 | c) Prohibiting misrepresentation of the origin of that material, or | ||
1421 | 361 | requiring that modified versions of such material be marked in | ||
1422 | 362 | reasonable ways as different from the original version; or | ||
1423 | 363 | |||
1424 | 364 | d) Limiting the use for publicity purposes of names of licensors or | ||
1425 | 365 | authors of the material; or | ||
1426 | 366 | |||
1427 | 367 | e) Declining to grant rights under trademark law for use of some | ||
1428 | 368 | trade names, trademarks, or service marks; or | ||
1429 | 369 | |||
1430 | 370 | f) Requiring indemnification of licensors and authors of that | ||
1431 | 371 | material by anyone who conveys the material (or modified versions of | ||
1432 | 372 | it) with contractual assumptions of liability to the recipient, for | ||
1433 | 373 | any liability that these contractual assumptions directly impose on | ||
1434 | 374 | those licensors and authors. | ||
1435 | 375 | |||
1436 | 376 | All other non-permissive additional terms are considered "further | ||
1437 | 377 | restrictions" within the meaning of section 10. If the Program as you | ||
1438 | 378 | received it, or any part of it, contains a notice stating that it is | ||
1439 | 379 | governed by this License along with a term that is a further | ||
1440 | 380 | restriction, you may remove that term. If a license document contains | ||
1441 | 381 | a further restriction but permits relicensing or conveying under this | ||
1442 | 382 | License, you may add to a covered work material governed by the terms | ||
1443 | 383 | of that license document, provided that the further restriction does | ||
1444 | 384 | not survive such relicensing or conveying. | ||
1445 | 385 | |||
1446 | 386 | If you add terms to a covered work in accord with this section, you | ||
1447 | 387 | must place, in the relevant source files, a statement of the | ||
1448 | 388 | additional terms that apply to those files, or a notice indicating | ||
1449 | 389 | where to find the applicable terms. | ||
1450 | 390 | |||
1451 | 391 | Additional terms, permissive or non-permissive, may be stated in the | ||
1452 | 392 | form of a separately written license, or stated as exceptions; | ||
1453 | 393 | the above requirements apply either way. | ||
1454 | 394 | |||
1455 | 395 | 8. Termination. | ||
1456 | 396 | |||
1457 | 397 | You may not propagate or modify a covered work except as expressly | ||
1458 | 398 | provided under this License. Any attempt otherwise to propagate or | ||
1459 | 399 | modify it is void, and will automatically terminate your rights under | ||
1460 | 400 | this License (including any patent licenses granted under the third | ||
1461 | 401 | paragraph of section 11). | ||
1462 | 402 | |||
1463 | 403 | However, if you cease all violation of this License, then your | ||
1464 | 404 | license from a particular copyright holder is reinstated (a) | ||
1465 | 405 | provisionally, unless and until the copyright holder explicitly and | ||
1466 | 406 | finally terminates your license, and (b) permanently, if the copyright | ||
1467 | 407 | holder fails to notify you of the violation by some reasonable means | ||
1468 | 408 | prior to 60 days after the cessation. | ||
1469 | 409 | |||
1470 | 410 | Moreover, your license from a particular copyright holder is | ||
1471 | 411 | reinstated permanently if the copyright holder notifies you of the | ||
1472 | 412 | violation by some reasonable means, this is the first time you have | ||
1473 | 413 | received notice of violation of this License (for any work) from that | ||
1474 | 414 | copyright holder, and you cure the violation prior to 30 days after | ||
1475 | 415 | your receipt of the notice. | ||
1476 | 416 | |||
1477 | 417 | Termination of your rights under this section does not terminate the | ||
1478 | 418 | licenses of parties who have received copies or rights from you under | ||
1479 | 419 | this License. If your rights have been terminated and not permanently | ||
1480 | 420 | reinstated, you do not qualify to receive new licenses for the same | ||
1481 | 421 | material under section 10. | ||
1482 | 422 | |||
1483 | 423 | 9. Acceptance Not Required for Having Copies. | ||
1484 | 424 | |||
1485 | 425 | You are not required to accept this License in order to receive or | ||
1486 | 426 | run a copy of the Program. Ancillary propagation of a covered work | ||
1487 | 427 | occurring solely as a consequence of using peer-to-peer transmission | ||
1488 | 428 | to receive a copy likewise does not require acceptance. However, | ||
1489 | 429 | nothing other than this License grants you permission to propagate or | ||
1490 | 430 | modify any covered work. These actions infringe copyright if you do | ||
1491 | 431 | not accept this License. Therefore, by modifying or propagating a | ||
1492 | 432 | covered work, you indicate your acceptance of this License to do so. | ||
1493 | 433 | |||
1494 | 434 | 10. Automatic Licensing of Downstream Recipients. | ||
1495 | 435 | |||
1496 | 436 | Each time you convey a covered work, the recipient automatically | ||
1497 | 437 | receives a license from the original licensors, to run, modify and | ||
1498 | 438 | propagate that work, subject to this License. You are not responsible | ||
1499 | 439 | for enforcing compliance by third parties with this License. | ||
1500 | 440 | |||
1501 | 441 | An "entity transaction" is a transaction transferring control of an | ||
1502 | 442 | organization, or substantially all assets of one, or subdividing an | ||
1503 | 443 | organization, or merging organizations. If propagation of a covered | ||
1504 | 444 | work results from an entity transaction, each party to that | ||
1505 | 445 | transaction who receives a copy of the work also receives whatever | ||
1506 | 446 | licenses to the work the party's predecessor in interest had or could | ||
1507 | 447 | give under the previous paragraph, plus a right to possession of the | ||
1508 | 448 | Corresponding Source of the work from the predecessor in interest, if | ||
1509 | 449 | the predecessor has it or can get it with reasonable efforts. | ||
1510 | 450 | |||
1511 | 451 | You may not impose any further restrictions on the exercise of the | ||
1512 | 452 | rights granted or affirmed under this License. For example, you may | ||
1513 | 453 | not impose a license fee, royalty, or other charge for exercise of | ||
1514 | 454 | rights granted under this License, and you may not initiate litigation | ||
1515 | 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that | ||
1516 | 456 | any patent claim is infringed by making, using, selling, offering for | ||
1517 | 457 | sale, or importing the Program or any portion of it. | ||
1518 | 458 | |||
1519 | 459 | 11. Patents. | ||
1520 | 460 | |||
1521 | 461 | A "contributor" is a copyright holder who authorizes use under this | ||
1522 | 462 | License of the Program or a work on which the Program is based. The | ||
1523 | 463 | work thus licensed is called the contributor's "contributor version". | ||
1524 | 464 | |||
1525 | 465 | A contributor's "essential patent claims" are all patent claims | ||
1526 | 466 | owned or controlled by the contributor, whether already acquired or | ||
1527 | 467 | hereafter acquired, that would be infringed by some manner, permitted | ||
1528 | 468 | by this License, of making, using, or selling its contributor version, | ||
1529 | 469 | but do not include claims that would be infringed only as a | ||
1530 | 470 | consequence of further modification of the contributor version. For | ||
1531 | 471 | purposes of this definition, "control" includes the right to grant | ||
1532 | 472 | patent sublicenses in a manner consistent with the requirements of | ||
1533 | 473 | this License. | ||
1534 | 474 | |||
1535 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free | ||
1536 | 476 | patent license under the contributor's essential patent claims, to | ||
1537 | 477 | make, use, sell, offer for sale, import and otherwise run, modify and | ||
1538 | 478 | propagate the contents of its contributor version. | ||
1539 | 479 | |||
1540 | 480 | In the following three paragraphs, a "patent license" is any express | ||
1541 | 481 | agreement or commitment, however denominated, not to enforce a patent | ||
1542 | 482 | (such as an express permission to practice a patent or covenant not to | ||
1543 | 483 | sue for patent infringement). To "grant" such a patent license to a | ||
1544 | 484 | party means to make such an agreement or commitment not to enforce a | ||
1545 | 485 | patent against the party. | ||
1546 | 486 | |||
1547 | 487 | If you convey a covered work, knowingly relying on a patent license, | ||
1548 | 488 | and the Corresponding Source of the work is not available for anyone | ||
1549 | 489 | to copy, free of charge and under the terms of this License, through a | ||
1550 | 490 | publicly available network server or other readily accessible means, | ||
1551 | 491 | then you must either (1) cause the Corresponding Source to be so | ||
1552 | 492 | available, or (2) arrange to deprive yourself of the benefit of the | ||
1553 | 493 | patent license for this particular work, or (3) arrange, in a manner | ||
1554 | 494 | consistent with the requirements of this License, to extend the patent | ||
1555 | 495 | license to downstream recipients. "Knowingly relying" means you have | ||
1556 | 496 | actual knowledge that, but for the patent license, your conveying the | ||
1557 | 497 | covered work in a country, or your recipient's use of the covered work | ||
1558 | 498 | in a country, would infringe one or more identifiable patents in that | ||
1559 | 499 | country that you have reason to believe are valid. | ||
1560 | 500 | |||
1561 | 501 | If, pursuant to or in connection with a single transaction or | ||
1562 | 502 | arrangement, you convey, or propagate by procuring conveyance of, a | ||
1563 | 503 | covered work, and grant a patent license to some of the parties | ||
1564 | 504 | receiving the covered work authorizing them to use, propagate, modify | ||
1565 | 505 | or convey a specific copy of the covered work, then the patent license | ||
1566 | 506 | you grant is automatically extended to all recipients of the covered | ||
1567 | 507 | work and works based on it. | ||
1568 | 508 | |||
1569 | 509 | A patent license is "discriminatory" if it does not include within | ||
1570 | 510 | the scope of its coverage, prohibits the exercise of, or is | ||
1571 | 511 | conditioned on the non-exercise of one or more of the rights that are | ||
1572 | 512 | specifically granted under this License. You may not convey a covered | ||
1573 | 513 | work if you are a party to an arrangement with a third party that is | ||
1574 | 514 | in the business of distributing software, under which you make payment | ||
1575 | 515 | to the third party based on the extent of your activity of conveying | ||
1576 | 516 | the work, and under which the third party grants, to any of the | ||
1577 | 517 | parties who would receive the covered work from you, a discriminatory | ||
1578 | 518 | patent license (a) in connection with copies of the covered work | ||
1579 | 519 | conveyed by you (or copies made from those copies), or (b) primarily | ||
1580 | 520 | for and in connection with specific products or compilations that | ||
1581 | 521 | contain the covered work, unless you entered into that arrangement, | ||
1582 | 522 | or that patent license was granted, prior to 28 March 2007. | ||
1583 | 523 | |||
1584 | 524 | Nothing in this License shall be construed as excluding or limiting | ||
1585 | 525 | any implied license or other defenses to infringement that may | ||
1586 | 526 | otherwise be available to you under applicable patent law. | ||
1587 | 527 | |||
1588 | 528 | 12. No Surrender of Others' Freedom. | ||
1589 | 529 | |||
1590 | 530 | If conditions are imposed on you (whether by court order, agreement or | ||
1591 | 531 | otherwise) that contradict the conditions of this License, they do not | ||
1592 | 532 | excuse you from the conditions of this License. If you cannot convey a | ||
1593 | 533 | covered work so as to satisfy simultaneously your obligations under this | ||
1594 | 534 | License and any other pertinent obligations, then as a consequence you may | ||
1595 | 535 | not convey it at all. For example, if you agree to terms that obligate you | ||
1596 | 536 | to collect a royalty for further conveying from those to whom you convey | ||
1597 | 537 | the Program, the only way you could satisfy both those terms and this | ||
1598 | 538 | License would be to refrain entirely from conveying the Program. | ||
1599 | 539 | |||
1600 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. | ||
1601 | 541 | |||
1602 | 542 | Notwithstanding any other provision of this License, if you modify the | ||
1603 | 543 | Program, your modified version must prominently offer all users | ||
1604 | 544 | interacting with it remotely through a computer network (if your version | ||
1605 | 545 | supports such interaction) an opportunity to receive the Corresponding | ||
1606 | 546 | Source of your version by providing access to the Corresponding Source | ||
1607 | 547 | from a network server at no charge, through some standard or customary | ||
1608 | 548 | means of facilitating copying of software. This Corresponding Source | ||
1609 | 549 | shall include the Corresponding Source for any work covered by version 3 | ||
1610 | 550 | of the GNU General Public License that is incorporated pursuant to the | ||
1611 | 551 | following paragraph. | ||
1612 | 552 | |||
1613 | 553 | Notwithstanding any other provision of this License, you have | ||
1614 | 554 | permission to link or combine any covered work with a work licensed | ||
1615 | 555 | under version 3 of the GNU General Public License into a single | ||
1616 | 556 | combined work, and to convey the resulting work. The terms of this | ||
1617 | 557 | License will continue to apply to the part which is the covered work, | ||
1618 | 558 | but the work with which it is combined will remain governed by version | ||
1619 | 559 | 3 of the GNU General Public License. | ||
1620 | 560 | |||
1621 | 561 | 14. Revised Versions of this License. | ||
1622 | 562 | |||
1623 | 563 | The Free Software Foundation may publish revised and/or new versions of | ||
1624 | 564 | the GNU Affero General Public License from time to time. Such new versions | ||
1625 | 565 | will be similar in spirit to the present version, but may differ in detail to | ||
1626 | 566 | address new problems or concerns. | ||
1627 | 567 | |||
1628 | 568 | Each version is given a distinguishing version number. If the | ||
1629 | 569 | Program specifies that a certain numbered version of the GNU Affero General | ||
1630 | 570 | Public License "or any later version" applies to it, you have the | ||
1631 | 571 | option of following the terms and conditions either of that numbered | ||
1632 | 572 | version or of any later version published by the Free Software | ||
1633 | 573 | Foundation. If the Program does not specify a version number of the | ||
1634 | 574 | GNU Affero General Public License, you may choose any version ever published | ||
1635 | 575 | by the Free Software Foundation. | ||
1636 | 576 | |||
1637 | 577 | If the Program specifies that a proxy can decide which future | ||
1638 | 578 | versions of the GNU Affero General Public License can be used, that proxy's | ||
1639 | 579 | public statement of acceptance of a version permanently authorizes you | ||
1640 | 580 | to choose that version for the Program. | ||
1641 | 581 | |||
1642 | 582 | Later license versions may give you additional or different | ||
1643 | 583 | permissions. However, no additional obligations are imposed on any | ||
1644 | 584 | author or copyright holder as a result of your choosing to follow a | ||
1645 | 585 | later version. | ||
1646 | 586 | |||
1647 | 587 | 15. Disclaimer of Warranty. | ||
1648 | 588 | |||
1649 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY | ||
1650 | 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT | ||
1651 | 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY | ||
1652 | 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, | ||
1653 | 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
1654 | 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM | ||
1655 | 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF | ||
1656 | 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | ||
1657 | 597 | |||
1658 | 598 | 16. Limitation of Liability. | ||
1659 | 599 | |||
1660 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | ||
1661 | 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS | ||
1662 | 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY | ||
1663 | 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE | ||
1664 | 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF | ||
1665 | 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD | ||
1666 | 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), | ||
1667 | 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF | ||
1668 | 608 | SUCH DAMAGES. | ||
1669 | 609 | |||
1670 | 610 | 17. Interpretation of Sections 15 and 16. | ||
1671 | 611 | |||
1672 | 612 | If the disclaimer of warranty and limitation of liability provided | ||
1673 | 613 | above cannot be given local legal effect according to their terms, | ||
1674 | 614 | reviewing courts shall apply local law that most closely approximates | ||
1675 | 615 | an absolute waiver of all civil liability in connection with the | ||
1676 | 616 | Program, unless a warranty or assumption of liability accompanies a | ||
1677 | 617 | copy of the Program in return for a fee. | ||
1678 | 618 | |||
1679 | 619 | END OF TERMS AND CONDITIONS | ||
1680 | 620 | |||
1681 | 621 | How to Apply These Terms to Your New Programs | ||
1682 | 622 | |||
1683 | 623 | If you develop a new program, and you want it to be of the greatest | ||
1684 | 624 | possible use to the public, the best way to achieve this is to make it | ||
1685 | 625 | free software which everyone can redistribute and change under these terms. | ||
1686 | 626 | |||
1687 | 627 | To do so, attach the following notices to the program. It is safest | ||
1688 | 628 | to attach them to the start of each source file to most effectively | ||
1689 | 629 | state the exclusion of warranty; and each file should have at least | ||
1690 | 630 | the "copyright" line and a pointer to where the full notice is found. | ||
1691 | 631 | |||
1692 | 632 | <one line to give the program's name and a brief idea of what it does.> | ||
1693 | 633 | Copyright (C) <year> <name of author> | ||
1694 | 634 | |||
1695 | 635 | This program is free software: you can redistribute it and/or modify | ||
1696 | 636 | it under the terms of the GNU Affero General Public License as published by | ||
1697 | 637 | the Free Software Foundation, either version 3 of the License, or | ||
1698 | 638 | (at your option) any later version. | ||
1699 | 639 | |||
1700 | 640 | This program is distributed in the hope that it will be useful, | ||
1701 | 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1702 | 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1703 | 643 | GNU Affero General Public License for more details. | ||
1704 | 644 | |||
1705 | 645 | You should have received a copy of the GNU Affero General Public License | ||
1706 | 646 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1707 | 647 | |||
1708 | 648 | Also add information on how to contact you by electronic and paper mail. | ||
1709 | 649 | |||
1710 | 650 | If your software can interact with users remotely through a computer | ||
1711 | 651 | network, you should also make sure that it provides a way for users to | ||
1712 | 652 | get its source. For example, if your program is a web application, its | ||
1713 | 653 | interface could display a "Source" link that leads users to an archive | ||
1714 | 654 | of the code. There are many ways you could offer source, and different | ||
1715 | 655 | solutions will be better for different programs; see section 13 for the | ||
1716 | 656 | specific requirements. | ||
1717 | 657 | |||
1718 | 658 | You should also get your employer (if you work as a programmer) or school, | ||
1719 | 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. | ||
1720 | 660 | For more information on this, and how to apply and follow the GNU AGPL, see | ||
1721 | 661 | <http://www.gnu.org/licenses/>. | ||
1722 | 662 | 0 | ||
1723 | === added file 'Makefile' | |||
1724 | --- Makefile 1970-01-01 00:00:00 +0000 | |||
1725 | +++ Makefile 2013-04-22 11:00:38 +0000 | |||
1726 | @@ -0,0 +1,54 @@ | |||
1727 | 1 | PEP8=pep8 | ||
1728 | 2 | COVERAGE_FILES=`find juju -name "*py" | grep -v "tests\|lib/mocker.py\|lib/testing.py"` | ||
1729 | 3 | |||
1730 | 4 | all: | ||
1731 | 5 | @echo "You've just watched the fastest build on earth." | ||
1732 | 6 | |||
1733 | 7 | tests: | ||
1734 | 8 | ./test | ||
1735 | 9 | |||
1736 | 10 | coverage: | ||
1737 | 11 | python -c "import coverage as c; c.main()" run ./test | ||
1738 | 12 | python -c "import coverage as c; c.main()" html -d htmlcov $(COVERAGE_FILES) | ||
1739 | 13 | gnome-open htmlcov/index.html | ||
1740 | 14 | |||
1741 | 15 | ftests: | ||
1742 | 16 | ./test --functional | ||
1743 | 17 | |||
1744 | 18 | tags: | ||
1745 | 19 | @ctags --python-kinds=-iv -R juju | ||
1746 | 20 | |||
1747 | 21 | etags: | ||
1748 | 22 | @ctags -e --python-kinds=-iv -R juju | ||
1749 | 23 | |||
1750 | 24 | |||
1751 | 25 | present_pep8=$(shell which $(PEP8)) | ||
1752 | 26 | present_pyflakes=$(shell which pyflakes) | ||
1753 | 27 | warn_missing_linters: | ||
1754 | 28 | @test -n "$(present_pep8)" || echo "WARNING: $(PEP8) not installed." | ||
1755 | 29 | @test -n "$(present_pyflakes)" || echo "WARNING: pyflakes not installed." | ||
1756 | 30 | |||
1757 | 31 | |||
1758 | 32 | # "check": Check uncommitted changes for lint. | ||
1759 | 33 | check_changes=$(shell bzr status -S | grep '^[ +]*[MN]' | awk '{print $$2;}' | grep "\\.py$$") | ||
1760 | 34 | check: warn_missing_linters | ||
1761 | 35 | @test -z $(present_pep8) || (echo $(check_changes) | xargs -r $(PEP8) --repeat) | ||
1762 | 36 | @test -z $(present_pyflakes) || (echo $(check_changes) | xargs -r pyflakes) | ||
1763 | 37 | |||
1764 | 38 | |||
1765 | 39 | # "review": Check all changes compared to trunk for lint. | ||
1766 | 40 | review_changes=$(shell bzr status -S -r ancestor:$(JUJU_TRUNK) | grep '^[ +]*[MN]' | awk '{print $$2;}' | grep "\\.py$$") | ||
1767 | 41 | review: warn_missing_linters | ||
1768 | 42 | #@test -z $(present_pep8) || (echo $(review_changes) | xargs -r $(PEP8) --repeat) | ||
1769 | 43 | @test -z $(present_pyflakes) || (echo $(review_changes) | xargs -r pyflakes) | ||
1770 | 44 | |||
1771 | 45 | |||
1772 | 46 | ptests_changes=$(shell bzr status -S -r branch::prev | grep -P '^[ +]*[MN]' | awk '{print $$2;}'| grep "test_.*\\.py$$") | ||
1773 | 47 | ptests: | ||
1774 | 48 | @echo $(ptests_changes) | xargs -r ./test | ||
1775 | 49 | |||
1776 | 50 | btests_changes=$(shell bzr status -S -r ancestor:$(JUJU_TRUNK)/ | grep "test.*\\.py$$" | awk '{print $$2;}') | ||
1777 | 51 | btests: | ||
1778 | 52 | @./test $(btests_changes) | ||
1779 | 53 | |||
1780 | 54 | .PHONY: tags check review warn_missing_linters | ||
1781 | 0 | 55 | ||
1782 | === removed file 'Makefile' | |||
1783 | --- Makefile 2012-10-09 12:35:35 +0000 | |||
1784 | +++ Makefile 1970-01-01 00:00:00 +0000 | |||
1785 | @@ -1,44 +0,0 @@ | |||
1786 | 1 | PEP8=pep8 | ||
1787 | 2 | COVERAGE_FILES=`find juju -name "*py" | grep -v "tests\|lib/mocker.py\|lib/testing.py"` | ||
1788 | 3 | |||
1789 | 4 | all: | ||
1790 | 5 | @echo "You've just watched the fastest build on earth." | ||
1791 | 6 | |||
1792 | 7 | tests: | ||
1793 | 8 | ./test | ||
1794 | 9 | |||
1795 | 10 | coverage: | ||
1796 | 11 | python -c "import coverage as c; c.main()" run ./test | ||
1797 | 12 | python -c "import coverage as c; c.main()" html -d htmlcov $(COVERAGE_FILES) | ||
1798 | 13 | gnome-open htmlcov/index.html | ||
1799 | 14 | |||
1800 | 15 | ftests: | ||
1801 | 16 | ./test --functional | ||
1802 | 17 | |||
1803 | 18 | tags: | ||
1804 | 19 | @ctags --python-kinds=-iv -R juju | ||
1805 | 20 | |||
1806 | 21 | etags: | ||
1807 | 22 | @ctags -e --python-kinds=-iv -R juju | ||
1808 | 23 | |||
1809 | 24 | modified=$(shell bzr status -S |grep -P '^\s*M' | awk '{print $$2;}'| grep -P ".py$$") | ||
1810 | 25 | check: | ||
1811 | 26 | @test -n "$(modified)" && echo $(modified) | xargs $(PEP8) --repeat | ||
1812 | 27 | @test -n "$(modified)" && echo $(modified) | xargs pyflakes | ||
1813 | 28 | |||
1814 | 29 | |||
1815 | 30 | modified=$(shell bzr status -S -r ancestor:$(JUJU_TRUNK) |grep -P '^\s*M' | awk '{print $$2;}'| grep -P ".py$$") | ||
1816 | 31 | review: | ||
1817 | 32 | #@test -n "$(modified)" && echo $(modified) | xargs $(PEP8) --repeat | ||
1818 | 33 | @test -n "$(modified)" && echo $(modified) | xargs pyflakes | ||
1819 | 34 | |||
1820 | 35 | |||
1821 | 36 | modified=$(shell bzr status -S -r branch::prev |grep -P '^\s*\+?[MN]' | awk '{print $$2;}'| grep -P "test_.*\.py$$") | ||
1822 | 37 | ptests: | ||
1823 | 38 | @test -n "$(modified)" && echo $(modified) | xargs ./test | ||
1824 | 39 | |||
1825 | 40 | modified=$(shell bzr status -S -r ancestor:$(JUJU_TRUNK)/|grep -P 'test.*\.py' |awk '{print $$2;}') | ||
1826 | 41 | btests: | ||
1827 | 42 | @./test $(modified) | ||
1828 | 43 | |||
1829 | 44 | .PHONY: tags check review | ||
1830 | 45 | 0 | ||
1831 | === added file 'README' | |||
1832 | --- README 1970-01-01 00:00:00 +0000 | |||
1833 | +++ README 2013-04-22 11:00:38 +0000 | |||
1834 | @@ -0,0 +1,34 @@ | |||
1835 | 1 | juju | ||
1836 | 2 | ==== | ||
1837 | 3 | |||
1838 | 4 | Welcome to juju, we hope you enjoy your stay. | ||
1839 | 5 | |||
1840 | 6 | You can always get the latest juju code by running:: | ||
1841 | 7 | |||
1842 | 8 | $ bzr branch lp:juju | ||
1843 | 9 | |||
1844 | 10 | The juju bug tracker is at https://bugs.launchpad.net/juju | ||
1845 | 11 | |||
1846 | 12 | Documentation for getting setup and running juju can be found at | ||
1847 | 13 | http://juju.ubuntu.com/docs | ||
1848 | 14 | |||
1849 | 15 | ==== | ||
1850 | 16 | Juju Developers <juju@lists.ubuntu.com> | ||
1851 | 17 | |||
1852 | 18 | Except where stated otherwise, the files contained within this source | ||
1853 | 19 | code tree are covered under the following copyright and license: | ||
1854 | 20 | |||
1855 | 21 | Copyright 2010, 2011 Canonical Ltd. All Rights Reserved. | ||
1856 | 22 | |||
1857 | 23 | This program is free software: you can redistribute it and/or modify | ||
1858 | 24 | it under the terms of the GNU Affero General Public License as published by | ||
1859 | 25 | the Free Software Foundation, either version 3 of the License, or | ||
1860 | 26 | (at your option) any later version. | ||
1861 | 27 | |||
1862 | 28 | This package is distributed in the hope that it will be useful, | ||
1863 | 29 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1864 | 30 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1865 | 31 | GNU General Public License for more details. | ||
1866 | 32 | |||
1867 | 33 | You should have received a copy of the GNU Affero General Public License | ||
1868 | 34 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1869 | 0 | 35 | ||
1870 | === removed file 'README' | |||
1871 | --- README 2012-07-19 11:01:09 +0000 | |||
1872 | +++ README 1970-01-01 00:00:00 +0000 | |||
1873 | @@ -1,34 +0,0 @@ | |||
1874 | 1 | juju | ||
1875 | 2 | ==== | ||
1876 | 3 | |||
1877 | 4 | Welcome to juju, we hope you enjoy your stay. | ||
1878 | 5 | |||
1879 | 6 | You can always get the latest juju code by running:: | ||
1880 | 7 | |||
1881 | 8 | $ bzr branch lp:juju | ||
1882 | 9 | |||
1883 | 10 | The juju bug tracker is at https://bugs.launchpad.net/juju | ||
1884 | 11 | |||
1885 | 12 | Documentation for getting setup and running juju can be found at | ||
1886 | 13 | http://juju.ubuntu.com/docs | ||
1887 | 14 | |||
1888 | 15 | ==== | ||
1889 | 16 | Juju Developers <juju@lists.ubuntu.com> | ||
1890 | 17 | |||
1891 | 18 | Except where stated otherwise, the files contained within this source | ||
1892 | 19 | code tree are covered under the following copyright and license: | ||
1893 | 20 | |||
1894 | 21 | Copyright 2010, 2011 Canonical Ltd. All Rights Reserved. | ||
1895 | 22 | |||
1896 | 23 | This program is free software: you can redistribute it and/or modify | ||
1897 | 24 | it under the terms of the GNU Affero General Public License as published by | ||
1898 | 25 | the Free Software Foundation, either version 3 of the License, or | ||
1899 | 26 | (at your option) any later version. | ||
1900 | 27 | |||
1901 | 28 | This package is distributed in the hope that it will be useful, | ||
1902 | 29 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1903 | 30 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1904 | 31 | GNU General Public License for more details. | ||
1905 | 32 | |||
1906 | 33 | You should have received a copy of the GNU Affero General Public License | ||
1907 | 34 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1908 | 35 | 0 | ||
1909 | === added directory 'bin' | |||
1910 | === removed directory 'bin' | |||
1911 | === added file 'bin/close-port' | |||
1912 | --- bin/close-port 1970-01-01 00:00:00 +0000 | |||
1913 | +++ bin/close-port 2013-04-22 11:00:38 +0000 | |||
1914 | @@ -0,0 +1,11 @@ | |||
1915 | 1 | #!/usr/bin/env python | ||
1916 | 2 | |||
1917 | 3 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
1918 | 4 | import os, sys | ||
1919 | 5 | if "JUJU_PYTHONPATH" in os.environ: | ||
1920 | 6 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
1921 | 7 | |||
1922 | 8 | from juju.hooks.commands import close_port | ||
1923 | 9 | |||
1924 | 10 | if __name__ == '__main__': | ||
1925 | 11 | close_port() | ||
1926 | 0 | 12 | ||
1927 | === removed file 'bin/close-port' | |||
1928 | --- bin/close-port 2012-06-11 15:40:48 +0000 | |||
1929 | +++ bin/close-port 1970-01-01 00:00:00 +0000 | |||
1930 | @@ -1,11 +0,0 @@ | |||
1931 | 1 | #!/usr/bin/env python | ||
1932 | 2 | |||
1933 | 3 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
1934 | 4 | import os, sys | ||
1935 | 5 | if "JUJU_PYTHONPATH" in os.environ: | ||
1936 | 6 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
1937 | 7 | |||
1938 | 8 | from juju.hooks.commands import close_port | ||
1939 | 9 | |||
1940 | 10 | if __name__ == '__main__': | ||
1941 | 11 | close_port() | ||
1942 | 12 | 0 | ||
1943 | === added file 'bin/config-get' | |||
1944 | --- bin/config-get 1970-01-01 00:00:00 +0000 | |||
1945 | +++ bin/config-get 2013-04-22 11:00:38 +0000 | |||
1946 | @@ -0,0 +1,12 @@ | |||
1947 | 1 | #!/usr/bin/env python | ||
1948 | 2 | |||
1949 | 3 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
1950 | 4 | import os, sys | ||
1951 | 5 | |||
1952 | 6 | if "JUJU_PYTHONPATH" in os.environ: | ||
1953 | 7 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
1954 | 8 | |||
1955 | 9 | from juju.hooks.commands import config_get | ||
1956 | 10 | |||
1957 | 11 | if __name__ == '__main__': | ||
1958 | 12 | config_get() | ||
1959 | 0 | 13 | ||
1960 | === removed file 'bin/config-get' | |||
1961 | --- bin/config-get 2012-06-11 15:40:48 +0000 | |||
1962 | +++ bin/config-get 1970-01-01 00:00:00 +0000 | |||
1963 | @@ -1,12 +0,0 @@ | |||
1964 | 1 | #!/usr/bin/env python | ||
1965 | 2 | |||
1966 | 3 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
1967 | 4 | import os, sys | ||
1968 | 5 | |||
1969 | 6 | if "JUJU_PYTHONPATH" in os.environ: | ||
1970 | 7 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
1971 | 8 | |||
1972 | 9 | from juju.hooks.commands import config_get | ||
1973 | 10 | |||
1974 | 11 | if __name__ == '__main__': | ||
1975 | 12 | config_get() | ||
1976 | 13 | 0 | ||
1977 | === added file 'bin/juju' | |||
1978 | --- bin/juju 1970-01-01 00:00:00 +0000 | |||
1979 | +++ bin/juju 2013-04-22 11:00:38 +0000 | |||
1980 | @@ -0,0 +1,10 @@ | |||
1981 | 1 | #!/usr/bin/env python | ||
1982 | 2 | import sys | ||
1983 | 3 | |||
1984 | 4 | from juju.control import main | ||
1985 | 5 | from juju.errors import JujuError | ||
1986 | 6 | |||
1987 | 7 | try: | ||
1988 | 8 | main(sys.argv[1:]) | ||
1989 | 9 | except JujuError, error: | ||
1990 | 10 | sys.exit("error: %s" % (error,)) | ||
1991 | 0 | 11 | ||
1992 | === removed file 'bin/juju' | |||
1993 | --- bin/juju 2012-06-11 15:40:48 +0000 | |||
1994 | +++ bin/juju 1970-01-01 00:00:00 +0000 | |||
1995 | @@ -1,10 +0,0 @@ | |||
1996 | 1 | #!/usr/bin/env python | ||
1997 | 2 | import sys | ||
1998 | 3 | |||
1999 | 4 | from juju.control import main | ||
2000 | 5 | from juju.errors import JujuError | ||
2001 | 6 | |||
2002 | 7 | try: | ||
2003 | 8 | main(sys.argv[1:]) | ||
2004 | 9 | except JujuError, error: | ||
2005 | 10 | sys.exit("error: %s" % (error,)) | ||
2006 | 11 | 0 | ||
2007 | === added file 'bin/juju-admin' | |||
2008 | --- bin/juju-admin 1970-01-01 00:00:00 +0000 | |||
2009 | +++ bin/juju-admin 2013-04-22 11:00:38 +0000 | |||
2010 | @@ -0,0 +1,10 @@ | |||
2011 | 1 | #!/usr/bin/env python | ||
2012 | 2 | import sys | ||
2013 | 3 | |||
2014 | 4 | from juju.control import admin | ||
2015 | 5 | from juju.errors import JujuError | ||
2016 | 6 | |||
2017 | 7 | try: | ||
2018 | 8 | admin(sys.argv[1:]) | ||
2019 | 9 | except JujuError, error: | ||
2020 | 10 | sys.exit("error: %s" % (error,)) | ||
2021 | 0 | 11 | ||
2022 | === removed file 'bin/juju-admin' | |||
2023 | --- bin/juju-admin 2012-06-11 15:40:48 +0000 | |||
2024 | +++ bin/juju-admin 1970-01-01 00:00:00 +0000 | |||
2025 | @@ -1,10 +0,0 @@ | |||
2026 | 1 | #!/usr/bin/env python | ||
2027 | 2 | import sys | ||
2028 | 3 | |||
2029 | 4 | from juju.control import admin | ||
2030 | 5 | from juju.errors import JujuError | ||
2031 | 6 | |||
2032 | 7 | try: | ||
2033 | 8 | admin(sys.argv[1:]) | ||
2034 | 9 | except JujuError, error: | ||
2035 | 10 | sys.exit("error: %s" % (error,)) | ||
2036 | 11 | 0 | ||
2037 | === added file 'bin/juju-log' | |||
2038 | --- bin/juju-log 1970-01-01 00:00:00 +0000 | |||
2039 | +++ bin/juju-log 2013-04-22 11:00:38 +0000 | |||
2040 | @@ -0,0 +1,12 @@ | |||
2041 | 1 | #!/usr/bin/env python | ||
2042 | 2 | |||
2043 | 3 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
2044 | 4 | |||
2045 | 5 | import os, sys | ||
2046 | 6 | if "JUJU_PYTHONPATH" in os.environ: | ||
2047 | 7 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
2048 | 8 | |||
2049 | 9 | from juju.hooks.commands import log | ||
2050 | 10 | |||
2051 | 11 | if __name__ == '__main__': | ||
2052 | 12 | log() | ||
2053 | 0 | 13 | ||
2054 | === removed file 'bin/juju-log' | |||
2055 | --- bin/juju-log 2012-06-11 15:40:48 +0000 | |||
2056 | +++ bin/juju-log 1970-01-01 00:00:00 +0000 | |||
2057 | @@ -1,12 +0,0 @@ | |||
2058 | 1 | #!/usr/bin/env python | ||
2059 | 2 | |||
2060 | 3 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
2061 | 4 | |||
2062 | 5 | import os, sys | ||
2063 | 6 | if "JUJU_PYTHONPATH" in os.environ: | ||
2064 | 7 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
2065 | 8 | |||
2066 | 9 | from juju.hooks.commands import log | ||
2067 | 10 | |||
2068 | 11 | if __name__ == '__main__': | ||
2069 | 12 | log() | ||
2070 | 13 | 0 | ||
2071 | === added file 'bin/open-port' | |||
2072 | --- bin/open-port 1970-01-01 00:00:00 +0000 | |||
2073 | +++ bin/open-port 2013-04-22 11:00:38 +0000 | |||
2074 | @@ -0,0 +1,11 @@ | |||
2075 | 1 | #!/usr/bin/env python | ||
2076 | 2 | |||
2077 | 3 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
2078 | 4 | import os, sys | ||
2079 | 5 | if "JUJU_PYTHONPATH" in os.environ: | ||
2080 | 6 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
2081 | 7 | |||
2082 | 8 | from juju.hooks.commands import open_port | ||
2083 | 9 | |||
2084 | 10 | if __name__ == '__main__': | ||
2085 | 11 | open_port() | ||
2086 | 0 | 12 | ||
2087 | === removed file 'bin/open-port' | |||
2088 | --- bin/open-port 2012-06-11 15:40:48 +0000 | |||
2089 | +++ bin/open-port 1970-01-01 00:00:00 +0000 | |||
2090 | @@ -1,11 +0,0 @@ | |||
2091 | 1 | #!/usr/bin/env python | ||
2092 | 2 | |||
2093 | 3 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
2094 | 4 | import os, sys | ||
2095 | 5 | if "JUJU_PYTHONPATH" in os.environ: | ||
2096 | 6 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
2097 | 7 | |||
2098 | 8 | from juju.hooks.commands import open_port | ||
2099 | 9 | |||
2100 | 10 | if __name__ == '__main__': | ||
2101 | 11 | open_port() | ||
2102 | 12 | 0 | ||
2103 | === added file 'bin/relation-get' | |||
2104 | --- bin/relation-get 1970-01-01 00:00:00 +0000 | |||
2105 | +++ bin/relation-get 2013-04-22 11:00:38 +0000 | |||
2106 | @@ -0,0 +1,12 @@ | |||
2107 | 1 | #!/usr/bin/env python | ||
2108 | 2 | |||
2109 | 3 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
2110 | 4 | import os, sys | ||
2111 | 5 | |||
2112 | 6 | if "JUJU_PYTHONPATH" in os.environ: | ||
2113 | 7 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
2114 | 8 | |||
2115 | 9 | from juju.hooks.commands import relation_get | ||
2116 | 10 | |||
2117 | 11 | if __name__ == '__main__': | ||
2118 | 12 | relation_get() | ||
2119 | 0 | 13 | ||
2120 | === removed file 'bin/relation-get' | |||
2121 | --- bin/relation-get 2012-06-11 15:40:48 +0000 | |||
2122 | +++ bin/relation-get 1970-01-01 00:00:00 +0000 | |||
2123 | @@ -1,12 +0,0 @@ | |||
2124 | 1 | #!/usr/bin/env python | ||
2125 | 2 | |||
2126 | 3 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
2127 | 4 | import os, sys | ||
2128 | 5 | |||
2129 | 6 | if "JUJU_PYTHONPATH" in os.environ: | ||
2130 | 7 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
2131 | 8 | |||
2132 | 9 | from juju.hooks.commands import relation_get | ||
2133 | 10 | |||
2134 | 11 | if __name__ == '__main__': | ||
2135 | 12 | relation_get() | ||
2136 | 13 | 0 | ||
2137 | === added file 'bin/relation-ids' | |||
2138 | --- bin/relation-ids 1970-01-01 00:00:00 +0000 | |||
2139 | +++ bin/relation-ids 2013-04-22 11:00:38 +0000 | |||
2140 | @@ -0,0 +1,11 @@ | |||
2141 | 1 | #!/usr/bin/env python | ||
2142 | 2 | |||
2143 | 3 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
2144 | 4 | import os, sys | ||
2145 | 5 | if "JUJU_PYTHONPATH" in os.environ: | ||
2146 | 6 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
2147 | 7 | |||
2148 | 8 | from juju.hooks.commands import relation_ids | ||
2149 | 9 | |||
2150 | 10 | if __name__ == '__main__': | ||
2151 | 11 | relation_ids() | ||
2152 | 0 | 12 | ||
2153 | === removed file 'bin/relation-ids' | |||
2154 | --- bin/relation-ids 2012-06-17 15:39:48 +0000 | |||
2155 | +++ bin/relation-ids 1970-01-01 00:00:00 +0000 | |||
2156 | @@ -1,11 +0,0 @@ | |||
2157 | 1 | #!/usr/bin/env python | ||
2158 | 2 | |||
2159 | 3 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
2160 | 4 | import os, sys | ||
2161 | 5 | if "JUJU_PYTHONPATH" in os.environ: | ||
2162 | 6 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
2163 | 7 | |||
2164 | 8 | from juju.hooks.commands import relation_ids | ||
2165 | 9 | |||
2166 | 10 | if __name__ == '__main__': | ||
2167 | 11 | relation_ids() | ||
2168 | 12 | 0 | ||
2169 | === added file 'bin/relation-list' | |||
2170 | --- bin/relation-list 1970-01-01 00:00:00 +0000 | |||
2171 | +++ bin/relation-list 2013-04-22 11:00:38 +0000 | |||
2172 | @@ -0,0 +1,13 @@ | |||
2173 | 1 | #!/usr/bin/env python | ||
2174 | 2 | |||
2175 | 3 | |||
2176 | 4 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
2177 | 5 | import os, sys | ||
2178 | 6 | |||
2179 | 7 | if "JUJU_PYTHONPATH" in os.environ: | ||
2180 | 8 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
2181 | 9 | |||
2182 | 10 | from juju.hooks.commands import relation_list | ||
2183 | 11 | |||
2184 | 12 | if __name__ == '__main__': | ||
2185 | 13 | relation_list() | ||
2186 | 0 | 14 | ||
2187 | === removed file 'bin/relation-list' | |||
2188 | --- bin/relation-list 2012-06-11 15:40:48 +0000 | |||
2189 | +++ bin/relation-list 1970-01-01 00:00:00 +0000 | |||
2190 | @@ -1,13 +0,0 @@ | |||
2191 | 1 | #!/usr/bin/env python | ||
2192 | 2 | |||
2193 | 3 | |||
2194 | 4 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
2195 | 5 | import os, sys | ||
2196 | 6 | |||
2197 | 7 | if "JUJU_PYTHONPATH" in os.environ: | ||
2198 | 8 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
2199 | 9 | |||
2200 | 10 | from juju.hooks.commands import relation_list | ||
2201 | 11 | |||
2202 | 12 | if __name__ == '__main__': | ||
2203 | 13 | relation_list() | ||
2204 | 14 | 0 | ||
2205 | === added file 'bin/relation-set' | |||
2206 | --- bin/relation-set 1970-01-01 00:00:00 +0000 | |||
2207 | +++ bin/relation-set 2013-04-22 11:00:38 +0000 | |||
2208 | @@ -0,0 +1,13 @@ | |||
2209 | 1 | #!/usr/bin/env python | ||
2210 | 2 | |||
2211 | 3 | |||
2212 | 4 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
2213 | 5 | import os, sys | ||
2214 | 6 | |||
2215 | 7 | if "JUJU_PYTHONPATH" in os.environ: | ||
2216 | 8 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
2217 | 9 | |||
2218 | 10 | from juju.hooks.commands import relation_set | ||
2219 | 11 | |||
2220 | 12 | if __name__ == '__main__': | ||
2221 | 13 | relation_set() | ||
2222 | 0 | 14 | ||
2223 | === removed file 'bin/relation-set' | |||
2224 | --- bin/relation-set 2012-06-11 15:40:48 +0000 | |||
2225 | +++ bin/relation-set 1970-01-01 00:00:00 +0000 | |||
2226 | @@ -1,13 +0,0 @@ | |||
2227 | 1 | #!/usr/bin/env python | ||
2228 | 2 | |||
2229 | 3 | |||
2230 | 4 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
2231 | 5 | import os, sys | ||
2232 | 6 | |||
2233 | 7 | if "JUJU_PYTHONPATH" in os.environ: | ||
2234 | 8 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
2235 | 9 | |||
2236 | 10 | from juju.hooks.commands import relation_set | ||
2237 | 11 | |||
2238 | 12 | if __name__ == '__main__': | ||
2239 | 13 | relation_set() | ||
2240 | 14 | 0 | ||
2241 | === added file 'bin/unit-get' | |||
2242 | --- bin/unit-get 1970-01-01 00:00:00 +0000 | |||
2243 | +++ bin/unit-get 2013-04-22 11:00:38 +0000 | |||
2244 | @@ -0,0 +1,12 @@ | |||
2245 | 1 | #!/usr/bin/env python | ||
2246 | 2 | |||
2247 | 3 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
2248 | 4 | import os, sys | ||
2249 | 5 | |||
2250 | 6 | if "JUJU_PYTHONPATH" in os.environ: | ||
2251 | 7 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
2252 | 8 | |||
2253 | 9 | from juju.hooks.commands import unit_get | ||
2254 | 10 | |||
2255 | 11 | if __name__ == '__main__': | ||
2256 | 12 | unit_get() | ||
2257 | 0 | 13 | ||
2258 | === removed file 'bin/unit-get' | |||
2259 | --- bin/unit-get 2012-06-11 15:40:48 +0000 | |||
2260 | +++ bin/unit-get 1970-01-01 00:00:00 +0000 | |||
2261 | @@ -1,12 +0,0 @@ | |||
2262 | 1 | #!/usr/bin/env python | ||
2263 | 2 | |||
2264 | 3 | # We avoid using PYTHONPATH because it can cause side effects on hook execution | ||
2265 | 4 | import os, sys | ||
2266 | 5 | |||
2267 | 6 | if "JUJU_PYTHONPATH" in os.environ: | ||
2268 | 7 | sys.path[:0] = filter(None, os.environ["JUJU_PYTHONPATH"].split(":")) | ||
2269 | 8 | |||
2270 | 9 | from juju.hooks.commands import unit_get | ||
2271 | 10 | |||
2272 | 11 | if __name__ == '__main__': | ||
2273 | 12 | unit_get() | ||
2274 | 13 | 0 | ||
2275 | === modified file 'debian/changelog' | |||
2276 | --- debian/changelog 2012-12-03 15:59:21 +0000 | |||
2277 | +++ debian/changelog 2013-04-22 11:00:38 +0000 | |||
2278 | @@ -1,10 +1,21 @@ | |||
2280 | 1 | juju (0.6-1ubuntu2) UNRELEASED; urgency=low | 1 | juju (0.7-0ubuntu1) raring; urgency=low |
2281 | 2 | 2 | ||
2282 | 3 | [ Clint Byrum ] | ||
2283 | 3 | * d/p/fix-tests-do-not-use-etc-lsb-release: Dropped, patch applied upstream. | 4 | * d/p/fix-tests-do-not-use-etc-lsb-release: Dropped, patch applied upstream. |
2284 | 4 | * d/p/maas-tag-conversion.patch: Dropped, patch applied upstream. | 5 | * d/p/maas-tag-conversion.patch: Dropped, patch applied upstream. |
2285 | 5 | * d/juju.docs: Remove examples as they have been dropped upstream. | 6 | * d/juju.docs: Remove examples as they have been dropped upstream. |
2286 | 6 | 7 | ||
2288 | 7 | -- Clint Byrum <clint@ubuntu.com> Tue, 06 Nov 2012 12:14:23 -0800 | 8 | [ Mark Mims ] |
2289 | 9 | * Add postinst and prerm scripts using update-alternatives to install into | ||
2290 | 10 | a versioned location, enabling co-installability with the go juju port. | ||
2291 | 11 | |||
2292 | 12 | [ Martin Packman ] | ||
2293 | 13 | * New upstream release. (lp: #1167921) | ||
2294 | 14 | * d/p/workaround-lxc-python-env.patch: Workaround regression with local | ||
2295 | 15 | provider failing with SyntaxError on running lxc scripts when user has | ||
2296 | 16 | Python 3 specific environment variables set. (lp: #1130809) | ||
2297 | 17 | |||
2298 | 18 | -- Martin Packman <martin.packman@canonical.com> Wed, 10 Apr 2013 13:57:21 +0000 | ||
2299 | 8 | 19 | ||
2300 | 9 | juju (0.6-1ubuntu1) quantal; urgency=low | 20 | juju (0.6-1ubuntu1) quantal; urgency=low |
2301 | 10 | 21 | ||
2302 | 11 | 22 | ||
2303 | === modified file 'debian/control' | |||
2304 | --- debian/control 2012-10-10 14:41:08 +0000 | |||
2305 | +++ debian/control 2013-04-22 11:00:38 +0000 | |||
2306 | @@ -17,11 +17,13 @@ | |||
2307 | 17 | lsb-release, | 17 | lsb-release, |
2308 | 18 | procps | 18 | procps |
2309 | 19 | Homepage: https://launchpad.net/juju | 19 | Homepage: https://launchpad.net/juju |
2311 | 20 | Standards-Version: 3.9.3 | 20 | Standards-Version: 3.9.4 |
2312 | 21 | 21 | ||
2314 | 22 | Package: juju | 22 | Package: juju-0.7 |
2315 | 23 | Architecture: all | 23 | Architecture: all |
2316 | 24 | Depends: ${python:Depends}, ${misc:Depends}, python-twisted, python-txzookeeper (>= 0.9.5~), python-txaws, python-yaml, openssh-client, tmux, python-oauth, procps | 24 | Depends: ${python:Depends}, ${misc:Depends}, python-twisted, python-txzookeeper (>= 0.9.5~), python-txaws, python-yaml, openssh-client, tmux, python-oauth, procps |
2317 | 25 | Breaks: juju (<< 0.7-0ubuntu1~) | ||
2318 | 26 | Replaces: juju (<< 0.7-0ubuntu1~) | ||
2319 | 25 | Recommends: python-pydot, byobu | 27 | Recommends: python-pydot, byobu |
2320 | 26 | Suggests: apt-cacher-ng, lxc, zookeeper | 28 | Suggests: apt-cacher-ng, lxc, zookeeper |
2321 | 27 | Provides: ${python:Provides}, ${misc:Depends} | 29 | Provides: ${python:Provides}, ${misc:Depends} |
2322 | @@ -32,3 +34,10 @@ | |||
2323 | 32 | create service formulas, called charms, independently, and make those | 34 | create service formulas, called charms, independently, and make those |
2324 | 33 | services coordinate their communication and configuration through a | 35 | services coordinate their communication and configuration through a |
2325 | 34 | simple protocol. | 36 | simple protocol. |
2326 | 37 | |||
2327 | 38 | Package: juju | ||
2328 | 39 | Architecture: all | ||
2329 | 40 | Depends: ${misc:Depends}, juju-0.7 | ||
2330 | 41 | Description: next generation service orchestration system | ||
2331 | 42 | Virtual dependency package providing Juju, a next generation service | ||
2332 | 43 | orchestration framework. | ||
2333 | 35 | 44 | ||
2334 | === removed file 'debian/juju.install' | |||
2335 | --- debian/juju.install 2012-06-11 15:40:48 +0000 | |||
2336 | +++ debian/juju.install 1970-01-01 00:00:00 +0000 | |||
2337 | @@ -1,1 +0,0 @@ | |||
2338 | 1 | misc/bash_completion.d/juju /etc/bash_completion.d/ | ||
2339 | 2 | 0 | ||
2340 | === removed file 'debian/juju.manpages' | |||
2341 | --- debian/juju.manpages 2012-06-11 15:40:48 +0000 | |||
2342 | +++ debian/juju.manpages 1970-01-01 00:00:00 +0000 | |||
2343 | @@ -1,1 +0,0 @@ | |||
2344 | 1 | debian/manpages/*.1 | ||
2345 | 2 | 0 | ||
2346 | === added file 'debian/juju.postinst.in' | |||
2347 | --- debian/juju.postinst.in 1970-01-01 00:00:00 +0000 | |||
2348 | +++ debian/juju.postinst.in 2013-04-22 11:00:38 +0000 | |||
2349 | @@ -0,0 +1,43 @@ | |||
2350 | 1 | #!/bin/sh | ||
2351 | 2 | set -e | ||
2352 | 3 | |||
2353 | 4 | VER="__NEW_VERSION__" | ||
2354 | 5 | base_dir="/usr/lib" | ||
2355 | 6 | |||
2356 | 7 | case "$1" in | ||
2357 | 8 | configure) | ||
2358 | 9 | update-alternatives --force --install /usr/bin/juju juju $base_dir/juju-$VER/bin/juju 20 \ | ||
2359 | 10 | --slave /usr/share/man/man1/juju.1.gz juju.1.gz $base_dir/juju-$VER/man/man1/juju.1.gz \ | ||
2360 | 11 | --slave /usr/bin/open-port open-port $base_dir/juju-$VER/bin/open-port \ | ||
2361 | 12 | --slave /usr/share/man/man1/open-port.1.gz open-port.1.gz $base_dir/juju-$VER/man/man1/open-port.1.gz \ | ||
2362 | 13 | --slave /usr/bin/close-port close-port $base_dir/juju-$VER/bin/close-port \ | ||
2363 | 14 | --slave /usr/share/man/man1/close-port.1.gz close-port.1.gz $base_dir/juju-$VER/man/man1/close-port.1.gz \ | ||
2364 | 15 | --slave /usr/bin/config-get config-get $base_dir/juju-$VER/bin/config-get \ | ||
2365 | 16 | --slave /usr/share/man/man1/config-get.1.gz config-get.1.gz $base_dir/juju-$VER/man/man1/config-get.1.gz \ | ||
2366 | 17 | --slave /usr/bin/relation-list relation-list $base_dir/juju-$VER/bin/relation-list \ | ||
2367 | 18 | --slave /usr/share/man/man1/relation-list.1.gz relation-list.1.gz $base_dir/juju-$VER/man/man1/relation-list.1.gz \ | ||
2368 | 19 | --slave /usr/bin/unit-get unit-get $base_dir/juju-$VER/bin/unit-get \ | ||
2369 | 20 | --slave /usr/share/man/man1/unit-get.1.gz unit-get.1.gz $base_dir/juju-$VER/man/man1/unit-get.1.gz \ | ||
2370 | 21 | --slave /usr/bin/juju-admin juju-admin $base_dir/juju-$VER/bin/juju-admin \ | ||
2371 | 22 | --slave /usr/share/man/man1/juju-admin.1.gz juju-admin.1.gz $base_dir/juju-$VER/man/man1/juju-admin.1.gz \ | ||
2372 | 23 | --slave /usr/bin/relation-ids relation-ids $base_dir/juju-$VER/bin/relation-ids \ | ||
2373 | 24 | --slave /usr/share/man/man1/relation-ids.1.gz relation-ids.1.gz $base_dir/juju-$VER/man/man1/relation-ids.1.gz \ | ||
2374 | 25 | --slave /usr/bin/juju-log juju-log $base_dir/juju-$VER/bin/juju-log \ | ||
2375 | 26 | --slave /usr/share/man/man1/juju-log.1.gz juju-log.1.gz $base_dir/juju-$VER/man/man1/juju-log.1.gz \ | ||
2376 | 27 | --slave /usr/bin/relation-get relation-get $base_dir/juju-$VER/bin/relation-get \ | ||
2377 | 28 | --slave /usr/share/man/man1/relation-get.1.gz relation-get.1.gz $base_dir/juju-$VER/man/man1/relation-get.1.gz \ | ||
2378 | 29 | --slave /usr/bin/relation-set relation-set $base_dir/juju-$VER/bin/relation-set \ | ||
2379 | 30 | --slave /usr/share/man/man1/relation-set.1.gz relation-set.1.gz $base_dir/juju-$VER/man/man1/relation-set.1.gz \ | ||
2380 | 31 | --slave /etc/bash_completion.d/juju juju-bash-completion $base_dir/juju-$VER/etc/bash_completion.d/juju | ||
2381 | 32 | ;; | ||
2382 | 33 | abort-upgrade|abort-remove|abort-deconfigure) | ||
2383 | 34 | echo "$1" | ||
2384 | 35 | ;; | ||
2385 | 36 | *) echo "$0: didn't understand being called with \`$1'" 1>&2 | ||
2386 | 37 | exit 0 | ||
2387 | 38 | ;; | ||
2388 | 39 | esac | ||
2389 | 40 | |||
2390 | 41 | #DEBHELPER# | ||
2391 | 42 | |||
2392 | 43 | exit 0 | ||
2393 | 0 | 44 | ||
2394 | === added file 'debian/juju.prerm.in' | |||
2395 | --- debian/juju.prerm.in 1970-01-01 00:00:00 +0000 | |||
2396 | +++ debian/juju.prerm.in 2013-04-22 11:00:38 +0000 | |||
2397 | @@ -0,0 +1,23 @@ | |||
2398 | 1 | #!/bin/sh | ||
2399 | 2 | set -e | ||
2400 | 3 | |||
2401 | 4 | VER="__NEW_VERSION__" | ||
2402 | 5 | |||
2403 | 6 | case "$1" in | ||
2404 | 7 | remove|upgrade|deconfigure) | ||
2405 | 8 | update-alternatives --remove juju /usr/lib/juju-$VER/bin/juju | ||
2406 | 9 | ;; | ||
2407 | 10 | |||
2408 | 11 | failed-upgrade) | ||
2409 | 12 | echo "$1" | ||
2410 | 13 | ;; | ||
2411 | 14 | |||
2412 | 15 | *) | ||
2413 | 16 | echo "prerm called with unknown argument \`$1'" >&2 | ||
2414 | 17 | exit 0 | ||
2415 | 18 | ;; | ||
2416 | 19 | esac | ||
2417 | 20 | |||
2418 | 21 | #DEBHELPER# | ||
2419 | 22 | |||
2420 | 23 | exit 0 | ||
2421 | 0 | 24 | ||
2422 | === modified file 'debian/patches/series' | |||
2423 | --- debian/patches/series 2012-11-06 20:44:41 +0000 | |||
2424 | +++ debian/patches/series 2013-04-22 11:00:38 +0000 | |||
2425 | @@ -1,1 +1,2 @@ | |||
2426 | 1 | disable-failing-zookeeper-test.patch | 1 | disable-failing-zookeeper-test.patch |
2427 | 2 | workaround-lxc-python-env.patch | ||
2428 | 2 | 3 | ||
2429 | === added file 'debian/patches/workaround-lxc-python-env.patch' | |||
2430 | --- debian/patches/workaround-lxc-python-env.patch 1970-01-01 00:00:00 +0000 | |||
2431 | +++ debian/patches/workaround-lxc-python-env.patch 2013-04-22 11:00:38 +0000 | |||
2432 | @@ -0,0 +1,26 @@ | |||
2433 | 1 | From: Martin Packman <martin.packman@canonical.com> | ||
2434 | 2 | Description: The various lxc scripts installed in /usr/bin are Python 3 only. | ||
2435 | 3 | If the user has PYTHONPATH or other similar environment variables set, these | ||
2436 | 4 | scripts can incorrectly inherit details from the user's Python 2 setup when | ||
2437 | 5 | run. Workaround the problem by sanitising the environment before calling them. | ||
2438 | 6 | Forwarded: N/A | ||
2439 | 7 | |||
2440 | 8 | Index: juju/juju/lib/lxc/__init__.py | ||
2441 | 9 | =================================================================== | ||
2442 | 10 | --- juju.orig/juju/lib/lxc/__init__.py 2013-04-10 12:11:45.583012000 +0000 | ||
2443 | 11 | +++ juju/juju/lib/lxc/__init__.py 2013-04-10 12:12:29.543012000 +0000 | ||
2444 | 12 | @@ -38,8 +38,13 @@ | ||
2445 | 13 | |||
2446 | 14 | |||
2447 | 15 | def _cmd(args): | ||
2448 | 16 | + # GZ 2013-04-10: Cleanup the user's python environment to avoid issues now | ||
2449 | 17 | + # the lxc scripts require Python 3, see lp:1130809. | ||
2450 | 18 | + env = dict((k, os.environ[k]) for k in os.environ | ||
2451 | 19 | + if not k.startswith("PYTHON")) | ||
2452 | 20 | + env["PYTHONNOUSERSITE"] = "1" | ||
2453 | 21 | p = subprocess.Popen( | ||
2454 | 22 | - args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | ||
2455 | 23 | + args, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | ||
2456 | 24 | stdout_data, _ = p.communicate() | ||
2457 | 25 | r = p.returncode | ||
2458 | 26 | if r != 0: | ||
2459 | 0 | 27 | ||
2460 | === modified file 'debian/rules' | |||
2461 | --- debian/rules 2012-07-19 11:01:09 +0000 | |||
2462 | +++ debian/rules 2013-04-22 11:00:38 +0000 | |||
2463 | @@ -2,9 +2,14 @@ | |||
2464 | 2 | 2 | ||
2465 | 3 | REV=$(shell dpkg-parsechangelog | sed -rne 's,^Version: .*[+~]bzr([0-9]+).*,\1,p') | 3 | REV=$(shell dpkg-parsechangelog | sed -rne 's,^Version: .*[+~]bzr([0-9]+).*,\1,p') |
2466 | 4 | VER=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p') | 4 | VER=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p') |
2467 | 5 | MAJOR_VER=0.7 | ||
2468 | 6 | ifeq "$(REV)" "" | ||
2469 | 7 | REV=tag:$(VER) | ||
2470 | 8 | endif | ||
2471 | 9 | MANDIR=debian/manpages | ||
2472 | 5 | 10 | ||
2473 | 6 | %: | 11 | %: |
2475 | 7 | dh $@ --buildsystem=python_distutils --with python2 | 12 | dh $@ --with python2 |
2476 | 8 | 13 | ||
2477 | 9 | override_dh_auto_test: | 14 | override_dh_auto_test: |
2478 | 10 | ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) | 15 | ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) |
2479 | @@ -13,17 +18,16 @@ | |||
2480 | 13 | 18 | ||
2481 | 14 | get-orig-source: | 19 | get-orig-source: |
2482 | 15 | bzr export -r $(REV) --root=juju-$(VER).orig \ | 20 | bzr export -r $(REV) --root=juju-$(VER).orig \ |
2484 | 16 | juju_$(VER).orig.tar.gz lp:juju | 21 | juju_$(VER).orig.tar.gz lp:juju/$(MAJOR_VER) |
2485 | 17 | 22 | ||
2486 | 18 | override_dh_auto_clean:: | 23 | override_dh_auto_clean:: |
2487 | 19 | rm -f debian/manpages/*.partial | 24 | rm -f debian/manpages/*.partial |
2488 | 20 | rm -f debian/manpages/*.1 | 25 | rm -f debian/manpages/*.1 |
2489 | 21 | 26 | ||
2490 | 22 | override_dh_auto_build:: debian/manpages/juju.1 | ||
2491 | 23 | |||
2492 | 24 | HELP2MAN=PYTHONPATH=`pwd` help2man -N --version-string $(VER) | 27 | HELP2MAN=PYTHONPATH=`pwd` help2man -N --version-string $(VER) |
2493 | 25 | 28 | ||
2495 | 26 | debian/manpages/juju.1: | 29 | generate_juju_manpages: |
2496 | 30 | mkdir -p $(MANDIR) | ||
2497 | 27 | $(HELP2MAN) --name "juju service orchestration system admin client" \ | 31 | $(HELP2MAN) --name "juju service orchestration system admin client" \ |
2498 | 28 | --include debian/manpages/juju.includes.in bin/juju \ | 32 | --include debian/manpages/juju.includes.in bin/juju \ |
2499 | 29 | > debian/manpages/juju.1.partial | 33 | > debian/manpages/juju.1.partial |
2500 | @@ -34,7 +38,31 @@ | |||
2501 | 34 | $(HELP2MAN) --name "Juju charm API commands" \ | 38 | $(HELP2MAN) --name "Juju charm API commands" \ |
2502 | 35 | --include debian/manpages/charm_api.in \ | 39 | --include debian/manpages/charm_api.in \ |
2503 | 36 | bin/$$i > debian/manpages/$$i.1.partial ;\ | 40 | bin/$$i > debian/manpages/$$i.1.partial ;\ |
2505 | 37 | mv debian/manpages/$$i.1.partial debian/manpages/$$i.1 ;\ | 41 | mv debian/manpages/$$i.1.partial $(MANDIR)/$$i.1 ;\ |
2506 | 38 | done | 42 | done |
2509 | 39 | mv -f debian/manpages/juju-admin.1.partial debian/manpages/juju-admin.1 | 43 | mv -f debian/manpages/juju-admin.1.partial $(MANDIR)/juju-admin.1 |
2510 | 40 | mv -f debian/manpages/juju.1.partial debian/manpages/juju.1 | 44 | mv -f debian/manpages/juju.1.partial $(MANDIR)/juju.1 |
2511 | 45 | |||
2512 | 46 | override_dh_auto_build: generate_juju_manpages | ||
2513 | 47 | |||
2514 | 48 | install_juju_manpages: | ||
2515 | 49 | mkdir -p debian/juju-$(MAJOR_VER)/usr/lib/juju-$(VER)/man/man1 | ||
2516 | 50 | cp -a debian/manpages/*.1 debian/juju-$(MAJOR_VER)/usr/lib/juju-$(VER)/man/man1/ | ||
2517 | 51 | gzip debian/juju-$(MAJOR_VER)/usr/lib/juju-$(VER)/man/man1/*.1 | ||
2518 | 52 | |||
2519 | 53 | install_bash_completion: | ||
2520 | 54 | mkdir -p debian/juju-$(MAJOR_VER)/usr/lib/juju-$(VER)/etc/bash_completion.d | ||
2521 | 55 | cp -a misc/bash_completion.d/juju debian/juju-$(MAJOR_VER)/usr/lib/juju-$(VER)/etc/bash_completion.d/juju | ||
2522 | 56 | |||
2523 | 57 | override_dh_auto_install: install_juju_manpages install_bash_completion | ||
2524 | 58 | set -e && python setup.py install --root=debian/juju-$(MAJOR_VER) --install-layout=deb --install-scripts=/usr/lib/juju-$(VER)/bin --compile | ||
2525 | 59 | |||
2526 | 60 | debian/juju-$(VER).postinst: debian/juju.postinst.in | ||
2527 | 61 | sed -e "s/__NEW_VERSION__/$(VER)/g" $< > $@ | ||
2528 | 62 | |||
2529 | 63 | debian/juju-$(VER).prerm: debian/juju.prerm.in | ||
2530 | 64 | sed -e "s/__NEW_VERSION__/$(VER)/g" $< > $@ | ||
2531 | 65 | |||
2532 | 66 | override_dh_installdeb: debian/juju-$(VER).postinst debian/juju-$(VER).prerm | ||
2533 | 67 | dh_installdeb | ||
2534 | 68 | |||
2535 | 41 | 69 | ||
2536 | === removed directory 'examples' | |||
2537 | === removed file 'examples/README' | |||
2538 | --- examples/README 2012-06-11 15:40:48 +0000 | |||
2539 | +++ examples/README 1970-01-01 00:00:00 +0000 | |||
2540 | @@ -1,24 +0,0 @@ | |||
2541 | 1 | Examples | ||
2542 | 2 | ======== | ||
2543 | 3 | |||
2544 | 4 | |||
2545 | 5 | These are some example charms that can be deployed together to create some connected services. | ||
2546 | 6 | |||
2547 | 7 | Many more charms of greater functionality and utility exist in the Principia project, which | ||
2548 | 8 | currently serves as a clearinghouse for juju charms. | ||
2549 | 9 | |||
2550 | 10 | http://launchpad.net/principia | ||
2551 | 11 | |||
2552 | 12 | |||
2553 | 13 | Deploying | ||
2554 | 14 | ========= | ||
2555 | 15 | |||
2556 | 16 | As an example of deploying these sample charms as services and connectinng them. | ||
2557 | 17 | |||
2558 | 18 | $ juju bootstrap | ||
2559 | 19 | $ juju deploy --repository=examples local:mysql | ||
2560 | 20 | $ juju deploy --repository=examples local:wordpress | ||
2561 | 21 | $ juju add-relation wordpress mysql | ||
2562 | 22 | $ juju status | ||
2563 | 23 | |||
2564 | 24 | The status command will show the address of the newly deployed wordpress service. | ||
2565 | 25 | 0 | ||
2566 | === removed directory 'examples/precise' | |||
2567 | === removed directory 'examples/precise/mysql' | |||
2568 | === removed file 'examples/precise/mysql/config.yaml' | |||
2569 | --- examples/precise/mysql/config.yaml 2012-06-17 15:39:48 +0000 | |||
2570 | +++ examples/precise/mysql/config.yaml 1970-01-01 00:00:00 +0000 | |||
2571 | @@ -1,1 +0,0 @@ | |||
2572 | 1 | options: {} | ||
2573 | 2 | 0 | ||
2574 | === removed directory 'examples/precise/mysql/hooks' | |||
2575 | === removed file 'examples/precise/mysql/hooks/db-relation-joined' | |||
2576 | --- examples/precise/mysql/hooks/db-relation-joined 2012-06-17 15:39:48 +0000 | |||
2577 | +++ examples/precise/mysql/hooks/db-relation-joined 1970-01-01 00:00:00 +0000 | |||
2578 | @@ -1,40 +0,0 @@ | |||
2579 | 1 | #!/bin/bash | ||
2580 | 2 | |||
2581 | 3 | set -eu # -x for verbose logging to juju debug-log | ||
2582 | 4 | |||
2583 | 5 | hostname=`unit-get private-address` | ||
2584 | 6 | |||
2585 | 7 | # Get the mysql password that was generated by the install hook | ||
2586 | 8 | password=`cat /var/lib/juju/mysql.passwd` | ||
2587 | 9 | |||
2588 | 10 | # Get the database name; this takes a service unit (ex: wordpress/0) | ||
2589 | 11 | # and extracts just 'wordpress' | ||
2590 | 12 | service=`echo $JUJU_REMOTE_UNIT | cut -d/ -f1` # split on / | ||
2591 | 13 | |||
2592 | 14 | # Determine if a database needs to be created for this service | ||
2593 | 15 | existing_databases=`mysql --password="$password" --silent --execute 'show databases'` | ||
2594 | 16 | for db in $existing_databases; do | ||
2595 | 17 | if [ "$db" = "$service" ] ; then | ||
2596 | 18 | juju-log "Database already exists, publishing details and exiting" | ||
2597 | 19 | service_password=`cat /var/lib/juju/$service.passwd` | ||
2598 | 20 | # Save these settings on the relation; this will trigger the remote | ||
2599 | 21 | # service unit | ||
2600 | 22 | relation-set database="$service" user="$service" password="$service_password" | ||
2601 | 23 | exit 0 # database already exists | ||
2602 | 24 | fi | ||
2603 | 25 | done | ||
2604 | 26 | |||
2605 | 27 | # Generate a strong password for the database, using /dev/urandom | ||
2606 | 28 | service_password=`pwgen 10 1` | ||
2607 | 29 | # Store service password, new service units of same service would need it | ||
2608 | 30 | echo $service_password >> /var/lib/juju/$service.passwd | ||
2609 | 31 | |||
2610 | 32 | # Create new database and corresponding security settings | ||
2611 | 33 | juju-log "Creating new database and corresponding security settings" | ||
2612 | 34 | mysqladmin --password="$password" create "$service" | ||
2613 | 35 | echo "grant all on $service.* to $service identified by '$service_password'" | mysql --password="$password" --database="$service" | ||
2614 | 36 | mysqladmin --password="$password" flush-privileges | ||
2615 | 37 | |||
2616 | 38 | # Save these settings on the relation; this will trigger the remote | ||
2617 | 39 | # service unit | ||
2618 | 40 | relation-set database="$service" user="$service" password="$service_password" | ||
2619 | 41 | 0 | ||
2620 | === removed file 'examples/precise/mysql/hooks/install' | |||
2621 | --- examples/precise/mysql/hooks/install 2012-08-24 16:02:42 +0000 | |||
2622 | +++ examples/precise/mysql/hooks/install 1970-01-01 00:00:00 +0000 | |||
2623 | @@ -1,32 +0,0 @@ | |||
2624 | 1 | #!/bin/bash | ||
2625 | 2 | |||
2626 | 3 | set -eu # -x for verbose logging to juju debug-log | ||
2627 | 4 | |||
2628 | 5 | apt-get install -qqy debconf-utils python-mysqldb pwgen | ||
2629 | 6 | |||
2630 | 7 | # Generate a strong password for the mysql service, using /dev/urandom | ||
2631 | 8 | PASSWORD=`pwgen 10 1` | ||
2632 | 9 | |||
2633 | 10 | # Store the password for later use by the db-relation-changed hook for | ||
2634 | 11 | # this service unit. As a general note, for data that service units do | ||
2635 | 12 | # not need to share, simply use the machine's local file store. | ||
2636 | 13 | PASSFILE=/var/lib/juju/mysql.passwd | ||
2637 | 14 | if ! [ -f $PASSFILE ] ; then | ||
2638 | 15 | touch $PASSFILE | ||
2639 | 16 | fi | ||
2640 | 17 | chmod 0600 $PASSFILE | ||
2641 | 18 | if ! [ -s $PASSFILE ] ; then | ||
2642 | 19 | echo $PASSWORD >> /var/lib/juju/mysql.passwd | ||
2643 | 20 | fi | ||
2644 | 21 | |||
2645 | 22 | echo mysql-server-5.1 mysql-server/root_password password $PASSWORD | debconf-set-selections | ||
2646 | 23 | echo mysql-server-5.1 mysql-server/root_password_again password $PASSWORD | debconf-set-selections | ||
2647 | 24 | |||
2648 | 25 | juju-log "mysql-server settings preseeded, now installing via apt-get" | ||
2649 | 26 | DEBIAN_FRONTEND=noninteractive apt-get -y install -qq mysql-server | ||
2650 | 27 | |||
2651 | 28 | juju-log "Editing my.cnf to allow listening on all interfaces" | ||
2652 | 29 | sed --in-place=old 's/127\.0\.0\.1/0.0.0.0/' /etc/mysql/my.cnf | ||
2653 | 30 | |||
2654 | 31 | juju-log "Stopping mysql service" | ||
2655 | 32 | service mysql stop | ||
2656 | 33 | 0 | ||
2657 | === removed file 'examples/precise/mysql/hooks/start' | |||
2658 | --- examples/precise/mysql/hooks/start 2012-06-17 15:39:48 +0000 | |||
2659 | +++ examples/precise/mysql/hooks/start 1970-01-01 00:00:00 +0000 | |||
2660 | @@ -1,3 +0,0 @@ | |||
2661 | 1 | #!/bin/bash | ||
2662 | 2 | juju-log "Starting mysql service" | ||
2663 | 3 | service mysql start || service mysql restart | ||
2664 | 4 | 0 | ||
2665 | === removed file 'examples/precise/mysql/hooks/stop' | |||
2666 | --- examples/precise/mysql/hooks/stop 2012-06-17 15:39:48 +0000 | |||
2667 | +++ examples/precise/mysql/hooks/stop 1970-01-01 00:00:00 +0000 | |||
2668 | @@ -1,3 +0,0 @@ | |||
2669 | 1 | #!/bin/bash | ||
2670 | 2 | juju-log "Stopping mysql service" | ||
2671 | 3 | service mysql stop || true | ||
2672 | 4 | 0 | ||
2673 | === removed file 'examples/precise/mysql/metadata.yaml' | |||
2674 | --- examples/precise/mysql/metadata.yaml 2012-06-17 15:39:48 +0000 | |||
2675 | +++ examples/precise/mysql/metadata.yaml 1970-01-01 00:00:00 +0000 | |||
2676 | @@ -1,17 +0,0 @@ | |||
2677 | 1 | name: mysql | ||
2678 | 2 | summary: "MySQL relational database provider" | ||
2679 | 3 | description: | | ||
2680 | 4 | Installs and configures the MySQL package (mysqldb), then runs it. | ||
2681 | 5 | |||
2682 | 6 | Upon a consuming service establishing a relation, creates a new | ||
2683 | 7 | database for that service, if the database does not yet | ||
2684 | 8 | exist. Publishes the following relation settings for consuming | ||
2685 | 9 | services: | ||
2686 | 10 | |||
2687 | 11 | database: database name | ||
2688 | 12 | user: user name to access database | ||
2689 | 13 | password: password to access the database | ||
2690 | 14 | host: local hostname | ||
2691 | 15 | provides: | ||
2692 | 16 | db: | ||
2693 | 17 | interface: mysql | ||
2694 | 18 | 0 | ||
2695 | === removed file 'examples/precise/mysql/revision' | |||
2696 | --- examples/precise/mysql/revision 2012-06-17 15:39:48 +0000 | |||
2697 | +++ examples/precise/mysql/revision 1970-01-01 00:00:00 +0000 | |||
2698 | @@ -1,1 +0,0 @@ | |||
2699 | 1 | 11 | ||
2700 | 2 | 0 | ||
2701 | === removed directory 'examples/precise/php' | |||
2702 | === removed file 'examples/precise/php/config.yaml' | |||
2703 | --- examples/precise/php/config.yaml 2012-06-17 15:39:48 +0000 | |||
2704 | +++ examples/precise/php/config.yaml 1970-01-01 00:00:00 +0000 | |||
2705 | @@ -1,5 +0,0 @@ | |||
2706 | 1 | options: | ||
2707 | 2 | application_file: | ||
2708 | 3 | description: An application file to push. | ||
2709 | 4 | type: string | ||
2710 | 5 | |||
2711 | 6 | 0 | ||
2712 | === removed directory 'examples/precise/php/hooks' | |||
2713 | === removed file 'examples/precise/php/hooks/config-changed' | |||
2714 | --- examples/precise/php/hooks/config-changed 2012-06-17 15:39:48 +0000 | |||
2715 | +++ examples/precise/php/hooks/config-changed 1970-01-01 00:00:00 +0000 | |||
2716 | @@ -1,14 +0,0 @@ | |||
2717 | 1 | #!/bin/bash | ||
2718 | 2 | |||
2719 | 3 | hostname=`unit-get public-address` | ||
2720 | 4 | |||
2721 | 5 | app_dir="/var/www/$hostname/" | ||
2722 | 6 | app_file=`config-get application_file` | ||
2723 | 7 | |||
2724 | 8 | if [ -z $app_file ]; then | ||
2725 | 9 | exit 0 | ||
2726 | 10 | fi | ||
2727 | 11 | |||
2728 | 12 | echo "$app_file" > $app_dir/index.php | ||
2729 | 13 | chmod a+r $app_dir/index.php | ||
2730 | 14 | |||
2731 | 15 | 0 | ||
2732 | === removed file 'examples/precise/php/hooks/install' | |||
2733 | --- examples/precise/php/hooks/install 2012-06-17 15:39:48 +0000 | |||
2734 | +++ examples/precise/php/hooks/install 1970-01-01 00:00:00 +0000 | |||
2735 | @@ -1,49 +0,0 @@ | |||
2736 | 1 | #!/bin/bash | ||
2737 | 2 | |||
2738 | 3 | juju-log "Installing php5 via apt-get" | ||
2739 | 4 | set -eu # -x for verbose logging to juju debug-log | ||
2740 | 5 | |||
2741 | 6 | apt-get -y install php5 | ||
2742 | 7 | |||
2743 | 8 | # Create an internal secret key for wordpress; this is unrelated to | ||
2744 | 9 | # the password generated for the admin user of wordpress | ||
2745 | 10 | hostname=`unit-get public-address` | ||
2746 | 11 | |||
2747 | 12 | SITE_PATH="/var/www/$hostname" | ||
2748 | 13 | |||
2749 | 14 | |||
2750 | 15 | juju-log "Creating appropriate upload paths and directories" | ||
2751 | 16 | # Setup appropriate upload paths and directories | ||
2752 | 17 | mkdir -p $SITE_PATH | ||
2753 | 18 | chown -R root:www-data $SITE_PATH | ||
2754 | 19 | chmod -R a+rw $SITE_PATH | ||
2755 | 20 | chmod a+x $SITE_PATH | ||
2756 | 21 | |||
2757 | 22 | # Write the apache config | ||
2758 | 23 | # XXX a future branch will change this to use augtool | ||
2759 | 24 | apache_config_file_path="/etc/apache2/sites-available/$hostname" | ||
2760 | 25 | juju-log "Writing apache config file $apache_config_file_path" | ||
2761 | 26 | cat > $apache_config_file_path <<EOF | ||
2762 | 27 | <VirtualHost *:80> | ||
2763 | 28 | ServerName $hostname | ||
2764 | 29 | DocumentRoot /var/www/$hostname | ||
2765 | 30 | Options All | ||
2766 | 31 | ErrorLog /var/log/apache2/$hostname-error.log | ||
2767 | 32 | TransferLog /var/log/apache2/$hostname-access.log | ||
2768 | 33 | <FilesMatch \.php$> | ||
2769 | 34 | SetHandler application/x-httpd-php | ||
2770 | 35 | </FilesMatch> | ||
2771 | 36 | </VirtualHost> | ||
2772 | 37 | EOF | ||
2773 | 38 | chmod 0644 $apache_config_file_path | ||
2774 | 39 | |||
2775 | 40 | # Configure apache | ||
2776 | 41 | juju-log "Enabling apache modules: rewrite, vhost_alias" | ||
2777 | 42 | a2enmod rewrite | ||
2778 | 43 | a2enmod vhost_alias | ||
2779 | 44 | juju-log "Enabling apache site: $hostname" | ||
2780 | 45 | a2ensite $hostname | ||
2781 | 46 | |||
2782 | 47 | # Restart apache | ||
2783 | 48 | juju-log "Restarting apache2 service" | ||
2784 | 49 | /etc/init.d/apache2 restart | ||
2785 | 50 | 0 | ||
2786 | === removed file 'examples/precise/php/hooks/start' | |||
2787 | --- examples/precise/php/hooks/start 2012-06-17 15:39:48 +0000 | |||
2788 | +++ examples/precise/php/hooks/start 1970-01-01 00:00:00 +0000 | |||
2789 | @@ -1,1 +0,0 @@ | |||
2790 | 1 | #!/bin/bash | ||
2791 | 2 | 0 | ||
2792 | === removed file 'examples/precise/php/hooks/stop' | |||
2793 | --- examples/precise/php/hooks/stop 2012-06-17 15:39:48 +0000 | |||
2794 | +++ examples/precise/php/hooks/stop 1970-01-01 00:00:00 +0000 | |||
2795 | @@ -1,3 +0,0 @@ | |||
2796 | 1 | #!/bin/bash | ||
2797 | 2 | juju-log "Stopping apache" | ||
2798 | 3 | /etc/init.d/apache2 stop | ||
2799 | 4 | 0 | ||
2800 | === removed file 'examples/precise/php/metadata.yaml' | |||
2801 | --- examples/precise/php/metadata.yaml 2012-06-17 15:39:48 +0000 | |||
2802 | +++ examples/precise/php/metadata.yaml 1970-01-01 00:00:00 +0000 | |||
2803 | @@ -1,4 +0,0 @@ | |||
2804 | 1 | name: php | ||
2805 | 2 | summary: "php container" | ||
2806 | 3 | description: | | ||
2807 | 4 | PHP environment for your code. | ||
2808 | 5 | 0 | ||
2809 | === removed file 'examples/precise/php/revision' | |||
2810 | --- examples/precise/php/revision 2012-06-17 15:39:48 +0000 | |||
2811 | +++ examples/precise/php/revision 1970-01-01 00:00:00 +0000 | |||
2812 | @@ -1,1 +0,0 @@ | |||
2813 | 1 | 5 | ||
2814 | 2 | 0 | ||
2815 | === removed directory 'examples/precise/recorder' | |||
2816 | === removed directory 'examples/precise/recorder/hooks' | |||
2817 | === removed file 'examples/precise/recorder/hooks/install' | |||
2818 | --- examples/precise/recorder/hooks/install 2012-07-19 11:01:09 +0000 | |||
2819 | +++ examples/precise/recorder/hooks/install 1970-01-01 00:00:00 +0000 | |||
2820 | @@ -1,3 +0,0 @@ | |||
2821 | 1 | #!/bin/bash | ||
2822 | 2 | # for testing | ||
2823 | 3 | open-port 8080 | ||
2824 | 4 | \ No newline at end of file | 0 | \ No newline at end of file |
2825 | 5 | 1 | ||
2826 | === removed file 'examples/precise/recorder/hooks/juju-info-relation-changed' | |||
2827 | --- examples/precise/recorder/hooks/juju-info-relation-changed 2012-06-17 15:39:48 +0000 | |||
2828 | +++ examples/precise/recorder/hooks/juju-info-relation-changed 1970-01-01 00:00:00 +0000 | |||
2829 | @@ -1,5 +0,0 @@ | |||
2830 | 1 | #!/bin/bash | ||
2831 | 2 | set -x | ||
2832 | 3 | |||
2833 | 4 | juju-log "Changed relation with $JUJU_REMOTE_UNIT" | ||
2834 | 5 | juju-log `relation-list` | ||
2835 | 6 | 0 | ||
2836 | === removed file 'examples/precise/recorder/hooks/juju-info-relation-departed' | |||
2837 | --- examples/precise/recorder/hooks/juju-info-relation-departed 2012-06-17 15:39:48 +0000 | |||
2838 | +++ examples/precise/recorder/hooks/juju-info-relation-departed 1970-01-01 00:00:00 +0000 | |||
2839 | @@ -1,3 +0,0 @@ | |||
2840 | 1 | #!/bin/bash | ||
2841 | 2 | |||
2842 | 3 | juju-log "Departed from $JUJU_REMOTE_UNIT" | ||
2843 | 4 | 0 | ||
2844 | === removed file 'examples/precise/recorder/hooks/juju-info-relation-joined' | |||
2845 | --- examples/precise/recorder/hooks/juju-info-relation-joined 2012-06-17 15:39:48 +0000 | |||
2846 | +++ examples/precise/recorder/hooks/juju-info-relation-joined 1970-01-01 00:00:00 +0000 | |||
2847 | @@ -1,6 +0,0 @@ | |||
2848 | 1 | #!/bin/bash | ||
2849 | 2 | |||
2850 | 3 | set -x | ||
2851 | 4 | |||
2852 | 5 | juju-log "Joined with $JUJU_REMOTE_UNIT" | ||
2853 | 6 | juju-log `relation-list` | ||
2854 | 7 | 0 | ||
2855 | === removed file 'examples/precise/recorder/metadata.yaml' | |||
2856 | --- examples/precise/recorder/metadata.yaml 2012-06-17 15:39:48 +0000 | |||
2857 | +++ examples/precise/recorder/metadata.yaml 1970-01-01 00:00:00 +0000 | |||
2858 | @@ -1,9 +0,0 @@ | |||
2859 | 1 | name: recorder | ||
2860 | 2 | summary: "Subordinate test charm" | ||
2861 | 3 | description: | | ||
2862 | 4 | Records which units can see each other to show how subordinates work. | ||
2863 | 5 | subordinate: true | ||
2864 | 6 | requires: | ||
2865 | 7 | juju-info: | ||
2866 | 8 | interface: juju-info | ||
2867 | 9 | scope: container | ||
2868 | 10 | 0 | ||
2869 | === removed file 'examples/precise/recorder/revision' | |||
2870 | --- examples/precise/recorder/revision 2012-06-17 15:39:48 +0000 | |||
2871 | +++ examples/precise/recorder/revision 1970-01-01 00:00:00 +0000 | |||
2872 | @@ -1,1 +0,0 @@ | |||
2873 | 1 | 1 | ||
2874 | 2 | \ No newline at end of file | 0 | \ No newline at end of file |
2875 | 3 | 1 | ||
2876 | === removed directory 'examples/precise/wordpress' | |||
2877 | === removed file 'examples/precise/wordpress/config.yaml' | |||
2878 | --- examples/precise/wordpress/config.yaml 2012-06-17 15:39:48 +0000 | |||
2879 | +++ examples/precise/wordpress/config.yaml 1970-01-01 00:00:00 +0000 | |||
2880 | @@ -1,7 +0,0 @@ | |||
2881 | 1 | options: | ||
2882 | 2 | plugin: | ||
2883 | 3 | description: | | ||
2884 | 4 | The URL of a wordpress plugin which will be installed and made available in the Admin UI. | ||
2885 | 5 | http://downloads.wordpress.org/plugin/buddypress.1.2.8.zip is a valid example. | ||
2886 | 6 | type: string | ||
2887 | 7 | |||
2888 | 8 | 0 | ||
2889 | === removed directory 'examples/precise/wordpress/hooks' | |||
2890 | === removed file 'examples/precise/wordpress/hooks/config-changed' | |||
2891 | --- examples/precise/wordpress/hooks/config-changed 2012-06-17 15:39:48 +0000 | |||
2892 | +++ examples/precise/wordpress/hooks/config-changed 1970-01-01 00:00:00 +0000 | |||
2893 | @@ -1,19 +0,0 @@ | |||
2894 | 1 | #!/bin/bash | ||
2895 | 2 | |||
2896 | 3 | hostname=`unit-get public-address` | ||
2897 | 4 | plugin_dir="/var/www/$hostname/wp-content/plugins" | ||
2898 | 5 | plugin_url=`config-get plugin` | ||
2899 | 6 | |||
2900 | 7 | base_plugin=`basename ${plugin_url}` | ||
2901 | 8 | |||
2902 | 9 | cd /tmp | ||
2903 | 10 | |||
2904 | 11 | curl -O ${plugin_url} | ||
2905 | 12 | |||
2906 | 13 | if [ $? = 0 ]; then | ||
2907 | 14 | cd ${plugin_dir} | ||
2908 | 15 | unzip /tmp/${base_plugin} | ||
2909 | 16 | else | ||
2910 | 17 | juju-log -l WARNING "Unable to fetch ${plugin_url}" | ||
2911 | 18 | |||
2912 | 19 | fi | ||
2913 | 20 | 0 | ||
2914 | === removed file 'examples/precise/wordpress/hooks/db-relation-changed' | |||
2915 | --- examples/precise/wordpress/hooks/db-relation-changed 2012-06-17 15:39:48 +0000 | |||
2916 | +++ examples/precise/wordpress/hooks/db-relation-changed 1970-01-01 00:00:00 +0000 | |||
2917 | @@ -1,100 +0,0 @@ | |||
2918 | 1 | #!/bin/bash | ||
2919 | 2 | |||
2920 | 3 | set -eu # -x for verbose logging to juju debug-log | ||
2921 | 4 | |||
2922 | 5 | UPLOAD_PATH="/var/www/wp-uploads" | ||
2923 | 6 | |||
2924 | 7 | hostname=`unit-get public-address` | ||
2925 | 8 | juju-log "Retrieved hostname: $hostname" | ||
2926 | 9 | |||
2927 | 10 | # Check we haven't already been setup. | ||
2928 | 11 | config_file_path="/etc/wordpress/config-$hostname.php" | ||
2929 | 12 | if [ -f "$config_file_path" ] ; then | ||
2930 | 13 | juju-log "Wordpress for site $config_file_path already Configured, exiting" | ||
2931 | 14 | echo "Already Configured, Exiting" | ||
2932 | 15 | exit 0 # already setup | ||
2933 | 16 | fi | ||
2934 | 17 | |||
2935 | 18 | # Get the database settings; if not set, wait for this hook to be | ||
2936 | 19 | # invoked again | ||
2937 | 20 | database=`relation-get database` | ||
2938 | 21 | if [ -z "$database" ] ; then | ||
2939 | 22 | exit 0 # wait for future handshake from database service unit | ||
2940 | 23 | fi | ||
2941 | 24 | |||
2942 | 25 | # Our protocol on this interface ensures that all or none of the | ||
2943 | 26 | # settings are set. But we can verify the setting or the values if | ||
2944 | 27 | # more error checking if desired. | ||
2945 | 28 | user=`relation-get user` | ||
2946 | 29 | password=`relation-get password` | ||
2947 | 30 | host=`relation-get private-address` | ||
2948 | 31 | |||
2949 | 32 | # Create an internal secret key for wordpress; this is unrelated to | ||
2950 | 33 | # the password generated for the admin user of wordpress | ||
2951 | 34 | secret_key=`pwgen 10 1` | ||
2952 | 35 | |||
2953 | 36 | juju-log "Creating appropriate upload paths and directories" | ||
2954 | 37 | # Setup appropriate upload paths and directories | ||
2955 | 38 | ln -s /usr/share/wordpress "/var/www/$hostname" | ||
2956 | 39 | mkdir -p $UPLOAD_PATH | ||
2957 | 40 | mkdir -p "$UPLOAD_PATH/$hostname" | ||
2958 | 41 | chown -R root:www-data $UPLOAD_PATH | ||
2959 | 42 | chmod 0744 $UPLOAD_PATH | ||
2960 | 43 | chmod 0770 "$UPLOAD_PATH/$hostname" | ||
2961 | 44 | chown -R root:www-data "/var/www/$hostname/wp-content" | ||
2962 | 45 | |||
2963 | 46 | juju-log "Writing wordpress config file $config_file_path" | ||
2964 | 47 | # Write the wordpress config | ||
2965 | 48 | cat > $config_file_path <<EOF | ||
2966 | 49 | <?php | ||
2967 | 50 | define('DB_NAME', '$database'); | ||
2968 | 51 | define('DB_USER', '$user'); | ||
2969 | 52 | define('DB_PASSWORD', '$password'); | ||
2970 | 53 | define('DB_HOST', '$host'); | ||
2971 | 54 | define('SECRET_KEY', '$secret_key'); | ||
2972 | 55 | |||
2973 | 56 | #This will disable the update notification. | ||
2974 | 57 | define('WP_CORE_UPDATE', false); | ||
2975 | 58 | |||
2976 | 59 | \$table_prefix = 'wp_'; | ||
2977 | 60 | \$server = '$host'; | ||
2978 | 61 | \$loginsql = '$user'; | ||
2979 | 62 | \$passsql = '$password'; | ||
2980 | 63 | \$base = '$database'; | ||
2981 | 64 | \$upload_path = '/var/www/wp-uploads/$hostname'; | ||
2982 | 65 | \$upload_url_path = 'http://$hostname/wp-uploads'; | ||
2983 | 66 | ?> | ||
2984 | 67 | EOF | ||
2985 | 68 | chmod 0644 $config_file_path | ||
2986 | 69 | |||
2987 | 70 | # Write the apache config | ||
2988 | 71 | # XXX a future branch will change this to use augtool | ||
2989 | 72 | apache_config_file_path="/etc/apache2/sites-available/$hostname" | ||
2990 | 73 | juju-log "Writing apache config file $apache_config_file_path" | ||
2991 | 74 | cat > $apache_config_file_path <<EOF | ||
2992 | 75 | <VirtualHost *:80> | ||
2993 | 76 | ServerName $hostname | ||
2994 | 77 | DocumentRoot /var/www/$hostname | ||
2995 | 78 | Options All | ||
2996 | 79 | ErrorLog /var/log/apache2/wp-error.log | ||
2997 | 80 | TransferLog /var/log/apache2/wp-access.log | ||
2998 | 81 | # Store uploads in /var/www/wp-uploads/$0 | ||
2999 | 82 | RewriteEngine On | ||
3000 | 83 | RewriteRule ^/wp-uploads/(.*)$ /var/www/wp-uploads/%%{HTTP_HOST}/\$1 | ||
3001 | 84 | </VirtualHost> | ||
3002 | 85 | EOF | ||
3003 | 86 | chmod 0644 $apache_config_file_path | ||
3004 | 87 | |||
3005 | 88 | # Configure apache | ||
3006 | 89 | juju-log "Enabling apache modules: rewrite, vhost_alias" | ||
3007 | 90 | a2enmod rewrite | ||
3008 | 91 | a2enmod vhost_alias | ||
3009 | 92 | juju-log "Enabling apache site: $hostname" | ||
3010 | 93 | a2ensite $hostname | ||
3011 | 94 | |||
3012 | 95 | # Restart apache | ||
3013 | 96 | juju-log "Restarting apache2 service" | ||
3014 | 97 | /etc/init.d/apache2 restart | ||
3015 | 98 | |||
3016 | 99 | # Make it publicly visible, once the wordpress service is exposed | ||
3017 | 100 | open-port 80/tcp | ||
3018 | 101 | 0 | ||
3019 | === removed file 'examples/precise/wordpress/hooks/install' | |||
3020 | --- examples/precise/wordpress/hooks/install 2012-06-17 15:39:48 +0000 | |||
3021 | +++ examples/precise/wordpress/hooks/install 1970-01-01 00:00:00 +0000 | |||
3022 | @@ -1,6 +0,0 @@ | |||
3023 | 1 | #!/bin/bash | ||
3024 | 2 | |||
3025 | 3 | juju-log "Installing wordpress, pwgen via apt-get" | ||
3026 | 4 | set -eu # -x for verbose logging to juju debug-log | ||
3027 | 5 | |||
3028 | 6 | apt-get -y install wordpress pwgen unzip | ||
3029 | 7 | 0 | ||
3030 | === removed file 'examples/precise/wordpress/hooks/start' | |||
3031 | --- examples/precise/wordpress/hooks/start 2012-06-17 15:39:48 +0000 | |||
3032 | +++ examples/precise/wordpress/hooks/start 1970-01-01 00:00:00 +0000 | |||
3033 | @@ -1,1 +0,0 @@ | |||
3034 | 1 | #!/bin/bash | ||
3035 | 2 | 0 | ||
3036 | === removed file 'examples/precise/wordpress/hooks/stop' | |||
3037 | --- examples/precise/wordpress/hooks/stop 2012-06-17 15:39:48 +0000 | |||
3038 | +++ examples/precise/wordpress/hooks/stop 1970-01-01 00:00:00 +0000 | |||
3039 | @@ -1,3 +0,0 @@ | |||
3040 | 1 | #!/bin/bash | ||
3041 | 2 | juju-log "Stopping apache" | ||
3042 | 3 | /etc/init.d/apache2 stop | ||
3043 | 4 | 0 | ||
3044 | === removed file 'examples/precise/wordpress/metadata.yaml' | |||
3045 | --- examples/precise/wordpress/metadata.yaml 2012-06-17 15:39:48 +0000 | |||
3046 | +++ examples/precise/wordpress/metadata.yaml 1970-01-01 00:00:00 +0000 | |||
3047 | @@ -1,10 +0,0 @@ | |||
3048 | 1 | name: wordpress | ||
3049 | 2 | summary: "WordPress blog" | ||
3050 | 3 | description: | | ||
3051 | 4 | Installs WordPress package (wordpress). Upon the database provider | ||
3052 | 5 | providing the required database, and the relation settings | ||
3053 | 6 | necessary to access it, completes the configuration of WordPress | ||
3054 | 7 | and makes it available on the web. | ||
3055 | 8 | requires: | ||
3056 | 9 | db: | ||
3057 | 10 | interface: mysql | ||
3058 | 11 | 0 | ||
3059 | === removed file 'examples/precise/wordpress/revision' | |||
3060 | --- examples/precise/wordpress/revision 2012-06-17 15:39:48 +0000 | |||
3061 | +++ examples/precise/wordpress/revision 1970-01-01 00:00:00 +0000 | |||
3062 | @@ -1,1 +0,0 @@ | |||
3063 | 1 | 31 | ||
3064 | 2 | 0 | ||
3065 | === added directory 'juju' | |||
3066 | === removed directory 'juju' | |||
3067 | === added file 'juju/__init__.py' | |||
3068 | --- juju/__init__.py 1970-01-01 00:00:00 +0000 | |||
3069 | +++ juju/__init__.py 2013-04-22 11:00:38 +0000 | |||
3070 | @@ -0,0 +1,2 @@ | |||
3071 | 1 | # | ||
3072 | 2 | __version__ = '0.7' | ||
3073 | 0 | 3 | ||
3074 | === removed file 'juju/__init__.py' | |||
3075 | --- juju/__init__.py 2012-10-09 12:35:35 +0000 | |||
3076 | +++ juju/__init__.py 1970-01-01 00:00:00 +0000 | |||
3077 | @@ -1,2 +0,0 @@ | |||
3078 | 1 | # | ||
3079 | 2 | __version__ = '0.6' | ||
3080 | 3 | 0 | ||
3081 | === added directory 'juju/agents' | |||
3082 | === removed directory 'juju/agents' | |||
3083 | === added file 'juju/agents/__init__.py' | |||
3084 | --- juju/agents/__init__.py 1970-01-01 00:00:00 +0000 | |||
3085 | +++ juju/agents/__init__.py 2013-04-22 11:00:38 +0000 | |||
3086 | @@ -0,0 +1,1 @@ | |||
3087 | 1 | # | ||
3088 | 0 | 2 | ||
3089 | === removed file 'juju/agents/__init__.py' | |||
3090 | --- juju/agents/__init__.py 2012-06-11 15:40:48 +0000 | |||
3091 | +++ juju/agents/__init__.py 1970-01-01 00:00:00 +0000 | |||
3092 | @@ -1,1 +0,0 @@ | |||
3093 | 1 | # | ||
3094 | 2 | 0 | ||
3095 | === added file 'juju/agents/base.py' | |||
3096 | --- juju/agents/base.py 1970-01-01 00:00:00 +0000 | |||
3097 | +++ juju/agents/base.py 2013-04-22 11:00:38 +0000 | |||
3098 | @@ -0,0 +1,347 @@ | |||
3099 | 1 | import argparse | ||
3100 | 2 | import os | ||
3101 | 3 | import logging | ||
3102 | 4 | import stat | ||
3103 | 5 | import sys | ||
3104 | 6 | import yaml | ||
3105 | 7 | |||
3106 | 8 | import zookeeper | ||
3107 | 9 | |||
3108 | 10 | from twisted.application import service | ||
3109 | 11 | from twisted.internet.defer import inlineCallbacks, returnValue | ||
3110 | 12 | from twisted.scripts._twistd_unix import UnixApplicationRunner, UnixAppLogger | ||
3111 | 13 | from twisted.python.log import PythonLoggingObserver | ||
3112 | 14 | |||
3113 | 15 | from txzookeeper import ZookeeperClient | ||
3114 | 16 | from txzookeeper.managed import ManagedClient | ||
3115 | 17 | |||
3116 | 18 | from juju.control.options import setup_twistd_options | ||
3117 | 19 | from juju.errors import NoConnection, JujuError | ||
3118 | 20 | from juju.lib.zklog import ZookeeperHandler | ||
3119 | 21 | from juju.lib.zk import CLIENT_SESSION_TIMEOUT | ||
3120 | 22 | from juju.state.environment import GlobalSettingsStateManager | ||
3121 | 23 | |||
3122 | 24 | |||
3123 | 25 | def load_client_id(path): | ||
3124 | 26 | try: | ||
3125 | 27 | with open(path) as f: | ||
3126 | 28 | return yaml.load(f.read()) | ||
3127 | 29 | except IOError: | ||
3128 | 30 | return None | ||
3129 | 31 | |||
3130 | 32 | |||
3131 | 33 | def save_client_id(path, client_id): | ||
3132 | 34 | parent = os.path.dirname(path) | ||
3133 | 35 | if not os.path.exists(parent): | ||
3134 | 36 | os.makedirs(parent) | ||
3135 | 37 | with open(path, "w") as f: | ||
3136 | 38 | f.write(yaml.dump(client_id)) | ||
3137 | 39 | os.chmod(path, stat.S_IRUSR | stat.S_IWUSR) | ||
3138 | 40 | |||
3139 | 41 | |||
3140 | 42 | class TwistedOptionNamespace(object): | ||
3141 | 43 | """ | ||
3142 | 44 | An argparse namespace implementation that is compatible with twisted | ||
3143 | 45 | config dictionary usage. | ||
3144 | 46 | """ | ||
3145 | 47 | |||
3146 | 48 | def __getitem__(self, key): | ||
3147 | 49 | return self.__dict__[key] | ||
3148 | 50 | |||
3149 | 51 | def __setitem__(self, key, value): | ||
3150 | 52 | self.__dict__[key] = value | ||
3151 | 53 | |||
3152 | 54 | def get(self, key, default=None): | ||
3153 | 55 | return self.__dict__.get(key, default) | ||
3154 | 56 | |||
3155 | 57 | def has_key(self, key): | ||
3156 | 58 | return key in self.__dict__ | ||
3157 | 59 | |||
3158 | 60 | |||
3159 | 61 | class AgentLogger(UnixAppLogger): | ||
3160 | 62 | |||
3161 | 63 | def __init__(self, options): | ||
3162 | 64 | super(AgentLogger, self).__init__(options) | ||
3163 | 65 | self._loglevel = options.get("loglevel", logging.DEBUG) | ||
3164 | 66 | |||
3165 | 67 | def _getLogObserver(self): | ||
3166 | 68 | |||
3167 | 69 | if self._logfilename == "-": | ||
3168 | 70 | log_file = sys.stdout | ||
3169 | 71 | else: | ||
3170 | 72 | log_file = open(self._logfilename, "a") | ||
3171 | 73 | |||
3172 | 74 | # Setup file logger | ||
3173 | 75 | log_handler = logging.StreamHandler(log_file) | ||
3174 | 76 | formatter = logging.Formatter( | ||
3175 | 77 | "%(asctime)s: %(name)s@%(levelname)s: %(message)s") | ||
3176 | 78 | log_handler.setFormatter(formatter) | ||
3177 | 79 | |||
3178 | 80 | # Also capture zookeeper logs (XXX not compatible with rotation) | ||
3179 | 81 | zookeeper.set_log_stream(log_file) | ||
3180 | 82 | zookeeper.set_debug_level(0) | ||
3181 | 83 | |||
3182 | 84 | # Configure logging. | ||
3183 | 85 | root = logging.getLogger() | ||
3184 | 86 | root.addHandler(log_handler) | ||
3185 | 87 | root.setLevel(logging.getLevelName(self._loglevel)) | ||
3186 | 88 | |||
3187 | 89 | # Twisted logging is painfully verbose on twisted.web, and | ||
3188 | 90 | # there isn't a good way to distinguish different channels | ||
3189 | 91 | # within twisted, so just utlize error level logging only for | ||
3190 | 92 | # all of twisted. | ||
3191 | 93 | twisted_log = logging.getLogger("twisted") | ||
3192 | 94 | twisted_log.setLevel(logging.ERROR) | ||
3193 | 95 | |||
3194 | 96 | observer = PythonLoggingObserver() | ||
3195 | 97 | return observer.emit | ||
3196 | 98 | |||
3197 | 99 | |||
3198 | 100 | class AgentRunner(UnixApplicationRunner): | ||
3199 | 101 | |||
3200 | 102 | application = None | ||
3201 | 103 | loggerFactory = AgentLogger | ||
3202 | 104 | |||
3203 | 105 | def createOrGetApplication(self): | ||
3204 | 106 | return self.application | ||
3205 | 107 | |||
3206 | 108 | |||
3207 | 109 | class BaseAgent(object, service.Service): | ||
3208 | 110 | |||
3209 | 111 | name = "juju-agent-unknown" | ||
3210 | 112 | client = None | ||
3211 | 113 | |||
3212 | 114 | # Flag when enabling persistent topology watches, testing aid. | ||
3213 | 115 | _watch_enabled = True | ||
3214 | 116 | |||
3215 | 117 | # Distributed debug log handler | ||
3216 | 118 | _debug_log_handler = None | ||
3217 | 119 | |||
3218 | 120 | @classmethod | ||
3219 | 121 | def run(cls): | ||
3220 | 122 | """Runs the agent as a unix daemon. | ||
3221 | 123 | |||
3222 | 124 | Main entry point for starting an agent, parses cli options, and setups | ||
3223 | 125 | a daemon using twistd as per options. | ||
3224 | 126 | """ | ||
3225 | 127 | parser = argparse.ArgumentParser() | ||
3226 | 128 | cls.setup_options(parser) | ||
3227 | 129 | config = parser.parse_args(namespace=TwistedOptionNamespace()) | ||
3228 | 130 | runner = AgentRunner(config) | ||
3229 | 131 | agent = cls() | ||
3230 | 132 | agent.configure(config) | ||
3231 | 133 | runner.application = agent.as_app() | ||
3232 | 134 | runner.run() | ||
3233 | 135 | |||
3234 | 136 | @classmethod | ||
3235 | 137 | def setup_options(cls, parser): | ||
3236 | 138 | """Configure the argparse cli parser for the agent.""" | ||
3237 | 139 | return cls.setup_default_options(parser) | ||
3238 | 140 | |||
3239 | 141 | @classmethod | ||
3240 | 142 | def setup_default_options(cls, parser): | ||
3241 | 143 | """Setup default twistd daemon and agent options. | ||
3242 | 144 | |||
3243 | 145 | This method is intended as a utility for subclasses. | ||
3244 | 146 | |||
3245 | 147 | @param parser an argparse instance. | ||
3246 | 148 | @type C{argparse.ArgumentParser} | ||
3247 | 149 | """ | ||
3248 | 150 | setup_twistd_options(parser, cls) | ||
3249 | 151 | setup_default_agent_options(parser, cls) | ||
3250 | 152 | |||
3251 | 153 | def as_app(self): | ||
3252 | 154 | """ | ||
3253 | 155 | Return the agent as a C{twisted.application.service.Application} | ||
3254 | 156 | """ | ||
3255 | 157 | app = service.Application(self.name) | ||
3256 | 158 | self.setServiceParent(app) | ||
3257 | 159 | return app | ||
3258 | 160 | |||
3259 | 161 | def configure(self, options): | ||
3260 | 162 | """Configure the agent to handle its cli options. | ||
3261 | 163 | |||
3262 | 164 | Invoked called before the service is started. | ||
3263 | 165 | |||
3264 | 166 | @param options | ||
3265 | 167 | @type C{TwistedOptionNamespace} an argparse namespace corresponding | ||
3266 | 168 | to a dict. | ||
3267 | 169 | """ | ||
3268 | 170 | if not options.get("zookeeper_servers"): | ||
3269 | 171 | raise NoConnection("No zookeeper connection configured.") | ||
3270 | 172 | |||
3271 | 173 | if not os.path.exists(options.get("juju_directory", "")): | ||
3272 | 174 | raise JujuError( | ||
3273 | 175 | "Invalid juju-directory %r, does not exist." % ( | ||
3274 | 176 | options.get("juju_directory"))) | ||
3275 | 177 | |||
3276 | 178 | if options["session_file"] is None: | ||
3277 | 179 | raise JujuError("No session file specified") | ||
3278 | 180 | |||
3279 | 181 | self.config = options | ||
3280 | 182 | |||
3281 | 183 | @inlineCallbacks | ||
3282 | 184 | def _kill_existing_session(self): | ||
3283 | 185 | try: | ||
3284 | 186 | # We might have died suddenly, in which case the session may | ||
3285 | 187 | # still be alive. If this is the case, shoot it in the head, so | ||
3286 | 188 | # it doesn't interfere with our attempts to recreate our state. | ||
3287 | 189 | # (We need to be able to recreate our state *anyway*, and it's | ||
3288 | 190 | # much simpler to force ourselves to recreate it every time than | ||
3289 | 191 | # it is to mess around partially recreating partial state.) | ||
3290 | 192 | client_id = load_client_id(self.config["session_file"]) | ||
3291 | 193 | if client_id is None: | ||
3292 | 194 | return | ||
3293 | 195 | temp_client = yield ZookeeperClient().connect( | ||
3294 | 196 | self.config["zookeeper_servers"], client_id=client_id) | ||
3295 | 197 | yield temp_client.close() | ||
3296 | 198 | except zookeeper.ZooKeeperException: | ||
3297 | 199 | # We don't really care what went wrong; just that we're not able | ||
3298 | 200 | # to connect using the old session, and therefore we should be ok | ||
3299 | 201 | # to start a fresh one without transient state hanging around. | ||
3300 | 202 | pass | ||
3301 | 203 | |||
3302 | 204 | @inlineCallbacks | ||
3303 | 205 | def connect(self): | ||
3304 | 206 | """Return an authenticated connection to the juju zookeeper.""" | ||
3305 | 207 | yield self._kill_existing_session() | ||
3306 | 208 | self.client = yield ManagedClient( | ||
3307 | 209 | session_timeout=CLIENT_SESSION_TIMEOUT).connect( | ||
3308 | 210 | self.config["zookeeper_servers"]) | ||
3309 | 211 | save_client_id( | ||
3310 | 212 | self.config["session_file"], self.client.client_id) | ||
3311 | 213 | |||
3312 | 214 | principals = self.config.get("principals", ()) | ||
3313 | 215 | for principal in principals: | ||
3314 | 216 | self.client.add_auth("digest", principal) | ||
3315 | 217 | |||
3316 | 218 | # bug work around to keep auth fast | ||
3317 | 219 | if principals: | ||
3318 | 220 | yield self.client.exists("/") | ||
3319 | 221 | |||
3320 | 222 | returnValue(self.client) | ||
3321 | 223 | |||
3322 | 224 | def start(self): | ||
3323 | 225 | """Callback invoked on the agent's startup. | ||
3324 | 226 | |||
3325 | 227 | The agent will already be connected to zookeeper. Subclasses are | ||
3326 | 228 | responsible for implementing. | ||
3327 | 229 | """ | ||
3328 | 230 | raise NotImplementedError | ||
3329 | 231 | |||
3330 | 232 | def stop(self): | ||
3331 | 233 | """Callback invoked on when the agent is shutting down.""" | ||
3332 | 234 | pass | ||
3333 | 235 | |||
3334 | 236 | # Twisted IService implementation, used for delegates to maintain naming | ||
3335 | 237 | # conventions. | ||
3336 | 238 | @inlineCallbacks | ||
3337 | 239 | def startService(self): | ||
3338 | 240 | yield self.connect() | ||
3339 | 241 | |||
3340 | 242 | # Start the global settings watch prior to starting the agent. | ||
3341 | 243 | # Allows for debug log to be enabled early. | ||
3342 | 244 | if self.get_watch_enabled(): | ||
3343 | 245 | yield self.start_global_settings_watch() | ||
3344 | 246 | |||
3345 | 247 | yield self.start() | ||
3346 | 248 | |||
3347 | 249 | @inlineCallbacks | ||
3348 | 250 | def stopService(self): | ||
3349 | 251 | try: | ||
3350 | 252 | yield self.stop() | ||
3351 | 253 | finally: | ||
3352 | 254 | if self.client and self.client.connected: | ||
3353 | 255 | self.client.close() | ||
3354 | 256 | session_file = self.config["session_file"] | ||
3355 | 257 | if os.path.exists(session_file): | ||
3356 | 258 | os.unlink(session_file) | ||
3357 | 259 | |||
3358 | 260 | def set_watch_enabled(self, flag): | ||
3359 | 261 | """Set boolean flag for whether this agent should watching zookeeper. | ||
3360 | 262 | |||
3361 | 263 | This is mainly used for testing, to allow for setting up the | ||
3362 | 264 | various data scenarios, before enabling an agent watch which will | ||
3363 | 265 | be observing state. | ||
3364 | 266 | """ | ||
3365 | 267 | self._watch_enabled = bool(flag) | ||
3366 | 268 | |||
3367 | 269 | def get_watch_enabled(self): | ||
3368 | 270 | """Returns a boolean if the agent should be settings state watches. | ||
3369 | 271 | |||
3370 | 272 | The meaning of this flag is typically agent specific, as each | ||
3371 | 273 | agent has separate watches they'd like to establish on agent specific | ||
3372 | 274 | state within zookeeper. In general if this flag is False, the agent | ||
3373 | 275 | should refrain from establishing a watch on startup. This flag is | ||
3374 | 276 | typically used by tests to isolate and test the watch behavior | ||
3375 | 277 | independent of the agent startup, via construction of test data. | ||
3376 | 278 | """ | ||
3377 | 279 | return self._watch_enabled | ||
3378 | 280 | |||
3379 | 281 | def start_global_settings_watch(self): | ||
3380 | 282 | """Start watching the runtime state for configuration changes.""" | ||
3381 | 283 | self.global_settings_state = GlobalSettingsStateManager(self.client) | ||
3382 | 284 | return self.global_settings_state.watch_settings_changes( | ||
3383 | 285 | self.on_global_settings_change) | ||
3384 | 286 | |||
3385 | 287 | @inlineCallbacks | ||
3386 | 288 | def on_global_settings_change(self, change): | ||
3387 | 289 | """On global settings change, take action. | ||
3388 | 290 | """ | ||
3389 | 291 | if (yield self.global_settings_state.is_debug_log_enabled()): | ||
3390 | 292 | yield self.start_debug_log() | ||
3391 | 293 | else: | ||
3392 | 294 | self.stop_debug_log() | ||
3393 | 295 | |||
3394 | 296 | @inlineCallbacks | ||
3395 | 297 | def start_debug_log(self): | ||
3396 | 298 | """Enable the distributed debug log handler. | ||
3397 | 299 | """ | ||
3398 | 300 | if self._debug_log_handler is not None: | ||
3399 | 301 | returnValue(None) | ||
3400 | 302 | context_name = self.get_agent_name() | ||
3401 | 303 | self._debug_log_handler = ZookeeperHandler( | ||
3402 | 304 | self.client, context_name) | ||
3403 | 305 | yield self._debug_log_handler.open() | ||
3404 | 306 | log_root = logging.getLogger() | ||
3405 | 307 | log_root.addHandler(self._debug_log_handler) | ||
3406 | 308 | |||
3407 | 309 | def stop_debug_log(self): | ||
3408 | 310 | """Disable any configured debug log handler. | ||
3409 | 311 | """ | ||
3410 | 312 | if self._debug_log_handler is None: | ||
3411 | 313 | return | ||
3412 | 314 | handler, self._debug_log_handler = self._debug_log_handler, None | ||
3413 | 315 | log_root = logging.getLogger() | ||
3414 | 316 | log_root.removeHandler(handler) | ||
3415 | 317 | |||
3416 | 318 | def get_agent_name(self): | ||
3417 | 319 | """Return the agent's name and context such that it can be identified. | ||
3418 | 320 | |||
3419 | 321 | Subclasses should override this to provide additional context and | ||
3420 | 322 | unique naming. | ||
3421 | 323 | """ | ||
3422 | 324 | return self.__class__.__name__ | ||
3423 | 325 | |||
3424 | 326 | |||
3425 | 327 | def setup_default_agent_options(parser, cls): | ||
3426 | 328 | |||
3427 | 329 | principals_default = os.environ.get("JUJU_PRINCIPALS", "").split() | ||
3428 | 330 | parser.add_argument( | ||
3429 | 331 | "--principal", "-e", | ||
3430 | 332 | action="append", dest="principals", default=principals_default, | ||
3431 | 333 | help="Agent principals to utilize for the zookeeper connection") | ||
3432 | 334 | |||
3433 | 335 | servers_default = os.environ.get("JUJU_ZOOKEEPER", "") | ||
3434 | 336 | parser.add_argument( | ||
3435 | 337 | "--zookeeper-servers", "-z", default=servers_default, | ||
3436 | 338 | help="juju Zookeeper servers to connect to ($JUJU_ZOOKEEPER)") | ||
3437 | 339 | |||
3438 | 340 | juju_home = os.environ.get("JUJU_HOME", "/var/lib/juju") | ||
3439 | 341 | parser.add_argument( | ||
3440 | 342 | "--juju-directory", default=juju_home, type=os.path.abspath, | ||
3441 | 343 | help="juju working directory ($JUJU_HOME)") | ||
3442 | 344 | |||
3443 | 345 | parser.add_argument( | ||
3444 | 346 | "--session-file", default=None, type=os.path.abspath, | ||
3445 | 347 | help="like a pidfile, but for the zookeeper session id") | ||
3446 | 0 | 348 | ||
3447 | === removed file 'juju/agents/base.py' | |||
3448 | --- juju/agents/base.py 2012-06-11 15:40:48 +0000 | |||
3449 | +++ juju/agents/base.py 1970-01-01 00:00:00 +0000 | |||
3450 | @@ -1,345 +0,0 @@ | |||
3451 | 1 | import argparse | ||
3452 | 2 | import os | ||
3453 | 3 | import logging | ||
3454 | 4 | import stat | ||
3455 | 5 | import sys | ||
3456 | 6 | import yaml | ||
3457 | 7 | |||
3458 | 8 | import zookeeper | ||
3459 | 9 | |||
3460 | 10 | from twisted.application import service | ||
3461 | 11 | from twisted.internet.defer import inlineCallbacks, returnValue | ||
3462 | 12 | from twisted.scripts._twistd_unix import UnixApplicationRunner, UnixAppLogger | ||
3463 | 13 | from twisted.python.log import PythonLoggingObserver | ||
3464 | 14 | |||
3465 | 15 | from txzookeeper import ZookeeperClient | ||
3466 | 16 | from txzookeeper.managed import ManagedClient | ||
3467 | 17 | |||
3468 | 18 | from juju.control.options import setup_twistd_options | ||
3469 | 19 | from juju.errors import NoConnection, JujuError | ||
3470 | 20 | from juju.lib.zklog import ZookeeperHandler | ||
3471 | 21 | from juju.state.environment import GlobalSettingsStateManager | ||
3472 | 22 | |||
3473 | 23 | |||
3474 | 24 | def load_client_id(path): | ||
3475 | 25 | try: | ||
3476 | 26 | with open(path) as f: | ||
3477 | 27 | return yaml.load(f.read()) | ||
3478 | 28 | except IOError: | ||
3479 | 29 | return None | ||
3480 | 30 | |||
3481 | 31 | |||
3482 | 32 | def save_client_id(path, client_id): | ||
3483 | 33 | parent = os.path.dirname(path) | ||
3484 | 34 | if not os.path.exists(parent): | ||
3485 | 35 | os.makedirs(parent) | ||
3486 | 36 | with open(path, "w") as f: | ||
3487 | 37 | f.write(yaml.dump(client_id)) | ||
3488 | 38 | os.chmod(path, stat.S_IRUSR | stat.S_IWUSR) | ||
3489 | 39 | |||
3490 | 40 | |||
3491 | 41 | class TwistedOptionNamespace(object): | ||
3492 | 42 | """ | ||
3493 | 43 | An argparse namespace implementation that is compatible with twisted | ||
3494 | 44 | config dictionary usage. | ||
3495 | 45 | """ | ||
3496 | 46 | |||
3497 | 47 | def __getitem__(self, key): | ||
3498 | 48 | return self.__dict__[key] | ||
3499 | 49 | |||
3500 | 50 | def __setitem__(self, key, value): | ||
3501 | 51 | self.__dict__[key] = value | ||
3502 | 52 | |||
3503 | 53 | def get(self, key, default=None): | ||
3504 | 54 | return self.__dict__.get(key, default) | ||
3505 | 55 | |||
3506 | 56 | def has_key(self, key): | ||
3507 | 57 | return key in self.__dict__ | ||
3508 | 58 | |||
3509 | 59 | |||
3510 | 60 | class AgentLogger(UnixAppLogger): | ||
3511 | 61 | |||
3512 | 62 | def __init__(self, options): | ||
3513 | 63 | super(AgentLogger, self).__init__(options) | ||
3514 | 64 | self._loglevel = options.get("loglevel", logging.DEBUG) | ||
3515 | 65 | |||
3516 | 66 | def _getLogObserver(self): | ||
3517 | 67 | |||
3518 | 68 | if self._logfilename == "-": | ||
3519 | 69 | log_file = sys.stdout | ||
3520 | 70 | else: | ||
3521 | 71 | log_file = open(self._logfilename, "a") | ||
3522 | 72 | |||
3523 | 73 | # Setup file logger | ||
3524 | 74 | log_handler = logging.StreamHandler(log_file) | ||
3525 | 75 | formatter = logging.Formatter( | ||
3526 | 76 | "%(asctime)s: %(name)s@%(levelname)s: %(message)s") | ||
3527 | 77 | log_handler.setFormatter(formatter) | ||
3528 | 78 | |||
3529 | 79 | # Also capture zookeeper logs (XXX not compatible with rotation) | ||
3530 | 80 | zookeeper.set_log_stream(log_file) | ||
3531 | 81 | zookeeper.set_debug_level(0) | ||
3532 | 82 | |||
3533 | 83 | # Configure logging. | ||
3534 | 84 | root = logging.getLogger() | ||
3535 | 85 | root.addHandler(log_handler) | ||
3536 | 86 | root.setLevel(logging.getLevelName(self._loglevel)) | ||
3537 | 87 | |||
3538 | 88 | # Twisted logging is painfully verbose on twisted.web, and | ||
3539 | 89 | # there isn't a good way to distinguish different channels | ||
3540 | 90 | # within twisted, so just utlize error level logging only for | ||
3541 | 91 | # all of twisted. | ||
3542 | 92 | twisted_log = logging.getLogger("twisted") | ||
3543 | 93 | twisted_log.setLevel(logging.ERROR) | ||
3544 | 94 | |||
3545 | 95 | observer = PythonLoggingObserver() | ||
3546 | 96 | return observer.emit | ||
3547 | 97 | |||
3548 | 98 | |||
3549 | 99 | class AgentRunner(UnixApplicationRunner): | ||
3550 | 100 | |||
3551 | 101 | application = None | ||
3552 | 102 | loggerFactory = AgentLogger | ||
3553 | 103 | |||
3554 | 104 | def createOrGetApplication(self): | ||
3555 | 105 | return self.application | ||
3556 | 106 | |||
3557 | 107 | |||
3558 | 108 | class BaseAgent(object, service.Service): | ||
3559 | 109 | |||
3560 | 110 | name = "juju-agent-unknown" | ||
3561 | 111 | client = None | ||
3562 | 112 | |||
3563 | 113 | # Flag when enabling persistent topology watches, testing aid. | ||
3564 | 114 | _watch_enabled = True | ||
3565 | 115 | |||
3566 | 116 | # Distributed debug log handler | ||
3567 | 117 | _debug_log_handler = None | ||
3568 | 118 | |||
3569 | 119 | @classmethod | ||
3570 | 120 | def run(cls): | ||
3571 | 121 | """Runs the agent as a unix daemon. | ||
3572 | 122 | |||
3573 | 123 | Main entry point for starting an agent, parses cli options, and setups | ||
3574 | 124 | a daemon using twistd as per options. | ||
3575 | 125 | """ | ||
3576 | 126 | parser = argparse.ArgumentParser() | ||
3577 | 127 | cls.setup_options(parser) | ||
3578 | 128 | config = parser.parse_args(namespace=TwistedOptionNamespace()) | ||
3579 | 129 | runner = AgentRunner(config) | ||
3580 | 130 | agent = cls() | ||
3581 | 131 | agent.configure(config) | ||
3582 | 132 | runner.application = agent.as_app() | ||
3583 | 133 | runner.run() | ||
3584 | 134 | |||
3585 | 135 | @classmethod | ||
3586 | 136 | def setup_options(cls, parser): | ||
3587 | 137 | """Configure the argparse cli parser for the agent.""" | ||
3588 | 138 | return cls.setup_default_options(parser) | ||
3589 | 139 | |||
3590 | 140 | @classmethod | ||
3591 | 141 | def setup_default_options(cls, parser): | ||
3592 | 142 | """Setup default twistd daemon and agent options. | ||
3593 | 143 | |||
3594 | 144 | This method is intended as a utility for subclasses. | ||
3595 | 145 | |||
3596 | 146 | @param parser an argparse instance. | ||
3597 | 147 | @type C{argparse.ArgumentParser} | ||
3598 | 148 | """ | ||
3599 | 149 | setup_twistd_options(parser, cls) | ||
3600 | 150 | setup_default_agent_options(parser, cls) | ||
3601 | 151 | |||
3602 | 152 | def as_app(self): | ||
3603 | 153 | """ | ||
3604 | 154 | Return the agent as a C{twisted.application.service.Application} | ||
3605 | 155 | """ | ||
3606 | 156 | app = service.Application(self.name) | ||
3607 | 157 | self.setServiceParent(app) | ||
3608 | 158 | return app | ||
3609 | 159 | |||
3610 | 160 | def configure(self, options): | ||
3611 | 161 | """Configure the agent to handle its cli options. | ||
3612 | 162 | |||
3613 | 163 | Invoked called before the service is started. | ||
3614 | 164 | |||
3615 | 165 | @param options | ||
3616 | 166 | @type C{TwistedOptionNamespace} an argparse namespace corresponding | ||
3617 | 167 | to a dict. | ||
3618 | 168 | """ | ||
3619 | 169 | if not options.get("zookeeper_servers"): | ||
3620 | 170 | raise NoConnection("No zookeeper connection configured.") | ||
3621 | 171 | |||
3622 | 172 | if not os.path.exists(options.get("juju_directory", "")): | ||
3623 | 173 | raise JujuError( | ||
3624 | 174 | "Invalid juju-directory %r, does not exist." % ( | ||
3625 | 175 | options.get("juju_directory"))) | ||
3626 | 176 | |||
3627 | 177 | if options["session_file"] is None: | ||
3628 | 178 | raise JujuError("No session file specified") | ||
3629 | 179 | |||
3630 | 180 | self.config = options | ||
3631 | 181 | |||
3632 | 182 | @inlineCallbacks | ||
3633 | 183 | def _kill_existing_session(self): | ||
3634 | 184 | try: | ||
3635 | 185 | # We might have died suddenly, in which case the session may | ||
3636 | 186 | # still be alive. If this is the case, shoot it in the head, so | ||
3637 | 187 | # it doesn't interfere with our attempts to recreate our state. | ||
3638 | 188 | # (We need to be able to recreate our state *anyway*, and it's | ||
3639 | 189 | # much simpler to force ourselves to recreate it every time than | ||
3640 | 190 | # it is to mess around partially recreating partial state.) | ||
3641 | 191 | client_id = load_client_id(self.config["session_file"]) | ||
3642 | 192 | if client_id is None: | ||
3643 | 193 | return | ||
3644 | 194 | temp_client = yield ZookeeperClient().connect( | ||
3645 | 195 | self.config["zookeeper_servers"], client_id=client_id) | ||
3646 | 196 | yield temp_client.close() | ||
3647 | 197 | except zookeeper.ZooKeeperException: | ||
3648 | 198 | # We don't really care what went wrong; just that we're not able | ||
3649 | 199 | # to connect using the old session, and therefore we should be ok | ||
3650 | 200 | # to start a fresh one without transient state hanging around. | ||
3651 | 201 | pass | ||
3652 | 202 | |||
3653 | 203 | @inlineCallbacks | ||
3654 | 204 | def connect(self): | ||
3655 | 205 | """Return an authenticated connection to the juju zookeeper.""" | ||
3656 | 206 | yield self._kill_existing_session() | ||
3657 | 207 | self.client = yield ManagedClient().connect( | ||
3658 | 208 | self.config["zookeeper_servers"]) | ||
3659 | 209 | save_client_id( | ||
3660 | 210 | self.config["session_file"], self.client.client_id) | ||
3661 | 211 | |||
3662 | 212 | principals = self.config.get("principals", ()) | ||
3663 | 213 | for principal in principals: | ||
3664 | 214 | self.client.add_auth("digest", principal) | ||
3665 | 215 | |||
3666 | 216 | # bug work around to keep auth fast | ||
3667 | 217 | if principals: | ||
3668 | 218 | yield self.client.exists("/") | ||
3669 | 219 | |||
3670 | 220 | returnValue(self.client) | ||
3671 | 221 | |||
3672 | 222 | def start(self): | ||
3673 | 223 | """Callback invoked on the agent's startup. | ||
3674 | 224 | |||
3675 | 225 | The agent will already be connected to zookeeper. Subclasses are | ||
3676 | 226 | responsible for implementing. | ||
3677 | 227 | """ | ||
3678 | 228 | raise NotImplementedError | ||
3679 | 229 | |||
3680 | 230 | def stop(self): | ||
3681 | 231 | """Callback invoked on when the agent is shutting down.""" | ||
3682 | 232 | pass | ||
3683 | 233 | |||
3684 | 234 | # Twisted IService implementation, used for delegates to maintain naming | ||
3685 | 235 | # conventions. | ||
3686 | 236 | @inlineCallbacks | ||
3687 | 237 | def startService(self): | ||
3688 | 238 | yield self.connect() | ||
3689 | 239 | |||
3690 | 240 | # Start the global settings watch prior to starting the agent. | ||
3691 | 241 | # Allows for debug log to be enabled early. | ||
3692 | 242 | if self.get_watch_enabled(): | ||
3693 | 243 | yield self.start_global_settings_watch() | ||
3694 | 244 | |||
3695 | 245 | yield self.start() | ||
3696 | 246 | |||
3697 | 247 | @inlineCallbacks | ||
3698 | 248 | def stopService(self): | ||
3699 | 249 | try: | ||
3700 | 250 | yield self.stop() | ||
3701 | 251 | finally: | ||
3702 | 252 | if self.client and self.client.connected: | ||
3703 | 253 | self.client.close() | ||
3704 | 254 | session_file = self.config["session_file"] | ||
3705 | 255 | if os.path.exists(session_file): | ||
3706 | 256 | os.unlink(session_file) | ||
3707 | 257 | |||
3708 | 258 | def set_watch_enabled(self, flag): | ||
3709 | 259 | """Set boolean flag for whether this agent should watching zookeeper. | ||
3710 | 260 | |||
3711 | 261 | This is mainly used for testing, to allow for setting up the | ||
3712 | 262 | various data scenarios, before enabling an agent watch which will | ||
3713 | 263 | be observing state. | ||
3714 | 264 | """ | ||
3715 | 265 | self._watch_enabled = bool(flag) | ||
3716 | 266 | |||
3717 | 267 | def get_watch_enabled(self): | ||
3718 | 268 | """Returns a boolean if the agent should be settings state watches. | ||
3719 | 269 | |||
3720 | 270 | The meaning of this flag is typically agent specific, as each | ||
3721 | 271 | agent has separate watches they'd like to establish on agent specific | ||
3722 | 272 | state within zookeeper. In general if this flag is False, the agent | ||
3723 | 273 | should refrain from establishing a watch on startup. This flag is | ||
3724 | 274 | typically used by tests to isolate and test the watch behavior | ||
3725 | 275 | independent of the agent startup, via construction of test data. | ||
3726 | 276 | """ | ||
3727 | 277 | return self._watch_enabled | ||
3728 | 278 | |||
3729 | 279 | def start_global_settings_watch(self): | ||
3730 | 280 | """Start watching the runtime state for configuration changes.""" | ||
3731 | 281 | self.global_settings_state = GlobalSettingsStateManager(self.client) | ||
3732 | 282 | return self.global_settings_state.watch_settings_changes( | ||
3733 | 283 | self.on_global_settings_change) | ||
3734 | 284 | |||
3735 | 285 | @inlineCallbacks | ||
3736 | 286 | def on_global_settings_change(self, change): | ||
3737 | 287 | """On global settings change, take action. | ||
3738 | 288 | """ | ||
3739 | 289 | if (yield self.global_settings_state.is_debug_log_enabled()): | ||
3740 | 290 | yield self.start_debug_log() | ||
3741 | 291 | else: | ||
3742 | 292 | self.stop_debug_log() | ||
3743 | 293 | |||
3744 | 294 | @inlineCallbacks | ||
3745 | 295 | def start_debug_log(self): | ||
3746 | 296 | """Enable the distributed debug log handler. | ||
3747 | 297 | """ | ||
3748 | 298 | if self._debug_log_handler is not None: | ||
3749 | 299 | returnValue(None) | ||
3750 | 300 | context_name = self.get_agent_name() | ||
3751 | 301 | self._debug_log_handler = ZookeeperHandler( | ||
3752 | 302 | self.client, context_name) | ||
3753 | 303 | yield self._debug_log_handler.open() | ||
3754 | 304 | log_root = logging.getLogger() | ||
3755 | 305 | log_root.addHandler(self._debug_log_handler) | ||
3756 | 306 | |||
3757 | 307 | def stop_debug_log(self): | ||
3758 | 308 | """Disable any configured debug log handler. | ||
3759 | 309 | """ | ||
3760 | 310 | if self._debug_log_handler is None: | ||
3761 | 311 | return | ||
3762 | 312 | handler, self._debug_log_handler = self._debug_log_handler, None | ||
3763 | 313 | log_root = logging.getLogger() | ||
3764 | 314 | log_root.removeHandler(handler) | ||
3765 | 315 | |||
3766 | 316 | def get_agent_name(self): | ||
3767 | 317 | """Return the agent's name and context such that it can be identified. | ||
3768 | 318 | |||
3769 | 319 | Subclasses should override this to provide additional context and | ||
3770 | 320 | unique naming. | ||
3771 | 321 | """ | ||
3772 | 322 | return self.__class__.__name__ | ||
3773 | 323 | |||
3774 | 324 | |||
3775 | 325 | def setup_default_agent_options(parser, cls): | ||
3776 | 326 | |||
3777 | 327 | principals_default = os.environ.get("JUJU_PRINCIPALS", "").split() | ||
3778 | 328 | parser.add_argument( | ||
3779 | 329 | "--principal", "-e", | ||
3780 | 330 | action="append", dest="principals", default=principals_default, | ||
3781 | 331 | help="Agent principals to utilize for the zookeeper connection") | ||
3782 | 332 | |||
3783 | 333 | servers_default = os.environ.get("JUJU_ZOOKEEPER", "") | ||
3784 | 334 | parser.add_argument( | ||
3785 | 335 | "--zookeeper-servers", "-z", default=servers_default, | ||
3786 | 336 | help="juju Zookeeper servers to connect to ($JUJU_ZOOKEEPER)") | ||
3787 | 337 | |||
3788 | 338 | juju_home = os.environ.get("JUJU_HOME", "/var/lib/juju") | ||
3789 | 339 | parser.add_argument( | ||
3790 | 340 | "--juju-directory", default=juju_home, type=os.path.abspath, | ||
3791 | 341 | help="juju working directory ($JUJU_HOME)") | ||
3792 | 342 | |||
3793 | 343 | parser.add_argument( | ||
3794 | 344 | "--session-file", default=None, type=os.path.abspath, | ||
3795 | 345 | help="like a pidfile, but for the zookeeper session id") | ||
3796 | 346 | 0 | ||
3797 | === added file 'juju/agents/dummy.py' | |||
3798 | --- juju/agents/dummy.py 1970-01-01 00:00:00 +0000 | |||
3799 | +++ juju/agents/dummy.py 2013-04-22 11:00:38 +0000 | |||
3800 | @@ -0,0 +1,16 @@ | |||
3801 | 1 | |||
3802 | 2 | from .base import BaseAgent | ||
3803 | 3 | |||
3804 | 4 | |||
3805 | 5 | class DummyAgent(BaseAgent): | ||
3806 | 6 | """A do nothing juju agent. | ||
3807 | 7 | |||
3808 | 8 | A bit like a dog, it just lies around basking in the sun, | ||
3809 | 9 | doing nothing, nonetheless its quite content. :-) | ||
3810 | 10 | """ | ||
3811 | 11 | |||
3812 | 12 | def start(self): | ||
3813 | 13 | """nothing to see here, move along.""" | ||
3814 | 14 | |||
3815 | 15 | if __name__ == '__main__': | ||
3816 | 16 | DummyAgent.run() | ||
3817 | 0 | 17 | ||
3818 | === removed file 'juju/agents/dummy.py' | |||
3819 | --- juju/agents/dummy.py 2012-06-11 15:40:48 +0000 | |||
3820 | +++ juju/agents/dummy.py 1970-01-01 00:00:00 +0000 | |||
3821 | @@ -1,16 +0,0 @@ | |||
3822 | 1 | |||
3823 | 2 | from .base import BaseAgent | ||
3824 | 3 | |||
3825 | 4 | |||
3826 | 5 | class DummyAgent(BaseAgent): | ||
3827 | 6 | """A do nothing juju agent. | ||
3828 | 7 | |||
3829 | 8 | A bit like a dog, it just lies around basking in the sun, | ||
3830 | 9 | doing nothing, nonetheless its quite content. :-) | ||
3831 | 10 | """ | ||
3832 | 11 | |||
3833 | 12 | def start(self): | ||
3834 | 13 | """nothing to see here, move along.""" | ||
3835 | 14 | |||
3836 | 15 | if __name__ == '__main__': | ||
3837 | 16 | DummyAgent.run() | ||
3838 | 17 | 0 | ||
3839 | === added file 'juju/agents/machine.py' | |||
3840 | --- juju/agents/machine.py 1970-01-01 00:00:00 +0000 | |||
3841 | +++ juju/agents/machine.py 2013-04-22 11:00:38 +0000 | |||
3842 | @@ -0,0 +1,126 @@ | |||
3843 | 1 | import logging | ||
3844 | 2 | import os | ||
3845 | 3 | |||
3846 | 4 | from twisted.internet.defer import inlineCallbacks | ||
3847 | 5 | |||
3848 | 6 | from juju.errors import JujuError | ||
3849 | 7 | from juju.state.machine import MachineStateManager | ||
3850 | 8 | from juju.state.service import ServiceStateManager | ||
3851 | 9 | from juju.unit.deploy import UnitDeployer | ||
3852 | 10 | |||
3853 | 11 | from .base import BaseAgent | ||
3854 | 12 | |||
3855 | 13 | |||
3856 | 14 | log = logging.getLogger("juju.agents.machine") | ||
3857 | 15 | |||
3858 | 16 | |||
3859 | 17 | class MachineAgent(BaseAgent): | ||
3860 | 18 | """A juju machine agent. | ||
3861 | 19 | |||
3862 | 20 | The machine agent is responsible for monitoring service units | ||
3863 | 21 | assigned to a machine. If a new unit is assigned to machine, the | ||
3864 | 22 | machine agent will download the charm, create a working | ||
3865 | 23 | space for the service unit agent, and then launch it. | ||
3866 | 24 | |||
3867 | 25 | Additionally the machine agent will monitor the running service | ||
3868 | 26 | unit agents on the machine, via their ephemeral nodes, and | ||
3869 | 27 | restart them if they die. | ||
3870 | 28 | """ | ||
3871 | 29 | |||
3872 | 30 | name = "juju-machine-agent" | ||
3873 | 31 | unit_agent_module = "juju.agents.unit" | ||
3874 | 32 | |||
3875 | 33 | @property | ||
3876 | 34 | def units_directory(self): | ||
3877 | 35 | return os.path.join(self.config["juju_directory"], "units") | ||
3878 | 36 | |||
3879 | 37 | @property | ||
3880 | 38 | def unit_state_directory(self): | ||
3881 | 39 | return os.path.join(self.config["juju_directory"], "state") | ||
3882 | 40 | |||
3883 | 41 | @inlineCallbacks | ||
3884 | 42 | def start(self): | ||
3885 | 43 | """Start the machine agent. | ||
3886 | 44 | |||
3887 | 45 | Creates state directories on the machine, retrieves the machine state, | ||
3888 | 46 | and enables watch on assigned units. | ||
3889 | 47 | """ | ||
3890 | 48 | if not os.path.exists(self.units_directory): | ||
3891 | 49 | os.makedirs(self.units_directory) | ||
3892 | 50 | |||
3893 | 51 | if not os.path.exists(self.unit_state_directory): | ||
3894 | 52 | os.makedirs(self.unit_state_directory) | ||
3895 | 53 | |||
3896 | 54 | # Get state managers we'll be utilizing. | ||
3897 | 55 | self.service_state_manager = ServiceStateManager(self.client) | ||
3898 | 56 | self.unit_deployer = UnitDeployer( | ||
3899 | 57 | self.client, self.get_machine_id(), self.config["juju_directory"]) | ||
3900 | 58 | yield self.unit_deployer.start() | ||
3901 | 59 | |||
3902 | 60 | # Retrieve the machine state for the machine we represent. | ||
3903 | 61 | machine_manager = MachineStateManager(self.client) | ||
3904 | 62 | self.machine_state = yield machine_manager.get_machine_state( | ||
3905 | 63 | self.get_machine_id()) | ||
3906 | 64 | |||
3907 | 65 | # Watch assigned units for the machine. | ||
3908 | 66 | if self.get_watch_enabled(): | ||
3909 | 67 | self.machine_state.watch_assigned_units( | ||
3910 | 68 | self.watch_service_units) | ||
3911 | 69 | |||
3912 | 70 | # Connect the machine agent, broadcasting presence to the world. | ||
3913 | 71 | yield self.machine_state.connect_agent() | ||
3914 | 72 | log.info("Machine agent started id:%s" % self.get_machine_id()) | ||
3915 | 73 | |||
3916 | 74 | @inlineCallbacks | ||
3917 | 75 | def watch_service_units(self, old_units, new_units): | ||
3918 | 76 | """Callback invoked when the assigned service units change. | ||
3919 | 77 | """ | ||
3920 | 78 | if old_units is None: | ||
3921 | 79 | old_units = set() | ||
3922 | 80 | |||
3923 | 81 | log.debug( | ||
3924 | 82 | "Units changed old:%s new:%s", old_units, new_units) | ||
3925 | 83 | |||
3926 | 84 | stopped = old_units - new_units | ||
3927 | 85 | started = new_units - old_units | ||
3928 | 86 | |||
3929 | 87 | for unit_name in stopped: | ||
3930 | 88 | log.debug("Stopping service unit: %s ...", unit_name) | ||
3931 | 89 | try: | ||
3932 | 90 | yield self.unit_deployer.kill_service_unit(unit_name) | ||
3933 | 91 | except Exception: | ||
3934 | 92 | log.exception("Error stopping unit: %s", unit_name) | ||
3935 | 93 | |||
3936 | 94 | for unit_name in started: | ||
3937 | 95 | log.debug("Starting service unit: %s ...", unit_name) | ||
3938 | 96 | try: | ||
3939 | 97 | yield self.unit_deployer.start_service_unit(unit_name) | ||
3940 | 98 | except Exception: | ||
3941 | 99 | log.exception("Error starting unit: %s", unit_name) | ||
3942 | 100 | |||
3943 | 101 | def get_machine_id(self): | ||
3944 | 102 | """Get the id of the machine as known within the zk state.""" | ||
3945 | 103 | return self.config["machine_id"] | ||
3946 | 104 | |||
3947 | 105 | def get_agent_name(self): | ||
3948 | 106 | return "Machine:%s" % (self.get_machine_id()) | ||
3949 | 107 | |||
3950 | 108 | def configure(self, options): | ||
3951 | 109 | super(MachineAgent, self).configure(options) | ||
3952 | 110 | if not options.get("machine_id"): | ||
3953 | 111 | msg = ("--machine-id must be provided in the command line, " | ||
3954 | 112 | "or $JUJU_MACHINE_ID in the environment") | ||
3955 | 113 | raise JujuError(msg) | ||
3956 | 114 | |||
3957 | 115 | @classmethod | ||
3958 | 116 | def setup_options(cls, parser): | ||
3959 | 117 | super(MachineAgent, cls).setup_options(parser) | ||
3960 | 118 | |||
3961 | 119 | machine_id = os.environ.get("JUJU_MACHINE_ID", "") | ||
3962 | 120 | parser.add_argument( | ||
3963 | 121 | "--machine-id", default=machine_id) | ||
3964 | 122 | return parser | ||
3965 | 123 | |||
3966 | 124 | |||
3967 | 125 | if __name__ == "__main__": | ||
3968 | 126 | MachineAgent().run() | ||
3969 | 0 | 127 | ||
3970 | === removed file 'juju/agents/machine.py' | |||
3971 | --- juju/agents/machine.py 2012-08-24 16:02:42 +0000 | |||
3972 | +++ juju/agents/machine.py 1970-01-01 00:00:00 +0000 | |||
3973 | @@ -1,126 +0,0 @@ | |||
3974 | 1 | import logging | ||
3975 | 2 | import os | ||
3976 | 3 | |||
3977 | 4 | from twisted.internet.defer import inlineCallbacks | ||
3978 | 5 | |||
3979 | 6 | from juju.errors import JujuError | ||
3980 | 7 | from juju.state.machine import MachineStateManager | ||
3981 | 8 | from juju.state.service import ServiceStateManager | ||
3982 | 9 | from juju.unit.deploy import UnitDeployer | ||
3983 | 10 | |||
3984 | 11 | from .base import BaseAgent | ||
3985 | 12 | |||
3986 | 13 | |||
3987 | 14 | log = logging.getLogger("juju.agents.machine") | ||
3988 | 15 | |||
3989 | 16 | |||
3990 | 17 | class MachineAgent(BaseAgent): | ||
3991 | 18 | """A juju machine agent. | ||
3992 | 19 | |||
3993 | 20 | The machine agent is responsible for monitoring service units | ||
3994 | 21 | assigned to a machine. If a new unit is assigned to machine, the | ||
3995 | 22 | machine agent will download the charm, create a working | ||
3996 | 23 | space for the service unit agent, and then launch it. | ||
3997 | 24 | |||
3998 | 25 | Additionally the machine agent will monitor the running service | ||
3999 | 26 | unit agents on the machine, via their ephemeral nodes, and | ||
4000 | 27 | restart them if they die. | ||
4001 | 28 | """ | ||
4002 | 29 | |||
4003 | 30 | name = "juju-machine-agent" | ||
4004 | 31 | unit_agent_module = "juju.agents.unit" | ||
4005 | 32 | |||
4006 | 33 | @property | ||
4007 | 34 | def units_directory(self): | ||
4008 | 35 | return os.path.join(self.config["juju_directory"], "units") | ||
4009 | 36 | |||
4010 | 37 | @property | ||
4011 | 38 | def unit_state_directory(self): | ||
4012 | 39 | return os.path.join(self.config["juju_directory"], "state") | ||
4013 | 40 | |||
4014 | 41 | @inlineCallbacks | ||
4015 | 42 | def start(self): | ||
4016 | 43 | """Start the machine agent. | ||
4017 | 44 | |||
4018 | 45 | Creates state directories on the machine, retrieves the machine state, | ||
4019 | 46 | and enables watch on assigned units. | ||
4020 | 47 | """ | ||
4021 | 48 | if not os.path.exists(self.units_directory): | ||
4022 | 49 | os.makedirs(self.units_directory) | ||
4023 | 50 | |||
4024 | 51 | if not os.path.exists(self.unit_state_directory): | ||
4025 | 52 | os.makedirs(self.unit_state_directory) | ||
4026 | 53 | |||
4027 | 54 | # Get state managers we'll be utilizing. | ||
4028 | 55 | self.service_state_manager = ServiceStateManager(self.client) | ||
4029 | 56 | self.unit_deployer = UnitDeployer( | ||
4030 | 57 | self.client, self.get_machine_id(), self.config["juju_directory"]) | ||
4031 | 58 | yield self.unit_deployer.start() | ||
4032 | 59 | |||
4033 | 60 | # Retrieve the machine state for the machine we represent. | ||
4034 | 61 | machine_manager = MachineStateManager(self.client) | ||
4035 | 62 | self.machine_state = yield machine_manager.get_machine_state( | ||
4036 | 63 | self.get_machine_id()) | ||
4037 | 64 | |||
4038 | 65 | # Watch assigned units for the machine. | ||
4039 | 66 | if self.get_watch_enabled(): | ||
4040 | 67 | self.machine_state.watch_assigned_units( | ||
4041 | 68 | self.watch_service_units) | ||
4042 | 69 | |||
4043 | 70 | # Connect the machine agent, broadcasting presence to the world. | ||
4044 | 71 | yield self.machine_state.connect_agent() | ||
4045 | 72 | log.info("Machine agent started id:%s" % self.get_machine_id()) | ||
4046 | 73 | |||
4047 | 74 | @inlineCallbacks | ||
4048 | 75 | def watch_service_units(self, old_units, new_units): | ||
4049 | 76 | """Callback invoked when the assigned service units change. | ||
4050 | 77 | """ | ||
4051 | 78 | if old_units is None: | ||
4052 | 79 | old_units = set() | ||
4053 | 80 | |||
4054 | 81 | log.debug( | ||
4055 | 82 | "Units changed old:%s new:%s", old_units, new_units) | ||
4056 | 83 | |||
4057 | 84 | stopped = old_units - new_units | ||
4058 | 85 | started = new_units - old_units | ||
4059 | 86 | |||
4060 | 87 | for unit_name in stopped: | ||
4061 | 88 | log.debug("Stopping service unit: %s ...", unit_name) | ||
4062 | 89 | try: | ||
4063 | 90 | yield self.unit_deployer.kill_service_unit(unit_name) | ||
4064 | 91 | except Exception: | ||
4065 | 92 | log.exception("Error stopping unit: %s", unit_name) | ||
4066 | 93 | |||
4067 | 94 | for unit_name in started: | ||
4068 | 95 | log.debug("Starting service unit: %s ...", unit_name) | ||
4069 | 96 | try: | ||
4070 | 97 | yield self.unit_deployer.start_service_unit(unit_name) | ||
4071 | 98 | except Exception: | ||
4072 | 99 | log.exception("Error starting unit: %s", unit_name) | ||
4073 | 100 | |||
4074 | 101 | def get_machine_id(self): | ||
4075 | 102 | """Get the id of the machine as known within the zk state.""" | ||
4076 | 103 | return self.config["machine_id"] | ||
4077 | 104 | |||
4078 | 105 | def get_agent_name(self): | ||
4079 | 106 | return "Machine:%s" % (self.get_machine_id()) | ||
4080 | 107 | |||
4081 | 108 | def configure(self, options): | ||
4082 | 109 | super(MachineAgent, self).configure(options) | ||
4083 | 110 | if not options.get("machine_id"): | ||
4084 | 111 | msg = ("--machine-id must be provided in the command line, " | ||
4085 | 112 | "or $JUJU_MACHINE_ID in the environment") | ||
4086 | 113 | raise JujuError(msg) | ||
4087 | 114 | |||
4088 | 115 | @classmethod | ||
4089 | 116 | def setup_options(cls, parser): | ||
4090 | 117 | super(MachineAgent, cls).setup_options(parser) | ||
4091 | 118 | |||
4092 | 119 | machine_id = os.environ.get("JUJU_MACHINE_ID", "") | ||
4093 | 120 | parser.add_argument( | ||
4094 | 121 | "--machine-id", default=machine_id) | ||
4095 | 122 | return parser | ||
4096 | 123 | |||
4097 | 124 | |||
4098 | 125 | if __name__ == "__main__": | ||
4099 | 126 | MachineAgent().run() | ||
4100 | 127 | 0 | ||
4101 | === added file 'juju/agents/provision.py' | |||
4102 | --- juju/agents/provision.py 1970-01-01 00:00:00 +0000 | |||
4103 | +++ juju/agents/provision.py 2013-04-22 11:00:38 +0000 | |||
4104 | @@ -0,0 +1,239 @@ | |||
4105 | 1 | import logging | ||
4106 | 2 | |||
4107 | 3 | from twisted.internet.defer import inlineCallbacks, returnValue, succeed | ||
4108 | 4 | from zookeeper import NoNodeException | ||
4109 | 5 | |||
4110 | 6 | from juju.environment.config import EnvironmentsConfig | ||
4111 | 7 | from juju.errors import ProviderError | ||
4112 | 8 | from juju.lib.twistutils import concurrent_execution_guard | ||
4113 | 9 | from juju.state.errors import MachineStateNotFound, StopWatcher | ||
4114 | 10 | from juju.state.firewall import FirewallManager | ||
4115 | 11 | from juju.state.machine import MachineStateManager | ||
4116 | 12 | from juju.state.service import ServiceStateManager | ||
4117 | 13 | |||
4118 | 14 | from .base import BaseAgent | ||
4119 | 15 | |||
4120 | 16 | |||
4121 | 17 | log = logging.getLogger("juju.agents.provision") | ||
4122 | 18 | |||
4123 | 19 | |||
4124 | 20 | class ProvisioningAgent(BaseAgent): | ||
4125 | 21 | |||
4126 | 22 | name = "juju-provisoning-agent" | ||
4127 | 23 | |||
4128 | 24 | _current_machines = () | ||
4129 | 25 | |||
4130 | 26 | # time in seconds | ||
4131 | 27 | machine_check_period = 60 | ||
4132 | 28 | |||
4133 | 29 | def get_agent_name(self): | ||
4134 | 30 | return "provision:%s" % (self.environment.type) | ||
4135 | 31 | |||
4136 | 32 | @inlineCallbacks | ||
4137 | 33 | def start(self): | ||
4138 | 34 | self._running = True | ||
4139 | 35 | |||
4140 | 36 | self.environment = yield self.configure_environment() | ||
4141 | 37 | self.provider = self.environment.get_machine_provider() | ||
4142 | 38 | self.machine_state_manager = MachineStateManager(self.client) | ||
4143 | 39 | self.service_state_manager = ServiceStateManager(self.client) | ||
4144 | 40 | self.firewall_manager = FirewallManager( | ||
4145 | 41 | self.client, self.is_running, self.provider) | ||
4146 | 42 | |||
4147 | 43 | if self.get_watch_enabled(): | ||
4148 | 44 | self.machine_state_manager.watch_machine_states( | ||
4149 | 45 | self.watch_machine_changes) | ||
4150 | 46 | self.service_state_manager.watch_service_states( | ||
4151 | 47 | self.firewall_manager.watch_service_changes) | ||
4152 | 48 | from twisted.internet import reactor | ||
4153 | 49 | reactor.callLater( | ||
4154 | 50 | self.machine_check_period, self.periodic_machine_check) | ||
4155 | 51 | log.info("Started provisioning agent") | ||
4156 | 52 | else: | ||
4157 | 53 | log.info("Started provisioning agent without watches enabled") | ||
4158 | 54 | |||
4159 | 55 | def stop(self): | ||
4160 | 56 | log.info("Stopping provisioning agent") | ||
4161 | 57 | self._running = False | ||
4162 | 58 | return succeed(True) | ||
4163 | 59 | |||
4164 | 60 | def is_running(self): | ||
4165 | 61 | """Whether this agent is running or not.""" | ||
4166 | 62 | return self._running | ||
4167 | 63 | |||
4168 | 64 | @inlineCallbacks | ||
4169 | 65 | def configure_environment(self): | ||
4170 | 66 | """The provisioning agent configure its environment on start or change. | ||
4171 | 67 | |||
4172 | 68 | The environment contains the configuration th agent needs to interact | ||
4173 | 69 | with its machine provider, in order to do its work. This configuration | ||
4174 | 70 | data is deployed lazily over an encrypted connection upon first usage. | ||
4175 | 71 | |||
4176 | 72 | The agent waits for this data to exist before completing its startup. | ||
4177 | 73 | """ | ||
4178 | 74 | try: | ||
4179 | 75 | get_d, watch_d = self.client.get_and_watch("/environment") | ||
4180 | 76 | environment_data, stat = yield get_d | ||
4181 | 77 | watch_d.addCallback(self._on_environment_changed) | ||
4182 | 78 | except NoNodeException: | ||
4183 | 79 | # Wait till the environment node appears. play twisted gymnastics | ||
4184 | 80 | exists_d, watch_d = self.client.exists_and_watch("/environment") | ||
4185 | 81 | stat = yield exists_d | ||
4186 | 82 | if stat: | ||
4187 | 83 | environment = yield self.configure_environment() | ||
4188 | 84 | else: | ||
4189 | 85 | watch_d.addCallback( | ||
4190 | 86 | lambda result: self.configure_environment()) | ||
4191 | 87 | if not stat: | ||
4192 | 88 | environment = yield watch_d | ||
4193 | 89 | returnValue(environment) | ||
4194 | 90 | |||
4195 | 91 | config = EnvironmentsConfig() | ||
4196 | 92 | config.parse(environment_data) | ||
4197 | 93 | returnValue(config.get_default()) | ||
4198 | 94 | |||
4199 | 95 | @inlineCallbacks | ||
4200 | 96 | def _on_environment_changed(self, event): | ||
4201 | 97 | """Reload the environment if its data changes.""" | ||
4202 | 98 | |||
4203 | 99 | if event.type_name == "deleted": | ||
4204 | 100 | return | ||
4205 | 101 | |||
4206 | 102 | self.environment = yield self.configure_environment() | ||
4207 | 103 | self.provider = self.environment.get_machine_provider() | ||
4208 | 104 | |||
4209 | 105 | def periodic_machine_check(self): | ||
4210 | 106 | """A periodic checking of machine states and provider machines. | ||
4211 | 107 | |||
4212 | 108 | In addition to the on demand changes to zookeeper states that are | ||
4213 | 109 | monitored by L{watch_machine_changes}, the periodic machine check | ||
4214 | 110 | performs non zookeeper state related verification by periodically | ||
4215 | 111 | checking the last current provider machine states against the | ||
4216 | 112 | last known zookeeper state. | ||
4217 | 113 | |||
4218 | 114 | Primarily this helps in recovering from transient error conditions | ||
4219 | 115 | which may have prevent processing of an individual machine state, as | ||
4220 | 116 | well as verifying the current state of the provider's running machines | ||
4221 | 117 | against the zk state, thus pruning unused resources. | ||
4222 | 118 | """ | ||
4223 | 119 | from twisted.internet import reactor | ||
4224 | 120 | d = self.process_machines(self._current_machines) | ||
4225 | 121 | d.addBoth( | ||
4226 | 122 | lambda result: reactor.callLater( | ||
4227 | 123 | self.machine_check_period, self.periodic_machine_check)) | ||
4228 | 124 | return d | ||
4229 | 125 | |||
4230 | 126 | @inlineCallbacks | ||
4231 | 127 | def watch_machine_changes(self, old_machines, new_machines): | ||
4232 | 128 | """Watches and processes machine state changes. | ||
4233 | 129 | |||
4234 | 130 | This function is used to subscribe to topology changes, and | ||
4235 | 131 | specifically changes to machines within the topology. It performs | ||
4236 | 132 | work against the machine provider to ensure that the currently | ||
4237 | 133 | running state of the juju cluster corresponds to the topology | ||
4238 | 134 | via creation and deletion of machines. | ||
4239 | 135 | |||
4240 | 136 | The subscription utilized is a permanent one, meaning that this | ||
4241 | 137 | function will automatically be rescheduled to run whenever a topology | ||
4242 | 138 | state change happens that involves machines. | ||
4243 | 139 | |||
4244 | 140 | This functional also caches the current set of machines as an agent | ||
4245 | 141 | instance attribute. | ||
4246 | 142 | |||
4247 | 143 | @param old_machines machine ids as existed in the previous topology. | ||
4248 | 144 | @param new_machines machine ids as exist in the current topology. | ||
4249 | 145 | """ | ||
4250 | 146 | if not self._running: | ||
4251 | 147 | raise StopWatcher() | ||
4252 | 148 | log.debug("Machines changed old:%s new:%s", old_machines, new_machines) | ||
4253 | 149 | self._current_machines = new_machines | ||
4254 | 150 | try: | ||
4255 | 151 | yield self.process_machines(self._current_machines) | ||
4256 | 152 | except Exception: | ||
4257 | 153 | # Log and effectively retry later in periodic_machine_check | ||
4258 | 154 | log.exception( | ||
4259 | 155 | "Got unexpected exception in processing machines," | ||
4260 | 156 | " will retry") | ||
4261 | 157 | |||
4262 | 158 | @concurrent_execution_guard("_processing_machines") | ||
4263 | 159 | @inlineCallbacks | ||
4264 | 160 | def process_machines(self, current_machines): | ||
4265 | 161 | """Ensure the currently running machines correspond to state. | ||
4266 | 162 | |||
4267 | 163 | At the end of each process_machines execution, verify that all | ||
4268 | 164 | running machines within the provider correspond to machine_ids within | ||
4269 | 165 | the topology. If they don't then shut them down. | ||
4270 | 166 | |||
4271 | 167 | Utilizes concurrent execution guard, to ensure that this is only being | ||
4272 | 168 | executed at most once per process. | ||
4273 | 169 | """ | ||
4274 | 170 | # XXX this is obviously broken, but the margins of 80 columns prevent | ||
4275 | 171 | # me from describing. hint think concurrent agents, and use a lock. | ||
4276 | 172 | |||
4277 | 173 | # map of instance_id -> machine | ||
4278 | 174 | try: | ||
4279 | 175 | provider_machines = yield self.provider.get_machines() | ||
4280 | 176 | except ProviderError: | ||
4281 | 177 | log.exception("Cannot get machine list") | ||
4282 | 178 | return | ||
4283 | 179 | |||
4284 | 180 | provider_machines = dict( | ||
4285 | 181 | [(m.instance_id, m) for m in provider_machines]) | ||
4286 | 182 | |||
4287 | 183 | instance_ids = [] | ||
4288 | 184 | for machine_state_id in current_machines: | ||
4289 | 185 | try: | ||
4290 | 186 | instance_id = yield self.process_machine( | ||
4291 | 187 | machine_state_id, provider_machines) | ||
4292 | 188 | except (MachineStateNotFound, ProviderError): | ||
4293 | 189 | log.exception("Cannot process machine %s", machine_state_id) | ||
4294 | 190 | continue | ||
4295 | 191 | instance_ids.append(instance_id) | ||
4296 | 192 | |||
4297 | 193 | # Terminate all unused juju machines running within the cluster. | ||
4298 | 194 | unused = set(provider_machines.keys()) - set(instance_ids) | ||
4299 | 195 | for instance_id in unused: | ||
4300 | 196 | log.info("Shutting down machine id:%s ...", instance_id) | ||
4301 | 197 | machine = provider_machines[instance_id] | ||
4302 | 198 | |||
4303 | 199 | try: | ||
4304 | 200 | yield self.provider.shutdown_machine(machine) | ||
4305 | 201 | except ProviderError: | ||
4306 | 202 | log.exception("Cannot shutdown machine %s", instance_id) | ||
4307 | 203 | continue | ||
4308 | 204 | |||
4309 | 205 | @inlineCallbacks | ||
4310 | 206 | def process_machine(self, machine_state_id, provider_machine_map): | ||
4311 | 207 | """Ensure a provider machine for a machine state id. | ||
4312 | 208 | |||
4313 | 209 | For each machine_id in new machines which represents the current state | ||
4314 | 210 | of the topology: | ||
4315 | 211 | |||
4316 | 212 | * Check to ensure its state reflects that it has been | ||
4317 | 213 | launched. If it hasn't then create the machine and update | ||
4318 | 214 | the state. | ||
4319 | 215 | |||
4320 | 216 | * Watch the machine's assigned services so that changes can | ||
4321 | 217 | be applied to the firewall for service exposing support. | ||
4322 | 218 | """ | ||
4323 | 219 | # fetch the machine state | ||
4324 | 220 | machine_state = yield self.machine_state_manager.get_machine_state( | ||
4325 | 221 | machine_state_id) | ||
4326 | 222 | instance_id = yield machine_state.get_instance_id() | ||
4327 | 223 | |||
4328 | 224 | # Verify a machine id has state and is running, else launch it. | ||
4329 | 225 | if instance_id is None or not instance_id in provider_machine_map: | ||
4330 | 226 | log.info("Starting machine id:%s ...", machine_state.id) | ||
4331 | 227 | constraints = yield machine_state.get_constraints() | ||
4332 | 228 | machines = yield self.provider.start_machine( | ||
4333 | 229 | {"machine-id": machine_state.id, "constraints": constraints}) | ||
4334 | 230 | instance_id = machines[0].instance_id | ||
4335 | 231 | yield machine_state.set_instance_id(instance_id) | ||
4336 | 232 | |||
4337 | 233 | # The firewall manager also needs to be checked for any | ||
4338 | 234 | # outstanding retries on this machine | ||
4339 | 235 | yield self.firewall_manager.process_machine(machine_state) | ||
4340 | 236 | returnValue(instance_id) | ||
4341 | 237 | |||
4342 | 238 | if __name__ == '__main__': | ||
4343 | 239 | ProvisioningAgent().run() | ||
4344 | 0 | 240 | ||
4345 | === removed file 'juju/agents/provision.py' | |||
4346 | --- juju/agents/provision.py 2012-07-19 11:01:09 +0000 | |||
4347 | +++ juju/agents/provision.py 1970-01-01 00:00:00 +0000 | |||
4348 | @@ -1,239 +0,0 @@ | |||
4349 | 1 | import logging | ||
4350 | 2 | |||
4351 | 3 | from twisted.internet.defer import inlineCallbacks, returnValue, succeed | ||
4352 | 4 | from zookeeper import NoNodeException | ||
4353 | 5 | |||
4354 | 6 | from juju.environment.config import EnvironmentsConfig | ||
4355 | 7 | from juju.errors import ProviderError | ||
4356 | 8 | from juju.lib.twistutils import concurrent_execution_guard | ||
4357 | 9 | from juju.state.errors import MachineStateNotFound, StopWatcher | ||
4358 | 10 | from juju.state.firewall import FirewallManager | ||
4359 | 11 | from juju.state.machine import MachineStateManager | ||
4360 | 12 | from juju.state.service import ServiceStateManager | ||
4361 | 13 | |||
4362 | 14 | from .base import BaseAgent | ||
4363 | 15 | |||
4364 | 16 | |||
4365 | 17 | log = logging.getLogger("juju.agents.provision") | ||
4366 | 18 | |||
4367 | 19 | |||
4368 | 20 | class ProvisioningAgent(BaseAgent): | ||
4369 | 21 | |||
4370 | 22 | name = "juju-provisoning-agent" | ||
4371 | 23 | |||
4372 | 24 | _current_machines = () | ||
4373 | 25 | |||
4374 | 26 | # time in seconds | ||
4375 | 27 | machine_check_period = 60 | ||
4376 | 28 | |||
4377 | 29 | def get_agent_name(self): | ||
4378 | 30 | return "provision:%s" % (self.environment.type) | ||
4379 | 31 | |||
4380 | 32 | @inlineCallbacks | ||
4381 | 33 | def start(self): | ||
4382 | 34 | self._running = True | ||
4383 | 35 | |||
4384 | 36 | self.environment = yield self.configure_environment() | ||
4385 | 37 | self.provider = self.environment.get_machine_provider() | ||
4386 | 38 | self.machine_state_manager = MachineStateManager(self.client) | ||
4387 | 39 | self.service_state_manager = ServiceStateManager(self.client) | ||
4388 | 40 | self.firewall_manager = FirewallManager( | ||
4389 | 41 | self.client, self.is_running, self.provider) | ||
4390 | 42 | |||
4391 | 43 | if self.get_watch_enabled(): | ||
4392 | 44 | self.machine_state_manager.watch_machine_states( | ||
4393 | 45 | self.watch_machine_changes) | ||
4394 | 46 | self.service_state_manager.watch_service_states( | ||
4395 | 47 | self.firewall_manager.watch_service_changes) | ||
4396 | 48 | from twisted.internet import reactor | ||
4397 | 49 | reactor.callLater( | ||
4398 | 50 | self.machine_check_period, self.periodic_machine_check) | ||
4399 | 51 | log.info("Started provisioning agent") | ||
4400 | 52 | else: | ||
4401 | 53 | log.info("Started provisioning agent without watches enabled") | ||
4402 | 54 | |||
4403 | 55 | def stop(self): | ||
4404 | 56 | log.info("Stopping provisioning agent") | ||
4405 | 57 | self._running = False | ||
4406 | 58 | return succeed(True) | ||
4407 | 59 | |||
4408 | 60 | def is_running(self): | ||
4409 | 61 | """Whether this agent is running or not.""" | ||
4410 | 62 | return self._running | ||
4411 | 63 | |||
4412 | 64 | @inlineCallbacks | ||
4413 | 65 | def configure_environment(self): | ||
4414 | 66 | """The provisioning agent configure its environment on start or change. | ||
4415 | 67 | |||
4416 | 68 | The environment contains the configuration th agent needs to interact | ||
4417 | 69 | with its machine provider, in order to do its work. This configuration | ||
4418 | 70 | data is deployed lazily over an encrypted connection upon first usage. | ||
4419 | 71 | |||
4420 | 72 | The agent waits for this data to exist before completing its startup. | ||
4421 | 73 | """ | ||
4422 | 74 | try: | ||
4423 | 75 | get_d, watch_d = self.client.get_and_watch("/environment") | ||
4424 | 76 | environment_data, stat = yield get_d | ||
4425 | 77 | watch_d.addCallback(self._on_environment_changed) | ||
4426 | 78 | except NoNodeException: | ||
4427 | 79 | # Wait till the environment node appears. play twisted gymnastics | ||
4428 | 80 | exists_d, watch_d = self.client.exists_and_watch("/environment") | ||
4429 | 81 | stat = yield exists_d | ||
4430 | 82 | if stat: | ||
4431 | 83 | environment = yield self.configure_environment() | ||
4432 | 84 | else: | ||
4433 | 85 | watch_d.addCallback( | ||
4434 | 86 | lambda result: self.configure_environment()) | ||
4435 | 87 | if not stat: | ||
4436 | 88 | environment = yield watch_d | ||
4437 | 89 | returnValue(environment) | ||
4438 | 90 | |||
4439 | 91 | config = EnvironmentsConfig() | ||
4440 | 92 | config.parse(environment_data) | ||
4441 | 93 | returnValue(config.get_default()) | ||
4442 | 94 | |||
4443 | 95 | @inlineCallbacks | ||
4444 | 96 | def _on_environment_changed(self, event): | ||
4445 | 97 | """Reload the environment if its data changes.""" | ||
4446 | 98 | |||
4447 | 99 | if event.type_name == "deleted": | ||
4448 | 100 | return | ||
4449 | 101 | |||
4450 | 102 | self.environment = yield self.configure_environment() | ||
4451 | 103 | self.provider = self.environment.get_machine_provider() | ||
4452 | 104 | |||
4453 | 105 | def periodic_machine_check(self): | ||
4454 | 106 | """A periodic checking of machine states and provider machines. | ||
4455 | 107 | |||
4456 | 108 | In addition to the on demand changes to zookeeper states that are | ||
4457 | 109 | monitored by L{watch_machine_changes}, the periodic machine check | ||
4458 | 110 | performs non zookeeper state related verification by periodically | ||
4459 | 111 | checking the last current provider machine states against the | ||
4460 | 112 | last known zookeeper state. | ||
4461 | 113 | |||
4462 | 114 | Primarily this helps in recovering from transient error conditions | ||
4463 | 115 | which may have prevent processing of an individual machine state, as | ||
4464 | 116 | well as verifying the current state of the provider's running machines | ||
4465 | 117 | against the zk state, thus pruning unused resources. | ||
4466 | 118 | """ | ||
4467 | 119 | from twisted.internet import reactor | ||
4468 | 120 | d = self.process_machines(self._current_machines) | ||
4469 | 121 | d.addBoth( | ||
4470 | 122 | lambda result: reactor.callLater( | ||
4471 | 123 | self.machine_check_period, self.periodic_machine_check)) | ||
4472 | 124 | return d | ||
4473 | 125 | |||
4474 | 126 | @inlineCallbacks | ||
4475 | 127 | def watch_machine_changes(self, old_machines, new_machines): | ||
4476 | 128 | """Watches and processes machine state changes. | ||
4477 | 129 | |||
4478 | 130 | This function is used to subscribe to topology changes, and | ||
4479 | 131 | specifically changes to machines within the topology. It performs | ||
4480 | 132 | work against the machine provider to ensure that the currently | ||
4481 | 133 | running state of the juju cluster corresponds to the topology | ||
4482 | 134 | via creation and deletion of machines. | ||
4483 | 135 | |||
4484 | 136 | The subscription utilized is a permanent one, meaning that this | ||
4485 | 137 | function will automatically be rescheduled to run whenever a topology | ||
4486 | 138 | state change happens that involves machines. | ||
4487 | 139 | |||
4488 | 140 | This functional also caches the current set of machines as an agent | ||
4489 | 141 | instance attribute. | ||
4490 | 142 | |||
4491 | 143 | @param old_machines machine ids as existed in the previous topology. | ||
4492 | 144 | @param new_machines machine ids as exist in the current topology. | ||
4493 | 145 | """ | ||
4494 | 146 | if not self._running: | ||
4495 | 147 | raise StopWatcher() | ||
4496 | 148 | log.debug("Machines changed old:%s new:%s", old_machines, new_machines) | ||
4497 | 149 | self._current_machines = new_machines | ||
4498 | 150 | try: | ||
4499 | 151 | yield self.process_machines(self._current_machines) | ||
4500 | 152 | except Exception: | ||
4501 | 153 | # Log and effectively retry later in periodic_machine_check | ||
4502 | 154 | log.exception( | ||
4503 | 155 | "Got unexpected exception in processing machines," | ||
4504 | 156 | " will retry") | ||
4505 | 157 | |||
4506 | 158 | @concurrent_execution_guard("_processing_machines") | ||
4507 | 159 | @inlineCallbacks | ||
4508 | 160 | def process_machines(self, current_machines): | ||
4509 | 161 | """Ensure the currently running machines correspond to state. | ||
4510 | 162 | |||
4511 | 163 | At the end of each process_machines execution, verify that all | ||
4512 | 164 | running machines within the provider correspond to machine_ids within | ||
4513 | 165 | the topology. If they don't then shut them down. | ||
4514 | 166 | |||
4515 | 167 | Utilizes concurrent execution guard, to ensure that this is only being | ||
4516 | 168 | executed at most once per process. | ||
4517 | 169 | """ | ||
4518 | 170 | # XXX this is obviously broken, but the margins of 80 columns prevent | ||
4519 | 171 | # me from describing. hint think concurrent agents, and use a lock. | ||
4520 | 172 | |||
4521 | 173 | # map of instance_id -> machine | ||
4522 | 174 | try: | ||
4523 | 175 | provider_machines = yield self.provider.get_machines() | ||
4524 | 176 | except ProviderError: | ||
4525 | 177 | log.exception("Cannot get machine list") | ||
4526 | 178 | return | ||
4527 | 179 | |||
4528 | 180 | provider_machines = dict( | ||
4529 | 181 | [(m.instance_id, m) for m in provider_machines]) | ||
4530 | 182 | |||
4531 | 183 | instance_ids = [] | ||
4532 | 184 | for machine_state_id in current_machines: | ||
4533 | 185 | try: | ||
4534 | 186 | instance_id = yield self.process_machine( | ||
4535 | 187 | machine_state_id, provider_machines) | ||
4536 | 188 | except (MachineStateNotFound, ProviderError): | ||
4537 | 189 | log.exception("Cannot process machine %s", machine_state_id) | ||
4538 | 190 | continue | ||
4539 | 191 | instance_ids.append(instance_id) | ||
4540 | 192 | |||
4541 | 193 | # Terminate all unused juju machines running within the cluster. | ||
4542 | 194 | unused = set(provider_machines.keys()) - set(instance_ids) | ||
4543 | 195 | for instance_id in unused: | ||
4544 | 196 | log.info("Shutting down machine id:%s ...", instance_id) | ||
4545 | 197 | machine = provider_machines[instance_id] | ||
4546 | 198 | |||
4547 | 199 | try: | ||
4548 | 200 | yield self.provider.shutdown_machine(machine) | ||
4549 | 201 | except ProviderError: | ||
4550 | 202 | log.exception("Cannot shutdown machine %s", instance_id) | ||
4551 | 203 | continue | ||
4552 | 204 | |||
4553 | 205 | @inlineCallbacks | ||
4554 | 206 | def process_machine(self, machine_state_id, provider_machine_map): | ||
4555 | 207 | """Ensure a provider machine for a machine state id. | ||
4556 | 208 | |||
4557 | 209 | For each machine_id in new machines which represents the current state | ||
4558 | 210 | of the topology: | ||
4559 | 211 | |||
4560 | 212 | * Check to ensure its state reflects that it has been | ||
4561 | 213 | launched. If it hasn't then create the machine and update | ||
4562 | 214 | the state. | ||
4563 | 215 | |||
4564 | 216 | * Watch the machine's assigned services so that changes can | ||
4565 | 217 | be applied to the firewall for service exposing support. | ||
4566 | 218 | """ | ||
4567 | 219 | # fetch the machine state | ||
4568 | 220 | machine_state = yield self.machine_state_manager.get_machine_state( | ||
4569 | 221 | machine_state_id) | ||
4570 | 222 | instance_id = yield machine_state.get_instance_id() | ||
4571 | 223 | |||
4572 | 224 | # Verify a machine id has state and is running, else launch it. | ||
4573 | 225 | if instance_id is None or not instance_id in provider_machine_map: | ||
4574 | 226 | log.info("Starting machine id:%s ...", machine_state.id) | ||
4575 | 227 | constraints = yield machine_state.get_constraints() | ||
4576 | 228 | machines = yield self.provider.start_machine( | ||
4577 | 229 | {"machine-id": machine_state.id, "constraints": constraints}) | ||
4578 | 230 | instance_id = machines[0].instance_id | ||
4579 | 231 | yield machine_state.set_instance_id(instance_id) | ||
4580 | 232 | |||
4581 | 233 | # The firewall manager also needs to be checked for any | ||
4582 | 234 | # outstanding retries on this machine | ||
4583 | 235 | yield self.firewall_manager.process_machine(machine_state) | ||
4584 | 236 | returnValue(instance_id) | ||
4585 | 237 | |||
4586 | 238 | if __name__ == '__main__': | ||
4587 | 239 | ProvisioningAgent().run() | ||
4588 | 240 | 0 | ||
4589 | === added directory 'juju/agents/tests' | |||
4590 | === removed directory 'juju/agents/tests' | |||
4591 | === added file 'juju/agents/tests/__init__.py' | |||
4592 | --- juju/agents/tests/__init__.py 1970-01-01 00:00:00 +0000 | |||
4593 | +++ juju/agents/tests/__init__.py 2013-04-22 11:00:38 +0000 | |||
4594 | @@ -0,0 +1,1 @@ | |||
4595 | 1 | # | ||
4596 | 0 | 2 | ||
4597 | === removed file 'juju/agents/tests/__init__.py' | |||
4598 | --- juju/agents/tests/__init__.py 2012-06-11 15:40:48 +0000 | |||
4599 | +++ juju/agents/tests/__init__.py 1970-01-01 00:00:00 +0000 | |||
4600 | @@ -1,1 +0,0 @@ | |||
4601 | 1 | # | ||
4602 | 2 | 0 | ||
4603 | === added file 'juju/agents/tests/common.py' | |||
4604 | --- juju/agents/tests/common.py 1970-01-01 00:00:00 +0000 | |||
4605 | +++ juju/agents/tests/common.py 2013-04-22 11:00:38 +0000 | |||
4606 | @@ -0,0 +1,52 @@ | |||
4607 | 1 | import os | ||
4608 | 2 | |||
4609 | 3 | from twisted.internet.defer import inlineCallbacks, succeed | ||
4610 | 4 | |||
4611 | 5 | from txzookeeper.tests.utils import deleteTree | ||
4612 | 6 | |||
4613 | 7 | from juju.agents.base import TwistedOptionNamespace | ||
4614 | 8 | from juju.state.tests.common import StateTestBase | ||
4615 | 9 | from juju.tests.common import get_test_zookeeper_address | ||
4616 | 10 | |||
4617 | 11 | |||
4618 | 12 | class AgentTestBase(StateTestBase): | ||
4619 | 13 | |||
4620 | 14 | agent_class = None | ||
4621 | 15 | juju_directory = None | ||
4622 | 16 | setup_environment = True | ||
4623 | 17 | |||
4624 | 18 | @inlineCallbacks | ||
4625 | 19 | def setUp(self): | ||
4626 | 20 | self.juju_directory = self.makeDir() | ||
4627 | 21 | yield super(AgentTestBase, self).setUp() | ||
4628 | 22 | assert self.agent_class, "Agent Class must be specified on test" | ||
4629 | 23 | if self.setup_environment: | ||
4630 | 24 | yield self.push_default_config() | ||
4631 | 25 | self.agent = self.agent_class() | ||
4632 | 26 | self.options = yield self.get_agent_config() | ||
4633 | 27 | self.agent.configure(self.options) | ||
4634 | 28 | self.agent.set_watch_enabled(False) | ||
4635 | 29 | |||
4636 | 30 | def tearDown(self): | ||
4637 | 31 | if self.agent.client and self.agent.client.connected: | ||
4638 | 32 | self.agent.client.close() | ||
4639 | 33 | |||
4640 | 34 | if self.client.connected: | ||
4641 | 35 | deleteTree("/", self.client.handle) | ||
4642 | 36 | self.client.close() | ||
4643 | 37 | |||
4644 | 38 | def get_agent_config(self): | ||
4645 | 39 | options = TwistedOptionNamespace() | ||
4646 | 40 | options["juju_directory"] = self.juju_directory | ||
4647 | 41 | options["zookeeper_servers"] = get_test_zookeeper_address() | ||
4648 | 42 | options["session_file"] = self.makeFile() | ||
4649 | 43 | return succeed(options) | ||
4650 | 44 | |||
4651 | 45 | @inlineCallbacks | ||
4652 | 46 | def debug_pprint_tree(self, path="/", indent=1): | ||
4653 | 47 | children = yield self.client.get_children(path) | ||
4654 | 48 | for n in children: | ||
4655 | 49 | print " " * indent, "/" + n | ||
4656 | 50 | yield self.debug_pprint_tree( | ||
4657 | 51 | os.path.join(path, n), | ||
4658 | 52 | indent + 1) | ||
4659 | 0 | 53 | ||
4660 | === removed file 'juju/agents/tests/common.py' | |||
4661 | --- juju/agents/tests/common.py 2012-06-11 15:40:48 +0000 | |||
4662 | +++ juju/agents/tests/common.py 1970-01-01 00:00:00 +0000 | |||
4663 | @@ -1,52 +0,0 @@ | |||
4664 | 1 | import os | ||
4665 | 2 | |||
4666 | 3 | from twisted.internet.defer import inlineCallbacks, succeed | ||
4667 | 4 | |||
4668 | 5 | from txzookeeper.tests.utils import deleteTree | ||
4669 | 6 | |||
4670 | 7 | from juju.agents.base import TwistedOptionNamespace | ||
4671 | 8 | from juju.state.tests.common import StateTestBase | ||
4672 | 9 | from juju.tests.common import get_test_zookeeper_address | ||
4673 | 10 | |||
4674 | 11 | |||
4675 | 12 | class AgentTestBase(StateTestBase): | ||
4676 | 13 | |||
4677 | 14 | agent_class = None | ||
4678 | 15 | juju_directory = None | ||
4679 | 16 | setup_environment = True | ||
4680 | 17 | |||
4681 | 18 | @inlineCallbacks | ||
4682 | 19 | def setUp(self): | ||
4683 | 20 | self.juju_directory = self.makeDir() | ||
4684 | 21 | yield super(AgentTestBase, self).setUp() | ||
4685 | 22 | assert self.agent_class, "Agent Class must be specified on test" | ||
4686 | 23 | if self.setup_environment: | ||
4687 | 24 | yield self.push_default_config() | ||
4688 | 25 | self.agent = self.agent_class() | ||
4689 | 26 | self.options = yield self.get_agent_config() | ||
4690 | 27 | self.agent.configure(self.options) | ||
4691 | 28 | self.agent.set_watch_enabled(False) | ||
4692 | 29 | |||
4693 | 30 | def tearDown(self): | ||
4694 | 31 | if self.agent.client and self.agent.client.connected: | ||
4695 | 32 | self.agent.client.close() | ||
4696 | 33 | |||
4697 | 34 | if self.client.connected: | ||
4698 | 35 | deleteTree("/", self.client.handle) | ||
4699 | 36 | self.client.close() | ||
4700 | 37 | |||
4701 | 38 | def get_agent_config(self): | ||
4702 | 39 | options = TwistedOptionNamespace() | ||
4703 | 40 | options["juju_directory"] = self.juju_directory | ||
4704 | 41 | options["zookeeper_servers"] = get_test_zookeeper_address() | ||
4705 | 42 | options["session_file"] = self.makeFile() | ||
4706 | 43 | return succeed(options) | ||
4707 | 44 | |||
4708 | 45 | @inlineCallbacks | ||
4709 | 46 | def debug_pprint_tree(self, path="/", indent=1): | ||
4710 | 47 | children = yield self.client.get_children(path) | ||
4711 | 48 | for n in children: | ||
4712 | 49 | print " " * indent, "/" + n | ||
4713 | 50 | yield self.debug_pprint_tree( | ||
4714 | 51 | os.path.join(path, n), | ||
4715 | 52 | indent + 1) | ||
4716 | 53 | 0 | ||
4717 | === added file 'juju/agents/tests/test_base.py' | |||
4718 | --- juju/agents/tests/test_base.py 1970-01-01 00:00:00 +0000 | |||
4719 | +++ juju/agents/tests/test_base.py 2013-04-22 11:00:38 +0000 | |||
4720 | @@ -0,0 +1,633 @@ | |||
4721 | 1 | import argparse | ||
4722 | 2 | import json | ||
4723 | 3 | import logging | ||
4724 | 4 | import os | ||
4725 | 5 | import stat | ||
4726 | 6 | import sys | ||
4727 | 7 | import yaml | ||
4728 | 8 | |||
4729 | 9 | from twisted.application.app import AppLogger | ||
4730 | 10 | from twisted.application.service import IService, IServiceCollection | ||
4731 | 11 | from twisted.internet.defer import ( | ||
4732 | 12 | fail, succeed, Deferred, inlineCallbacks, returnValue) | ||
4733 | 13 | from twisted.python.components import Componentized | ||
4734 | 14 | from twisted.python import log | ||
4735 | 15 | |||
4736 | 16 | import zookeeper | ||
4737 | 17 | from txzookeeper import ZookeeperClient | ||
4738 | 18 | from juju.lib.testing import TestCase | ||
4739 | 19 | from juju.lib.mocker import MATCH | ||
4740 | 20 | from juju.tests.common import get_test_zookeeper_address | ||
4741 | 21 | |||
4742 | 22 | from juju.agents.base import ( | ||
4743 | 23 | BaseAgent, TwistedOptionNamespace, AgentRunner, AgentLogger) | ||
4744 | 24 | from juju.agents.dummy import DummyAgent | ||
4745 | 25 | from juju.errors import NoConnection, JujuError | ||
4746 | 26 | from juju.lib.zklog import ZookeeperHandler | ||
4747 | 27 | |||
4748 | 28 | from juju.agents.tests.common import AgentTestBase | ||
4749 | 29 | |||
4750 | 30 | MATCH_APP = MATCH(lambda x: isinstance(x, Componentized)) | ||
4751 | 31 | MATCH_HANDLER = MATCH(lambda x: isinstance(x, ZookeeperHandler)) | ||
4752 | 32 | |||
4753 | 33 | |||
4754 | 34 | class BaseAgentTest(TestCase): | ||
4755 | 35 | |||
4756 | 36 | @inlineCallbacks | ||
4757 | 37 | def setUp(self): | ||
4758 | 38 | yield super(BaseAgentTest, self).setUp() | ||
4759 | 39 | self.juju_home = self.makeDir() | ||
4760 | 40 | self.change_environment(JUJU_HOME=self.juju_home) | ||
4761 | 41 | |||
4762 | 42 | def test_as_app(self): | ||
4763 | 43 | """The agent class can be accessed as an application.""" | ||
4764 | 44 | app = BaseAgent().as_app() | ||
4765 | 45 | multi_service = IService(app, None) | ||
4766 | 46 | self.assertTrue(IServiceCollection.providedBy(multi_service)) | ||
4767 | 47 | services = list(multi_service) | ||
4768 | 48 | self.assertEqual(len(services), 1) | ||
4769 | 49 | |||
4770 | 50 | def test_twistd_default_options(self): | ||
4771 | 51 | """The agent cli parsing, populates standard twistd options.""" | ||
4772 | 52 | parser = argparse.ArgumentParser() | ||
4773 | 53 | BaseAgent.setup_options(parser) | ||
4774 | 54 | |||
4775 | 55 | # Daemon group | ||
4776 | 56 | self.assertEqual( | ||
4777 | 57 | parser.get_default("logfile"), "%s.log" % BaseAgent.name) | ||
4778 | 58 | self.assertEqual(parser.get_default("pidfile"), "") | ||
4779 | 59 | |||
4780 | 60 | self.assertEqual(parser.get_default("loglevel"), "DEBUG") | ||
4781 | 61 | self.assertFalse(parser.get_default("nodaemon")) | ||
4782 | 62 | self.assertEqual(parser.get_default("rundir"), ".") | ||
4783 | 63 | self.assertEqual(parser.get_default("chroot"), None) | ||
4784 | 64 | self.assertEqual(parser.get_default("umask"), '0022') | ||
4785 | 65 | self.assertEqual(parser.get_default("uid"), None) | ||
4786 | 66 | self.assertEqual(parser.get_default("gid"), None) | ||
4787 | 67 | self.assertEqual(parser.get_default("euid"), None) | ||
4788 | 68 | self.assertEqual(parser.get_default("prefix"), BaseAgent.name) | ||
4789 | 69 | self.assertEqual(parser.get_default("syslog"), False) | ||
4790 | 70 | |||
4791 | 71 | # Development Group | ||
4792 | 72 | self.assertFalse(parser.get_default("debug")) | ||
4793 | 73 | self.assertFalse(parser.get_default("profile")) | ||
4794 | 74 | self.assertFalse(parser.get_default("savestats")) | ||
4795 | 75 | self.assertEqual(parser.get_default("profiler"), "cprofile") | ||
4796 | 76 | |||
4797 | 77 | # Hidden defaults | ||
4798 | 78 | self.assertEqual(parser.get_default("reactor"), "epoll") | ||
4799 | 79 | self.assertEqual(parser.get_default("originalname"), None) | ||
4800 | 80 | |||
4801 | 81 | # Agent options | ||
4802 | 82 | self.assertEqual(parser.get_default("principals"), []) | ||
4803 | 83 | self.assertEqual(parser.get_default("zookeeper_servers"), "") | ||
4804 | 84 | self.assertEqual(parser.get_default("juju_directory"), self.juju_home) | ||
4805 | 85 | self.assertEqual(parser.get_default("session_file"), None) | ||
4806 | 86 | |||
4807 | 87 | def test_twistd_flags_correspond(self): | ||
4808 | 88 | parser = argparse.ArgumentParser() | ||
4809 | 89 | BaseAgent.setup_options(parser) | ||
4810 | 90 | args = [ | ||
4811 | 91 | "--profile", | ||
4812 | 92 | "--savestats", | ||
4813 | 93 | "--nodaemon"] | ||
4814 | 94 | |||
4815 | 95 | options = parser.parse_args(args, namespace=TwistedOptionNamespace()) | ||
4816 | 96 | self.assertEqual(options.get("savestats"), True) | ||
4817 | 97 | self.assertEqual(options.get("nodaemon"), True) | ||
4818 | 98 | self.assertEqual(options.get("profile"), True) | ||
4819 | 99 | |||
4820 | 100 | def test_agent_logger(self): | ||
4821 | 101 | parser = argparse.ArgumentParser() | ||
4822 | 102 | BaseAgent.setup_options(parser) | ||
4823 | 103 | log_file_path = self.makeFile() | ||
4824 | 104 | |||
4825 | 105 | options = parser.parse_args( | ||
4826 | 106 | ["--logfile", log_file_path, "--session-file", self.makeFile()], | ||
4827 | 107 | namespace=TwistedOptionNamespace()) | ||
4828 | 108 | |||
4829 | 109 | def match_observer(observer): | ||
4830 | 110 | return isinstance(observer.im_self, log.PythonLoggingObserver) | ||
4831 | 111 | |||
4832 | 112 | def cleanup(observer): | ||
4833 | 113 | # post test cleanup of global state. | ||
4834 | 114 | log.removeObserver(observer) | ||
4835 | 115 | logging.getLogger().handlers = [] | ||
4836 | 116 | |||
4837 | 117 | original_log_with_observer = log.startLoggingWithObserver | ||
4838 | 118 | |||
4839 | 119 | def _start_log_with_observer(observer): | ||
4840 | 120 | self.addCleanup(cleanup, observer) | ||
4841 | 121 | # by default logging will replace stdout/stderr | ||
4842 | 122 | return original_log_with_observer(observer, 0) | ||
4843 | 123 | |||
4844 | 124 | app = self.mocker.mock() | ||
4845 | 125 | app.getComponent(log.ILogObserver, None) | ||
4846 | 126 | self.mocker.result(None) | ||
4847 | 127 | |||
4848 | 128 | start_log_with_observer = self.mocker.replace( | ||
4849 | 129 | log.startLoggingWithObserver) | ||
4850 | 130 | start_log_with_observer(MATCH(match_observer)) | ||
4851 | 131 | self.mocker.call(_start_log_with_observer) | ||
4852 | 132 | self.mocker.replay() | ||
4853 | 133 | |||
4854 | 134 | agent_logger = AgentLogger(options) | ||
4855 | 135 | agent_logger.start(app) | ||
4856 | 136 | |||
4857 | 137 | # We suppress twisted messages below the error level. | ||
4858 | 138 | output = open(log_file_path).read() | ||
4859 | 139 | self.assertFalse(output) | ||
4860 | 140 | |||
4861 | 141 | # also verify we didn't mess with the app logging. | ||
4862 | 142 | app_log = logging.getLogger() | ||
4863 | 143 | app_log.info("Good") | ||
4864 | 144 | |||
4865 | 145 | # and that twisted errors still go through. | ||
4866 | 146 | log.err("Something bad happened") | ||
4867 | 147 | output = open(log_file_path).read() | ||
4868 | 148 | |||
4869 | 149 | self.assertIn("Good", output) | ||
4870 | 150 | self.assertIn("Something bad happened", output) | ||
4871 | 151 | |||
4872 | 152 | def test_custom_log_level(self): | ||
4873 | 153 | parser = argparse.ArgumentParser() | ||
4874 | 154 | BaseAgent.setup_options(parser) | ||
4875 | 155 | options = parser.parse_args( | ||
4876 | 156 | ["--loglevel", "INFO"], namespace=TwistedOptionNamespace()) | ||
4877 | 157 | self.assertEqual(options.loglevel, "INFO") | ||
4878 | 158 | |||
4879 | 159 | def test_twistd_option_namespace(self): | ||
4880 | 160 | """ | ||
4881 | 161 | The twisted option namespace bridges argparse attribute access, | ||
4882 | 162 | to twisted dictionary access for cli options. | ||
4883 | 163 | """ | ||
4884 | 164 | options = TwistedOptionNamespace() | ||
4885 | 165 | options.x = 1 | ||
4886 | 166 | self.assertEqual(options['x'], 1) | ||
4887 | 167 | self.assertEqual(options.get('x'), 1) | ||
4888 | 168 | self.assertEqual(options.get('y'), None) | ||
4889 | 169 | self.assertRaises(KeyError, options.__getitem__, 'y') | ||
4890 | 170 | options['y'] = 2 | ||
4891 | 171 | self.assertEqual(options.y, 2) | ||
4892 | 172 | self.assertTrue(options.has_key('y')) | ||
4893 | 173 | self.assertFalse(options.has_key('z')) | ||
4894 | 174 | |||
4895 | 175 | def test_runner_attribute_application(self): | ||
4896 | 176 | """The agent runner retrieve the application as an attribute.""" | ||
4897 | 177 | runner = AgentRunner({}) | ||
4898 | 178 | self.assertEqual(runner.createOrGetApplication(), None) | ||
4899 | 179 | runner.application = 21 | ||
4900 | 180 | self.assertEqual(runner.createOrGetApplication(), 21) | ||
4901 | 181 | |||
4902 | 182 | def test_run(self): | ||
4903 | 183 | """Invokes the run class method on an agent. | ||
4904 | 184 | |||
4905 | 185 | This will create an agent instance, parse the cli args, passes them to | ||
4906 | 186 | the agent, and starts the agent runner. | ||
4907 | 187 | """ | ||
4908 | 188 | self.change_args( | ||
4909 | 189 | "es-agent", "--zookeeper-servers", get_test_zookeeper_address(), | ||
4910 | 190 | "--session-file", self.makeFile()) | ||
4911 | 191 | runner = self.mocker.patch(AgentRunner) | ||
4912 | 192 | runner.run() | ||
4913 | 193 | mock_agent = self.mocker.patch(BaseAgent) | ||
4914 | 194 | |||
4915 | 195 | def match_args(config): | ||
4916 | 196 | self.assertEqual(config["zookeeper_servers"], | ||
4917 | 197 | get_test_zookeeper_address()) | ||
4918 | 198 | return True | ||
4919 | 199 | |||
4920 | 200 | mock_agent.configure(MATCH(match_args)) | ||
4921 | 201 | self.mocker.passthrough() | ||
4922 | 202 | |||
4923 | 203 | self.mocker.replay() | ||
4924 | 204 | BaseAgent.run() | ||
4925 | 205 | |||
4926 | 206 | def test_full_run(self): | ||
4927 | 207 | """Verify a functional agent start via the 'run' method. | ||
4928 | 208 | |||
4929 | 209 | This test requires Zookeeper running on the default port of localhost. | ||
4930 | 210 | The mocked portions are to prevent the daemon start from altering the | ||
4931 | 211 | test environment (sys.stdout/sys.stderr, and reactor start). | ||
4932 | 212 | """ | ||
4933 | 213 | zookeeper.set_debug_level(0) | ||
4934 | 214 | started = Deferred() | ||
4935 | 215 | |||
4936 | 216 | class DummyAgent(BaseAgent): | ||
4937 | 217 | started = False | ||
4938 | 218 | |||
4939 | 219 | def start(self): | ||
4940 | 220 | started.callback(self) | ||
4941 | 221 | |||
4942 | 222 | def validate_started(agent): | ||
4943 | 223 | self.assertTrue(agent.client.connected) | ||
4944 | 224 | |||
4945 | 225 | started.addCallback(validate_started) | ||
4946 | 226 | |||
4947 | 227 | self.change_args( | ||
4948 | 228 | "es-agent", "--nodaemon", | ||
4949 | 229 | "--zookeeper-servers", get_test_zookeeper_address(), | ||
4950 | 230 | "--session-file", self.makeFile()) | ||
4951 | 231 | runner = self.mocker.patch(AgentRunner) | ||
4952 | 232 | logger = self.mocker.patch(AppLogger) | ||
4953 | 233 | logger.start(MATCH_APP) | ||
4954 | 234 | runner.startReactor(None, sys.stdout, sys.stderr) | ||
4955 | 235 | logger.stop() | ||
4956 | 236 | self.mocker.replay() | ||
4957 | 237 | DummyAgent.run() | ||
4958 | 238 | return started | ||
4959 | 239 | |||
4960 | 240 | @inlineCallbacks | ||
4961 | 241 | def test_stop_service_stub_closes_agent(self): | ||
4962 | 242 | """The base class agent, stopService will the stop method. | ||
4963 | 243 | |||
4964 | 244 | Additionally it will close the agent's zookeeper client if | ||
4965 | 245 | the client is still connected. | ||
4966 | 246 | """ | ||
4967 | 247 | mock_agent = self.mocker.patch(BaseAgent) | ||
4968 | 248 | mock_client = self.mocker.mock(ZookeeperClient) | ||
4969 | 249 | session_file = self.makeFile() | ||
4970 | 250 | |||
4971 | 251 | # connection is closed after agent.stop invoked. | ||
4972 | 252 | with self.mocker.order(): | ||
4973 | 253 | mock_agent.stop() | ||
4974 | 254 | self.mocker.passthrough() | ||
4975 | 255 | |||
4976 | 256 | # client existence check | ||
4977 | 257 | mock_agent.client | ||
4978 | 258 | self.mocker.result(mock_client) | ||
4979 | 259 | |||
4980 | 260 | # client connected check | ||
4981 | 261 | mock_agent.client | ||
4982 | 262 | self.mocker.result(mock_client) | ||
4983 | 263 | mock_client.connected | ||
4984 | 264 | self.mocker.result(True) | ||
4985 | 265 | |||
4986 | 266 | # client close | ||
4987 | 267 | mock_agent.client | ||
4988 | 268 | self.mocker.result(mock_client) | ||
4989 | 269 | mock_client.close() | ||
4990 | 270 | |||
4991 | 271 | # delete session file | ||
4992 | 272 | mock_agent.config | ||
4993 | 273 | self.mocker.result({"session_file": session_file}) | ||
4994 | 274 | |||
4995 | 275 | self.mocker.replay() | ||
4996 | 276 | |||
4997 | 277 | agent = BaseAgent() | ||
4998 | 278 | yield agent.stopService() | ||
4999 | 279 | self.assertFalse(os.path.exists(session_file)) | ||
5000 | 280 |
Ignoring the MP as unreadable: had a look at the branch debdiff with current:
1) postinst
Needs to set -e; also you should not set the alternatives manually:
update- alternatives --set juju $base_dir/ juju-$VER/ bin/juju
That's something for the end-user to decide; we just decide which is default based on relative priories of juju/go juju binaries.
3) postrm
rm -Rf /usr/lib/ python2. 7/dist- packages/ juju
That should not be required.
3) rules
Not really the correct way to change the version in the maintainer scripts:
override_ dh_builddeb: VERSION_ _/$(VER) /' debian/ juju/DEBIAN/ *
sed -i -e 's/__NEW_
dh_builddeb
This would be better done by renaming the maintainer scripts <script>.in and having some rules that generate the actual maintainer scripts before builddeb:
debian/ juju.postinst: debian/ juju.postinst. in VERSION_ _/$(VER) /g' $< > debian/ juju.postinst
sed -e "s/__NEW_
debian/juju.prerm: debian/ juju.prerm. in VERSION_ _/$(VER) /g' $< > debian/juju.prerm
sed -e "s/__NEW_
and then override dh_installdeb to get them to generate prior to debhelper installing them:
override_ dh_installdeb: debian/ juju.postinst debian/juju.prerm
dh_installdeb
Remember to add cleanup to remove the generated files as well.
4) manpages
Need to be covered by use of alternatives as well.
Should the resulting binary not be called juju-0.7 or something similar? Otherwise when you upgrade to 7.1, you will have to remove old alternatives.