-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Split agent changes * Define iosxe distro * Remove TAGS file * Move get_instance_id * Repair unintentional white space changes. * Fix syntax errors
- Loading branch information
1 parent
8b3e115
commit d30174d
Showing
8 changed files
with
252 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Microsoft Azure Linux Agent | ||
# | ||
# Copyright 2018 Microsoft Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Requires Python 2.6+ and Openssl 1.0+ | ||
# | ||
|
||
import azurelinuxagent.common.logger as logger | ||
import azurelinuxagent.common.utils.shellutil as shellutil | ||
from azurelinuxagent.common.osutil.default import DefaultOSUtil | ||
from azurelinuxagent.common.osutil.redhat import Redhat6xOSUtil | ||
|
||
''' | ||
The IOSXE distribution is a variant of the Centos distribution, | ||
version 7.1. | ||
The primary difference is that IOSXE makes some assumptions about | ||
the waagent environment: | ||
- only the waagent daemon is executed | ||
- no provisioning is performed | ||
- no DHCP-based services are available | ||
''' | ||
class IosxeOSUtil(DefaultOSUtil): | ||
def __init__(self): | ||
super(IosxeOSUtil, self).__init__() | ||
|
||
def set_hostname(self, hostname): | ||
""" | ||
Unlike redhat 6.x, redhat 7.x will set hostname via hostnamectl | ||
Due to a bug in systemd in Centos-7.0, if this call fails, fallback | ||
to hostname. | ||
""" | ||
hostnamectl_cmd = "hostnamectl set-hostname {0} --static".format(hostname) | ||
if shellutil.run(hostnamectl_cmd, chk_err=False) != 0: | ||
logger.warn("[{0}] failed, attempting fallback".format(hostnamectl_cmd)) | ||
DefaultOSUtil.set_hostname(self, hostname) | ||
|
||
def publish_hostname(self, hostname): | ||
""" | ||
Restart NetworkManager first before publishing hostname | ||
""" | ||
shellutil.run("service NetworkManager restart") | ||
super(RedhatOSUtil, self).publish_hostname(hostname) | ||
|
||
def register_agent_service(self): | ||
return shellutil.run("systemctl enable waagent", chk_err=False) | ||
|
||
def unregister_agent_service(self): | ||
return shellutil.run("systemctl disable waagent", chk_err=False) | ||
|
||
def openssl_to_openssh(self, input_file, output_file): | ||
DefaultOSUtil.openssl_to_openssh(self, input_file, output_file) | ||
|
||
def is_dhcp_available(self): | ||
return (False, '168.63.129.16') | ||
|
||
def get_instance_id(self): | ||
''' | ||
Azure records a UUID as the instance ID | ||
First check /sys/class/dmi/id/product_uuid. | ||
If that is missing, then extracts from dmidecode | ||
If nothing works (for old VMs), return the empty string | ||
''' | ||
if os.path.isfile(PRODUCT_ID_FILE): | ||
try: | ||
s = fileutil.read_file(PRODUCT_ID_FILE).strip() | ||
return self._correct_instance_id(s.strip()) | ||
except IOError: | ||
pass | ||
rc, s = shellutil.run_get_output(DMIDECODE_CMD) | ||
if rc != 0 or UUID_PATTERN.match(s) is None: | ||
return "" | ||
return self._correct_instance_id(s.strip()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
# | ||
# Microsoft Azure Linux Agent Configuration | ||
# | ||
|
||
# Enable instance creation | ||
Provisioning.Enabled=n | ||
|
||
# Rely on cloud-init to provision | ||
Provisioning.UseCloudInit=n | ||
|
||
# Password authentication for root account will be unavailable. | ||
Provisioning.DeleteRootPassword=y | ||
|
||
# Generate fresh host key pair. | ||
Provisioning.RegenerateSshHostKeyPair=n | ||
|
||
# Supported values are "rsa", "dsa", "ecdsa", "ed25519", and "auto". | ||
# The "auto" option is supported on OpenSSH 5.9 (2011) and later. | ||
Provisioning.SshHostKeyPairType=rsa | ||
|
||
# Monitor host name changes and publish changes via DHCP requests. | ||
Provisioning.MonitorHostName=n | ||
|
||
# Decode CustomData from Base64. | ||
Provisioning.DecodeCustomData=n | ||
|
||
# Execute CustomData after provisioning. | ||
Provisioning.ExecuteCustomData=n | ||
|
||
# Algorithm used by crypt when generating password hash. | ||
#Provisioning.PasswordCryptId=6 | ||
|
||
# Length of random salt used when generating password hash. | ||
#Provisioning.PasswordCryptSaltLength=10 | ||
|
||
# Allow reset password of sys user | ||
Provisioning.AllowResetSysUser=n | ||
|
||
# Format if unformatted. If 'n', resource disk will not be mounted. | ||
ResourceDisk.Format=n | ||
|
||
# File system on the resource disk | ||
# Typically ext3 or ext4. FreeBSD images should use 'ufs2' here. | ||
ResourceDisk.Filesystem=ext4 | ||
|
||
# Mount point for the resource disk | ||
ResourceDisk.MountPoint=/mnt/resource | ||
|
||
# Create and use swapfile on resource disk. | ||
ResourceDisk.EnableSwap=n | ||
|
||
# Size of the swapfile. | ||
ResourceDisk.SwapSizeMB=0 | ||
|
||
# Comma-seperated list of mount options. See man(8) for valid options. | ||
ResourceDisk.MountOptions=None | ||
|
||
# Enable verbose logging (y|n) | ||
Logs.Verbose=n | ||
|
||
# Is FIPS enabled | ||
OS.EnableFIPS=n | ||
|
||
# Root device timeout in seconds. | ||
OS.RootDeviceScsiTimeout=300 | ||
|
||
# If "None", the system default version is used. | ||
OS.OpensslPath=None | ||
|
||
# Set the SSH ClientAliveInterval | ||
# OS.SshClientAliveInterval=180 | ||
|
||
# Set the path to SSH keys and configuration files | ||
OS.SshDir=/etc/ssh | ||
|
||
# If set, agent will use proxy server to access internet | ||
#HttpProxy.Host=None | ||
#HttpProxy.Port=None | ||
|
||
# Detect Scvmm environment, default is n | ||
# DetectScvmmEnv=n | ||
|
||
# | ||
# Lib.Dir=/var/lib/waagent | ||
|
||
# | ||
# DVD.MountPoint=/mnt/cdrom/secure | ||
|
||
# | ||
# Pid.File=/var/run/waagent.pid | ||
|
||
# | ||
# Extension.LogDir=/var/log/azure | ||
|
||
# | ||
# Home.Dir=/home | ||
|
||
# Enable RDMA management and set up, should only be used in HPC images | ||
# OS.EnableRDMA=y | ||
|
||
# Enable or disable goal state processing auto-update, default is enabled | ||
AutoUpdate.Enabled=y | ||
|
||
# Determine the update family, this should not be changed | ||
# AutoUpdate.GAFamily=Prod | ||
|
||
# Determine if the overprovisioning feature is enabled. If yes, hold extension | ||
# handling until inVMArtifactsProfile.OnHold is false. | ||
# Default is enabled | ||
# EnableOverProvisioning=y | ||
|
||
# Allow fallback to HTTP if HTTPS is unavailable | ||
# Note: Allowing HTTP (vs. HTTPS) may cause security risks | ||
# OS.AllowHTTP=n | ||
|
||
# Add firewall rules to protect access to Azure host node services | ||
# Note: | ||
# - The default is false to protect the state of existing VMs | ||
OS.EnableFirewall=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters