Run sudo_chown() and sudo_chmod() on remote_path. If owner or mode is None, their corresponding function is not called.
sudo mkdir -p <remote_path> followed by :func:`sudo_chattr`(remote_path, **chattr_kw).
Upload all files and directories in local_dir to remote_dir. Directories are created with sudo_mkdir_p() and files are uploaded with sudo_upload_file(). chattr_kw is forwarded in both cases.
Use sudo to upload a file from local_path to remote_path and run sudo_chattr() with the given chattr_kw as arguments.
Create a tempfile containing string_to_upload, and use sudo_upload_file() to upload the tempfile. Removes the tempfile when the upload is complete or if it fails.
Parameters: |
|
---|
Ubuntu utilities.
Bases: exceptions.Exception
Raised when we fail to connect to a region.
Bases: exceptions.Exception
Raises when wait_for_state() times out.
Bases: object
Wraps a boto.ec2.instance.Instance with convenience functions.
Variables: | instance – The boto.ec2.instance.Instance. |
---|---|
Parameters: | instance – A boto.ec2.instance.Instance object. |
Add self to fabric.api.env.ec2instances[self.get_ssh_uri()], and register the key-pair for the instance in fabric.api.env.key_filename.
Connect to AWS and get the EC2 instance with the given instance ID.
Parameters: | instanceid_with_optional_region – Parsed with parse_instanceid() to find the region and name. |
---|---|
Raises: |
|
Returns: | A Ec2InstanceWrapper contaning the requested instance. |
Connect to AWS and get the EC2 instance with the given Name-tag.
Parameters: | instancename_with_optional_region – Parsed with parse_instancename() to find the region and name. |
---|---|
Raises: |
|
Returns: | A Ec2InstanceWrapper contaning the requested instance. |
Connect to AWS and get the EC2 instance with the given tag:value pairs.
Parameters: | region – optional. |
---|---|
Raises: |
|
Returns: | A list of :class:`Ec2InstanceWrapper`s containing the matching instances. |
If an instance has been registered in fabric.api.env using add_instance_to_env(), this method can be used to get the instance identified by fabric.api.env.host_string.
Get the SSH indentify filename (.pem-file) for the instance. Searches awsfab_settings.KEYPAIR_PATH for "<instance.key_name>.pem".
Raises LookupError: | |
---|---|
If the key is not found. |
Create a /etc/hosts file from the list of nametags. The result will be a hostsfile with private_ip_address as IP, and nametag+suffix as hostname.
rsync local_dir into remote_dir on the current EC2 instance (the one returned by Ec2InstanceWrapper.get_from_host_string()).
Parameters: | sync_content – Normally the function automatically makes sure local_dir is not suffixed with /, which makes rsync copy local_dir into remote_dir. With sync_content=True, the content of local_dir is synced into remote_dir instead. |
---|
Parse instance id with an optional region-name prefixed. Region name is specified by prefixing the instanceid with <regionname>:.
Returns: | (region, instanceid) where region defaults to awsfab_settings.DEFAULT_REGION if not prefixed to the id. |
---|
Just like parse_instanceid(), however this is for instance names. We keep them as separate functions in case they diverge in the future.
Returns: | (region, instanceid) where region defaults to awsfab_settings.DEFAULT_REGION if not prefixed to the name. |
---|
Print attributes of an ec2 instance.
Parameters: |
|
---|
Shortcut for wait_for_state(instanceid, 'running', **kwargs).
Poll the instance with instanceid until its state_name matches the desired state_name.
The first poll is performed without any delay, and the rest of the polls are performed according to sleep_intervals.
Parameters: |
|
---|