eod status 04-07-2012

Frank Mueller frank.mueller at canonical.com
Wed Jul 4 20:44:34 UTC 2012


Hi all,

yeah, got it. The code for the new cmd/firewall.go looks fine now and I think it's also good maintainable with its four different watcher types. So now I can start testing it. But before I had to solve a problem that's now postponed with a workaround. Today in state/firewall.py, line 281 a machine is retrieved from the provider. This machine is in the Go port environs.Instance and is returned as slice via environs.Environ.Instances(). The instance is only used to retrieve the current open ports, to open ports and to close ports. Right now we don't have the according methods, AFAIK this topic is still in discussion.

In my workaround I don't pass an environment (as the successor of the provider) to the firewall. Instead I defined

// Ports is a list of ports.
type Ports []state.Port

and

// PortManager defines the interface for the component
// responsible for the management of the ports on the
// instances and machines.
type PortManager interface {
	// OpenPorts returns the current open ports of the 
	// machine on the instance.
	OpenPorts(instanceId string, machineId int) (Ports, error)
	// OpenPort opens the passed port on the machine and instance.
	OpenPort(instanceId string, machineId int, port state.Port) error
	// ClosePort closes the passed port on the machine and instance.
	ClosePort(instanceId string, machineId int, port state.Port) error
}

and pass this. So any future solution just can implement this interface and it should work. For my tests I can define a mock as a first step.

CU mue

--
** Frank Mueller <frank.mueller at canonical.com>
** Software Engineer - Juju Development
** Canonical




More information about the Juju-dev mailing list