Skip to content

Instantly share code, notes, and snippets.

@bradthurber
Created May 12, 2015 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradthurber/397d1eeef77c299f5007 to your computer and use it in GitHub Desktop.
Save bradthurber/397d1eeef77c299f5007 to your computer and use it in GitHub Desktop.
salt-cloud AssocatePublicIpAddress not working
On Amazon EC2 cloud and running salt 2015.5.0 on the master - I'm having trouble getting salt-cloud to create an instance with a public ip in a VPC. I'm using AssociatePublicIpAddress: True - see Gist I noticed in salt-cloud ec2.py source a comment "Associating a public address in a VPC only works when the interface is not created beforehand, but as a part of the machine creation request". Not sure what this means. Is there specific syntax for doing this?
Command:
salt-cloud -p ec2-us-east-karpoc-web-centos6 centos6-web-debug2 -l debug > salt-cloud2.log 2>&1
# centos6 web
ec2-us-east-karpoc-web-centos6:
provider: my-ec2-karpoc-us-east-1
network_interfaces:
- DeviceIndex: 0
allocate_new_eip: False
AssociatePublicIpAddress: True
PrivateIpAddresses:
- Primary: True
SubnetId: subnet-94ddd7fb
SecurityGroupId:
- sg-7e88d21a
image: ami-c2a818aa
size: t2.micro
ssh_interface: private_ips
ssh_username: root
sync_after_install: grains
tag: {
'contact': 'Brad Thurber (brad.thurber@gmail.com)',
'group': 'karpoc',
'role': 'webserver'
}
[DEBUG ] Missing configuration file: /etc/salt/cloud
[DEBUG ] Reading configuration from /etc/salt/master
[DEBUG ] Using cached minion ID from /etc/salt/minion_id: ip-10-139-1-82.ec2.internal
[DEBUG ] Missing configuration file: /etc/salt/cloud.providers
[DEBUG ] Including configuration from '/etc/salt/cloud.providers.d/my_ec2_bet_us_east_1.conf'
[DEBUG ] Reading configuration from /etc/salt/cloud.providers.d/my_ec2_bet_us_east_1.conf
[DEBUG ] Including configuration from '/etc/salt/cloud.providers.d/my_ec2_karpoc_us_east_1.conf'
[DEBUG ] Reading configuration from /etc/salt/cloud.providers.d/my_ec2_karpoc_us_east_1.conf
[DEBUG ] Missing configuration file: /etc/salt/cloud.profiles
[DEBUG ] Including configuration from '/etc/salt/cloud.profiles.d/ec2-east-free-private.conf'
[DEBUG ] Reading configuration from /etc/salt/cloud.profiles.d/ec2-east-free-private.conf
[DEBUG ] Including configuration from '/etc/salt/cloud.profiles.d/ec2-east-karpoc-web.conf'
[DEBUG ] Reading configuration from /etc/salt/cloud.profiles.d/ec2-east-karpoc-web.conf
[DEBUG ] Configuration file path: /etc/salt/master
[INFO ] salt-cloud starting
[DEBUG ] Failed to import clouds joyent:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/salt/loader.py", line 951, in _load_module
), fn_, fpath, desc)
File "/usr/lib/python2.6/site-packages/salt/cloud/clouds/joyent.py", line 68, in <module>
from Crypto.Signature import PKCS1_v1_5
ImportError: No module named Signature
[DEBUG ] Could not LazyLoad parallels.avail_sizes
[DEBUG ] LazyLoaded parallels.avail_locations
[DEBUG ] LazyLoaded proxmox.avail_sizes
[DEBUG ] Could not LazyLoad saltify.destroy
[DEBUG ] Could not LazyLoad saltify.avail_sizes
[DEBUG ] Could not LazyLoad saltify.avail_images
[DEBUG ] Could not LazyLoad saltify.avail_locations
[DEBUG ] LazyLoaded rackspace.reboot
[DEBUG ] LazyLoaded openstack.list_locations
[DEBUG ] LazyLoaded rackspace.list_locations
[DEBUG ] Failed to import clouds joyent:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/salt/loader.py", line 951, in _load_module
), fn_, fpath, desc)
File "/usr/lib/python2.6/site-packages/salt/cloud/clouds/joyent.py", line 68, in <module>
from Crypto.Signature import PKCS1_v1_5
ImportError: No module named Signature
[DEBUG ] Failed to import clouds joyent:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/salt/loader.py", line 951, in _load_module
), fn_, fpath, desc)
File "/usr/lib/python2.6/site-packages/salt/cloud/clouds/joyent.py", line 68, in <module>
from Crypto.Signature import PKCS1_v1_5
ImportError: No module named Signature
[DEBUG ] Could not LazyLoad parallels.avail_sizes
[DEBUG ] LazyLoaded parallels.avail_locations
[DEBUG ] LazyLoaded proxmox.avail_sizes
[DEBUG ] Could not LazyLoad saltify.destroy
[DEBUG ] Could not LazyLoad parallels.avail_sizes
[DEBUG ] LazyLoaded parallels.avail_locations
[DEBUG ] LazyLoaded proxmox.avail_sizes
[DEBUG ] Could not LazyLoad saltify.destroy
[DEBUG ] Could not LazyLoad saltify.avail_sizes
[DEBUG ] Could not LazyLoad saltify.avail_images
[DEBUG ] Could not LazyLoad saltify.avail_locations
[DEBUG ] LazyLoaded rackspace.reboot
[DEBUG ] LazyLoaded openstack.list_locations
[DEBUG ] LazyLoaded rackspace.list_locations
[DEBUG ] Using AWS endpoint: ec2.us-east-1.amazonaws.com
[DEBUG ] Could not LazyLoad saltify.avail_sizes
[DEBUG ] Could not LazyLoad saltify.avail_images
[DEBUG ] Could not LazyLoad saltify.avail_locations
[DEBUG ] LazyLoaded rackspace.reboot
[DEBUG ] LazyLoaded openstack.list_locations
[DEBUG ] LazyLoaded rackspace.list_locations
[DEBUG ] Using AWS endpoint: ec2.us-east-1.amazonaws.com
[DEBUG ] AWS Request: https://ec2.us-east-1.amazonaws.com/?Action=DescribeInstances&Version=2014-10-01
[DEBUG ] AWS Request: https://ec2.us-east-1.amazonaws.com/?Action=DescribeInstances&Version=2014-10-01
[INFO ] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
[INFO ] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
[DEBUG ] "GET /?Action=DescribeInstances&Version=2014-10-01 HTTP/1.1" 200 None
[DEBUG ] AWS Response Status Code: 200
[DEBUG ] "GET /?Action=DescribeInstances&Version=2014-10-01 HTTP/1.1" 200 None
[DEBUG ] AWS Response Status Code: 200
[DEBUG ] Generating minion keys for 'centos6-web-debug2'
[DEBUG ] MasterEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc
[DEBUG ] MasterEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc
[DEBUG ] Sending event - data = {'_stamp': '2015-05-12T16:06:00.122625'}
[DEBUG ] Sending event - data = {'profile': 'ec2-us-east-karpoc-web-centos6', 'event': 'starting create', '_stamp': '2015-05-12T16:06:00.123825', 'name': 'centos6-web-debug2', 'provider': 'my-ec2-karpoc-us-east-1:ec2'}
[INFO ] Creating Cloud VM centos6-web-debug2 in us-east-1
[DEBUG ] Create network interface: {'DeviceIndex': 0, 'allocate_new_eip': False, 'SecurityGroupId': ['sg-7e88d21a'], 'PrivateIpAddresses': [{'Primary': True}], 'SubnetId': 'subnet-94ddd7fb', 'AssociatePublicIpAddress': True}
[DEBUG ] Using AWS endpoint: ec2.us-east-1.amazonaws.com
[DEBUG ] AWS Request: https://ec2.us-east-1.amazonaws.com/?Action=DescribeSubnets&Version=2014-10-01
[INFO ] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
[DEBUG ] "GET /?Action=DescribeSubnets&Version=2014-10-01 HTTP/1.1" 200 None
[DEBUG ] AWS Response Status Code: 200
[DEBUG ] Using AWS endpoint: ec2.us-east-1.amazonaws.com
[DEBUG ] AWS Request: https://ec2.us-east-1.amazonaws.com/?Action=CreateNetworkInterface&PrivateIpAddresses.0.Primary=true&SecurityGroupId.0=sg-7e88d21a&SubnetId=subnet-94ddd7fb&Version=2014-10-01
[INFO ] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
[DEBUG ] "GET /?Action=CreateNetworkInterface&PrivateIpAddresses.0.Primary=true&SecurityGroupId.0=sg-7e88d21a&SubnetId=subnet-94ddd7fb&Version=2014-10-01 HTTP/1.1" 200 None
[DEBUG ] AWS Response Status Code: 200
[DEBUG ] Created network interface eni-3ae0a972 inst 0
[DEBUG ] MasterEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc
[DEBUG ] MasterEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc
[DEBUG ] Sending event - data = {'_stamp': '2015-05-12T16:06:00.380505'}
[DEBUG ] Sending event - data = {'event': 'requesting instance', '_stamp': '2015-05-12T16:06:00.381710', 'location': 'us-east-1', 'kwargs': {'NetworkInterface.0.DeviceIndex': 0, 'ImageId': 'ami-c2a818aa', 'KeyName': 'karpoc', 'MaxCount': 1, 'Action': 'RunInstances', 'MinCount': 1, 'NetworkInterface.0.NetworkInterfaceId': 'eni-3ae0a972', 'InstanceType': 't2.micro'}}
[DEBUG ] Using AWS endpoint: ec2.us-east-1.amazonaws.com
[DEBUG ] AWS Request: https://ec2.us-east-1.amazonaws.com/?Action=RunInstances&ImageId=ami-c2a818aa&InstanceType=t2.micro&KeyName=karpoc&MaxCount=1&MinCount=1&NetworkInterface.0.DeviceIndex=0&NetworkInterface.0.NetworkInterfaceId=eni-3ae0a972&Version=2014-10-01
[INFO ] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
[DEBUG ] "GET /?Action=RunInstances&ImageId=ami-c2a818aa&InstanceType=t2.micro&KeyName=karpoc&MaxCount=1&MinCount=1&NetworkInterface.0.DeviceIndex=0&NetworkInterface.0.NetworkInterfaceId=eni-3ae0a972&Version=2014-10-01 HTTP/1.1" 200 None
[DEBUG ] AWS Response Status Code: 200
[DEBUG ] MasterEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc
[DEBUG ] MasterEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc
[DEBUG ] Sending event - data = {'_stamp': '2015-05-12T16:06:01.112874'}
[DEBUG ] Sending event - data = {'instance_id': 'i-a1b18f5c', '_stamp': '2015-05-12T16:06:01.114142', 'event': 'querying instance'}
[DEBUG ] The new VM instance_id is i-a1b18f5c
[DEBUG ] Using AWS endpoint: ec2.us-east-1.amazonaws.com
[DEBUG ] AWS Request: https://ec2.us-east-1.amazonaws.com/?Action=DescribeInstances&InstanceId.1=i-a1b18f5c&Version=2014-10-01
[INFO ] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
[DEBUG ] "GET /?Action=DescribeInstances&InstanceId.1=i-a1b18f5c&Version=2014-10-01 HTTP/1.1" 200 None
[DEBUG ] AWS Response Status Code: 200
[DEBUG ] The query returned: [{'ownerId': '556623927052', 'groupSet': None, 'reservationId': 'r-ad100047', 'instancesSet': {'item': {'productCodes': {'item': {'productCode': '6x5jmcajty9edm3f211pqjfn2', 'type': 'marketplace'}}, 'vpcId': 'vpc-9bddd7f4', 'instanceId': 'i-a1b18f5c', 'imageId': 'ami-c2a818aa', 'keyName': 'karpoc', 'clientToken': None, 'subnetId': 'subnet-94ddd7fb', 'amiLaunchIndex': '0', 'instanceType': 't2.micro', 'groupSet': {'item': {'groupName': 'karpoc ssh http https', 'groupId': 'sg-7e88d21a'}}, 'monitoring': {'state': 'disabled'}, 'dnsName': None, 'privateIpAddress': '10.139.1.233', 'virtualizationType': 'hvm', 'privateDnsName': 'ip-10-139-1-233.ec2.internal', 'reason': None, 'sourceDestCheck': 'true', 'blockDeviceMapping': None, 'placement': {'groupName': None, 'tenancy': 'default', 'availabilityZone': 'us-east-1a'}, 'instanceState': {'code': '0', 'name': 'pending'}, 'networkInterfaceSet': {'item': {'status': 'in-use', 'macAddress': '0a:7b:4b:52:5f:23', 'sourceDestCheck': 'true', 'vpcId': 'vpc-9bddd7f4', 'description': None, 'networkInterfaceId': 'eni-3ae0a972', 'privateDnsName': 'ip-10-139-1-233.ec2.internal', 'groupSet': {'item': {'groupName': 'karpoc ssh http https', 'groupId': 'sg-7e88d21a'}}, 'attachment': {'status': 'attaching', 'deviceIndex': '0', 'deleteOnTermination': 'false', 'attachmentId': 'eni-attach-d71d91b2', 'attachTime': '2015-05-12T16:05:59.000Z'}, 'subnetId': 'subnet-94ddd7fb', 'ownerId': '556623927052', 'privateIpAddressesSet': {'item': {'privateDnsName': 'ip-10-139-1-233.ec2.internal', 'primary': 'true', 'privateIpAddress': '10.139.1.233'}}, 'privateIpAddress': '10.139.1.233'}}, 'ebsOptimized': 'false', 'launchTime': '2015-05-12T16:05:59.000Z', 'architecture': 'x86_64', 'hypervisor': 'xen', 'rootDeviceType': 'ebs', 'rootDeviceName': '/dev/sda1'}}}]
[DEBUG ] Waiting for VM IP. Giving up in 00:10:00
[DEBUG ] Using AWS endpoint: ec2.us-east-1.amazonaws.com
[DEBUG ] AWS Request: https://ec2.us-east-1.amazonaws.com/?Action=DescribeInstances&InstanceId.1=i-a1b18f5c&Version=2014-10-01
[INFO ] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
[DEBUG ] "GET /?Action=DescribeInstances&InstanceId.1=i-a1b18f5c&Version=2014-10-01 HTTP/1.1" 200 None
[DEBUG ] AWS Response Status Code: 200
[DEBUG ] Returned query data: [{'ownerId': '556623927052', 'groupSet': None, 'reservationId': 'r-ad100047', 'instancesSet': {'item': {'productCodes': {'item': {'productCode': '6x5jmcajty9edm3f211pqjfn2', 'type': 'marketplace'}}, 'vpcId': 'vpc-9bddd7f4', 'instanceId': 'i-a1b18f5c', 'imageId': 'ami-c2a818aa', 'keyName': 'karpoc', 'clientToken': None, 'subnetId': 'subnet-94ddd7fb', 'amiLaunchIndex': '0', 'instanceType': 't2.micro', 'groupSet': {'item': {'groupName': 'karpoc ssh http https', 'groupId': 'sg-7e88d21a'}}, 'monitoring': {'state': 'disabled'}, 'dnsName': None, 'privateIpAddress': '10.139.1.233', 'virtualizationType': 'hvm', 'privateDnsName': 'ip-10-139-1-233.ec2.internal', 'reason': None, 'sourceDestCheck': 'true', 'blockDeviceMapping': None, 'placement': {'groupName': None, 'tenancy': 'default', 'availabilityZone': 'us-east-1a'}, 'instanceState': {'code': '0', 'name': 'pending'}, 'networkInterfaceSet': {'item': {'status': 'in-use', 'macAddress': '0a:7b:4b:52:5f:23', 'sourceDestCheck': 'true', 'vpcId': 'vpc-9bddd7f4', 'description': None, 'networkInterfaceId': 'eni-3ae0a972', 'privateDnsName': 'ip-10-139-1-233.ec2.internal', 'groupSet': {'item': {'groupName': 'karpoc ssh http https', 'groupId': 'sg-7e88d21a'}}, 'attachment': {'status': 'attaching', 'deviceIndex': '0', 'deleteOnTermination': 'false', 'attachmentId': 'eni-attach-d71d91b2', 'attachTime': '2015-05-12T16:05:59.000Z'}, 'subnetId': 'subnet-94ddd7fb', 'ownerId': '556623927052', 'privateIpAddressesSet': {'item': {'privateDnsName': 'ip-10-139-1-233.ec2.internal', 'primary': 'true', 'privateIpAddress': '10.139.1.233'}}, 'privateIpAddress': '10.139.1.233'}}, 'ebsOptimized': 'false', 'launchTime': '2015-05-12T16:05:59.000Z', 'architecture': 'x86_64', 'hypervisor': 'xen', 'rootDeviceType': 'ebs', 'rootDeviceName': '/dev/sda1'}}}]
[DEBUG ] MasterEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc
[DEBUG ] MasterEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc
[DEBUG ] Sending event - data = {'_stamp': '2015-05-12T16:06:01.428138'}
[DEBUG ] Sending event - data = {'_stamp': '2015-05-12T16:06:01.429422', 'event': 'setting tags', 'tags': {'contact': 'Brad Thurber (brad.thurber@gmail.com)', 'group': 'karpoc', 'Name': 'centos6-web-debug2', 'role': 'webserver'}}
[DEBUG ] Tags to set for centos6-web-debug2: {'contact': 'Brad Thurber (brad.thurber@gmail.com)', 'group': 'karpoc', 'Name': 'centos6-web-debug2', 'role': 'webserver'}
[DEBUG ] Using AWS endpoint: ec2.us-east-1.amazonaws.com
[DEBUG ] AWS Request: https://ec2.us-east-1.amazonaws.com/?Action=CreateTags&ResourceId.1=i-a1b18f5c&Tag.0.Key=contact&Tag.0.Value=Brad%20Thurber%20%28brad.thurber%40gmail.com%29&Tag.1.Key=group&Tag.1.Value=karpoc&Tag.2.Key=Name&Tag.2.Value=centos6-web-debug2&Tag.3.Key=role&Tag.3.Value=webserver&Version=2014-10-01
[INFO ] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
[DEBUG ] "GET /?Action=CreateTags&ResourceId.1=i-a1b18f5c&Tag.0.Key=contact&Tag.0.Value=Brad%20Thurber%20%28brad.thurber%40gmail.com%29&Tag.1.Key=group&Tag.1.Value=karpoc&Tag.2.Key=Name&Tag.2.Value=centos6-web-debug2&Tag.3.Key=role&Tag.3.Value=webserver&Version=2014-10-01 HTTP/1.1" 200 None
[DEBUG ] AWS Response Status Code: 200
[DEBUG ] Using AWS endpoint: ec2.us-east-1.amazonaws.com
[DEBUG ] AWS Request: https://ec2.us-east-1.amazonaws.com/?Action=DescribeTags&Filter.1.Name=resource-id&Filter.1.Value=i-a1b18f5c&Version=2014-10-01
[INFO ] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
[DEBUG ] "GET /?Action=DescribeTags&Filter.1.Name=resource-id&Filter.1.Value=i-a1b18f5c&Version=2014-10-01 HTTP/1.1" 200 None
[DEBUG ] AWS Response Status Code: 200
[DEBUG ] Setting the tags returned: [{'resourceType': 'instance', 'resourceId': 'i-a1b18f5c', 'value': 'karpoc', 'key': 'group'}, {'resourceType': 'instance', 'resourceId': 'i-a1b18f5c', 'value': 'Brad Thurber (brad.thurber@gmail.com)', 'key': 'contact'}, {'resourceType': 'instance', 'resourceId': 'i-a1b18f5c', 'value': 'webserver', 'key': 'role'}, {'resourceType': 'instance', 'resourceId': 'i-a1b18f5c', 'value': 'centos6-web-debug2', 'key': 'Name'}]
[DEBUG ] Using AWS endpoint: ec2.us-east-1.amazonaws.com
[DEBUG ] AWS Request: https://ec2.us-east-1.amazonaws.com/?Action=ModifyNetworkInterfaceAttribute&Attachment.AttachmentId=eni-attach-d71d91b2&Attachment.DeleteOnTermination=True&NetworkInterfaceId=eni-3ae0a972&Version=2014-10-01
[INFO ] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
[DEBUG ] "GET /?Action=ModifyNetworkInterfaceAttribute&Attachment.AttachmentId=eni-attach-d71d91b2&Attachment.DeleteOnTermination=True&NetworkInterfaceId=eni-3ae0a972&Version=2014-10-01 HTTP/1.1" 200 None
[DEBUG ] AWS Response Status Code: 200
[INFO ] Created node centos6-web-debug2
[INFO ] Salt node data. Private_ip: 10.139.1.233
[INFO ] Salt interface set to: 10.139.1.233
[DEBUG ] MasterEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc
[DEBUG ] MasterEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc
[DEBUG ] Sending event - data = {'_stamp': '2015-05-12T16:06:02.201601'}
[DEBUG ] Sending event - data = {'_stamp': '2015-05-12T16:06:02.202820', 'ip_address': '10.139.1.233', 'event': 'waiting for ssh'}
[DEBUG ] Attempting connection to host 10.139.1.233 on port 22
[DEBUG ] Caught exception in wait_for_port: [Errno 113] No route to host
[DEBUG ] Retrying connection to host 10.139.1.233 on port 22 (try 1)
[DEBUG ] Caught exception in wait_for_port: timed out
[DEBUG ] Retrying connection to host 10.139.1.233 on port 22 (try 2)
[DEBUG ] Caught exception in wait_for_port: timed out
[DEBUG ] Retrying connection to host 10.139.1.233 on port 22 (try 3)
[DEBUG ] Caught exception in wait_for_port: [Errno 111] Connection refused
[DEBUG ] Retrying connection to host 10.139.1.233 on port 22 (try 4)
[DEBUG ] Caught exception in wait_for_port: [Errno 111] Connection refused
[DEBUG ] Retrying connection to host 10.139.1.233 on port 22 (try 5)
[DEBUG ] Using /etc/salt/cloud.providers.d/karpoc.pem as the key_filename
[DEBUG ] Attempting to authenticate as root (try 1 of 15)
[DEBUG ] SSH command: 'ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 date'
[DEBUG ] Child Forked! PID: 11384 STDOUT_FD: 4 STDERR_FD: 6
[DEBUG ] Terminal Command: /bin/sh -c ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 date
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
[DEBUG ] Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
[DEBUG ] Using /etc/salt/cloud.providers.d/karpoc.pem as the key_filename
[DEBUG ] Attempting to authenticate as root (try 2 of 15)
[DEBUG ] SSH command: 'ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 date'
[DEBUG ] Child Forked! PID: 11410 STDOUT_FD: 4 STDERR_FD: 6
[DEBUG ] Terminal Command: /bin/sh -c ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 date
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
[DEBUG ] Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
[DEBUG ] Using /etc/salt/cloud.providers.d/karpoc.pem as the key_filename
[DEBUG ] Attempting to authenticate as root (try 3 of 15)
[DEBUG ] SSH command: 'ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 date'
[DEBUG ] Child Forked! PID: 11444 STDOUT_FD: 4 STDERR_FD: 6
[DEBUG ] Terminal Command: /bin/sh -c ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 date
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
[DEBUG ] Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
Tue May 12 16:07:20 UTC 2015
[DEBUG ] Tue May 12 16:07:20 UTC 2015
[INFO ] Rendering deploy script: /usr/lib/python2.6/site-packages/salt/cloud/deploy/bootstrap-salt.sh
[DEBUG ] MasterEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc
[DEBUG ] MasterEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc
[DEBUG ] Sending event - data = {'_stamp': '2015-05-12T16:07:24.536915'}
[DEBUG ] Sending event - data = {'_stamp': '2015-05-12T16:07:24.538101', 'event': 'executing deploy script', 'kwargs': {'tty': True, 'key_filename': '/etc/salt/cloud.providers.d/karpoc.pem', 'start_action': None, 'make_minion': True, 'tmp_dir': '/tmp/.saltcloud', 'gateway': None, 'deploy_command': '/tmp/.saltcloud/deploy.sh', 'script': '#!/bin/sh -\n#======================================================================================================================\n# vim: softtabstop=4 shiftwidth=4 expandtab fenc=utf-8 spell spelllang=en cc=120\n#======================================================================================================================\n#\n# FILE: bootstrap-salt.sh\n#\n# DESCRIPTION: Bootstrap salt installation for various systems/distributions\n#\n# BUGS: https://github.com/saltstack/salt-bootstrap/issues\n#\n# COPYRIGHT: (c) 2012-2014 by the SaltStack Team, see AUTHORS.rst for more\n# details.\n#\n# LICENSE: Apache 2.0\n# ORGANIZATION: SaltStack (saltstack.org)\n# CREATED: 10/15/2012 09:49:37 PM WEST\n#======================================================================================================================\nset -o nounset # Treat unset variables as an error\n__ScriptVersion="2015.05.04"\n__ScriptName="bootstrap-salt.sh"\n\n#======================================================================================================================\n# Environment variables taken into account.\n#----------------------------------------------------------------------------------------------------------------------\n# * BS_COLORS: If 0 disables colour support\n# * BS_PIP_ALLOWED: If 1 enable pip based installations(if needed)\n# * BS_ECHO_DEBUG: If 1 enable debug echo which can also be set by -D\n# * BS_SALT_ETC_DIR: Defaults to /etc/salt (Only tweak\'able on git based installations)\n# * BS_KEEP_TEMP_FILES: If 1, don\'t move temporary files, instead copy them\n# * BS_FORCE_OVERWRITE: Force overriding copied files(config, init.d, etc)\n# * BS_UPGRADE_SYS: If 1 and an option, upgrade system. Default 0.\n# * BS_GENTOO_USE_BINHOST: If 1 add `--getbinpkg` to gentoo\'s emerge\n# * BS_SALT_MASTER_ADDRESS: The IP or DNS name of the salt-master the minion should connect to\n# * BS_SALT_GIT_CHECKOUT_DIR: The directory where to clone Salt on git installations\n#======================================================================================================================\n\n\n#======================================================================================================================\n# LET THE BLACK MAGIC BEGIN!!!!\n#======================================================================================================================\n\n\n# Bootstrap script truth values\nBS_TRUE=1\nBS_FALSE=0\n\n# Default sleep time used when waiting for daemons to start, restart and checking for these running\n__DEFAULT_SLEEP=3\n__DEFAULT_SLEEP_ORIGINAL="${__DEFAULT_SLEEP}"\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __detect_color_support\n# DESCRIPTION: Try to detect color support.\n#----------------------------------------------------------------------------------------------------------------------\n_COLORS=${BS_COLORS:-$(tput colors 2>/dev/null || echo 0)}\n__detect_color_support() {\n if [ $? -eq 0 ] && [ "$_COLORS" -gt 2 ]; then\n RC="\\033[1;31m"\n GC="\\033[1;32m"\n BC="\\033[1;34m"\n YC="\\033[1;33m"\n EC="\\033[0m"\n else\n RC=""\n GC=""\n BC=""\n YC=""\n EC=""\n fi\n}\n__detect_color_support\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: echoerr\n# DESCRIPTION: Echo errors to stderr.\n#----------------------------------------------------------------------------------------------------------------------\nechoerror() {\n printf "${RC} * ERROR${EC}: %s\\n" "$@" 1>&2;\n}\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: echoinfo\n# DESCRIPTION: Echo information to stdout.\n#----------------------------------------------------------------------------------------------------------------------\nechoinfo() {\n printf "${GC} * INFO${EC}: %s\\n" "$@";\n}\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: echowarn\n# DESCRIPTION: Echo warning information to stdout.\n#----------------------------------------------------------------------------------------------------------------------\nechowarn() {\n printf "${YC} * WARN${EC}: %s\\n" "$@";\n}\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: echodebug\n# DESCRIPTION: Echo debug information to stdout.\n#----------------------------------------------------------------------------------------------------------------------\nechodebug() {\n if [ "$_ECHO_DEBUG" -eq $BS_TRUE ]; then\n printf "${BC} * DEBUG${EC}: %s\\n" "$@";\n fi\n}\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: check_pip_allowed\n# DESCRIPTION: Simple function to let the users know that -P needs to be\n# used.\n#----------------------------------------------------------------------------------------------------------------------\ncheck_pip_allowed() {\n if [ $# -eq 1 ]; then\n _PIP_ALLOWED_ERROR_MSG=$1\n else\n _PIP_ALLOWED_ERROR_MSG="pip based installations were not allowed. Retry using \'-P\'"\n fi\n\n if [ "$_PIP_ALLOWED" -eq $BS_FALSE ]; then\n echoerror "$_PIP_ALLOWED_ERROR_MSG"\n usage\n exit 1\n fi\n}\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __check_config_dir\n# DESCRIPTION: Checks the config directory, retrieves URLs if provided.\n#----------------------------------------------------------------------------------------------------------------------\n__check_config_dir() {\n CC_DIR_NAME="$1"\n CC_DIR_BASE=$(basename "${CC_DIR_NAME}")\n\n case "$CC_DIR_NAME" in\n http://*|https://*)\n __fetch_url "/tmp/${CC_DIR_BASE}" "${CC_DIR_NAME}"\n CC_DIR_NAME="/tmp/${CC_DIR_BASE}"\n ;;\n ftp://*)\n __fetch_url "/tmp/${CC_DIR_BASE}" "${CC_DIR_NAME}"\n CC_DIR_NAME="/tmp/${CC_DIR_BASE}"\n ;;\n *)\n if [ ! -e "${CC_DIR_NAME}" ]; then\n echo "null"\n return 0\n fi\n ;;\n esac\n\n case "$CC_DIR_NAME" in\n *.tgz|*.tar.gz)\n tar -zxf "${CC_DIR_NAME}" -C /tmp\n CC_DIR_BASE=$(basename "${CC_DIR_BASE}" ".tgz")\n CC_DIR_BASE=$(basename "${CC_DIR_BASE}" ".tar.gz")\n CC_DIR_NAME="/tmp/${CC_DIR_BASE}"\n ;;\n *.tbz|*.tar.bz2)\n tar -xjf "${CC_DIR_NAME}" -C /tmp\n CC_DIR_BASE=$(basename "${CC_DIR_BASE}" ".tbz")\n CC_DIR_BASE=$(basename "${CC_DIR_BASE}" ".tar.bz2")\n CC_DIR_NAME="/tmp/${CC_DIR_BASE}"\n ;;\n *.txz|*.tar.xz)\n tar -xJf "${CC_DIR_NAME}" -C /tmp\n CC_DIR_BASE=$(basename "${CC_DIR_BASE}" ".txz")\n CC_DIR_BASE=$(basename "${CC_DIR_BASE}" ".tar.xz")\n CC_DIR_NAME="/tmp/${CC_DIR_BASE}"\n ;;\n esac\n\n echo "${CC_DIR_NAME}"\n}\n\n\n#----------------------------------------------------------------------------------------------------------------------\n# Handle command line arguments\n#----------------------------------------------------------------------------------------------------------------------\n_KEEP_TEMP_FILES=${BS_KEEP_TEMP_FILES:-$BS_FALSE}\n_TEMP_CONFIG_DIR="null"\n_SALTSTACK_REPO_URL="git://github.com/saltstack/salt.git"\n_SALT_REPO_URL=${_SALTSTACK_REPO_URL}\n_TEMP_KEYS_DIR="null"\n_INSTALL_MASTER=$BS_FALSE\n_INSTALL_SYNDIC=$BS_FALSE\n_INSTALL_MINION=$BS_TRUE\n_INSTALL_CLOUD=$BS_FALSE\n_START_DAEMONS=$BS_TRUE\n_ECHO_DEBUG=${BS_ECHO_DEBUG:-$BS_FALSE}\n_CONFIG_ONLY=$BS_FALSE\n_PIP_ALLOWED=${BS_PIP_ALLOWED:-$BS_FALSE}\n_SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/etc/salt}\n_PKI_DIR=${_SALT_ETC_DIR}/pki\n_FORCE_OVERWRITE=${BS_FORCE_OVERWRITE:-$BS_FALSE}\n_GENTOO_USE_BINHOST=${BS_GENTOO_USE_BINHOST:-$BS_FALSE}\n_EPEL_REPO=${BS_EPEL_REPO:-epel}\n__EPEL_REPOS_INSTALLED=${BS_FALSE}\n_UPGRADE_SYS=${BS_UPGRADE_SYS:-$BS_FALSE}\n_INSECURE_DL=${BS_INSECURE_DL:-$BS_FALSE}\n_WGET_ARGS=${BS_WGET_ARGS:-}\n_CURL_ARGS=${BS_CURL_ARGS:-}\n_FETCH_ARGS=${BS_FETCH_ARGS:-}\n_ENABLE_EXTERNAL_ZMQ_REPOS=${BS_ENABLE_EXTERNAL_ZMQ_REPOS:-$BS_FALSE}\n_SALT_MASTER_ADDRESS=${BS_SALT_MASTER_ADDRESS:-null}\n_SALT_MINION_ID="null"\n# __SIMPLIFY_VERSION is mostly used in Solaris based distributions\n__SIMPLIFY_VERSION=$BS_TRUE\n_LIBCLOUD_MIN_VERSION="0.14.0"\n_PY_REQUESTS_MIN_VERSION="2.4.3"\n_EXTRA_PACKAGES=""\n_HTTP_PROXY=""\n__SALT_GIT_CHECKOUT_DIR=${BS_SALT_GIT_CHECKOUT_DIR:-/tmp/git/salt}\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: usage\n# DESCRIPTION: Display usage information.\n#----------------------------------------------------------------------------------------------------------------------\nusage() {\n cat << EOT\n\n Usage : ${__ScriptName} [options] <install-type> <install-type-args>\n\n Installation types:\n - stable (default)\n - daily (ubuntu specific)\n - git\n\n Examples:\n - ${__ScriptName}\n - ${__ScriptName} stable\n - ${__ScriptName} daily\n - ${__ScriptName} git\n - ${__ScriptName} git develop\n - ${__ScriptName} git v0.17.0\n - ${__ScriptName} git 8c3fadf15ec183e5ce8c63739850d543617e4357\n\n Options:\n -h Display this message\n -v Display script version\n -n No colours.\n -D Show debug output.\n -c Temporary configuration directory\n -g Salt repository URL. (default: git://github.com/saltstack/salt.git)\n -G Instead of cloning from git://github.com/saltstack/salt.git, clone from https://github.com/saltstack/salt.git (Usually necessary on systems which have the regular git protocol port blocked, where https usually is not)\n -k Temporary directory holding the minion keys which will pre-seed\n the master.\n -s Sleep time used when waiting for daemons to start, restart and when checking\n for the services running. Default: ${__DEFAULT_SLEEP}\n -M Also install salt-master\n -S Also install salt-syndic\n -N Do not install salt-minion\n -X Do not start daemons after installation\n -C Only run the configuration function. This option automatically\n bypasses any installation.\n -P Allow pip based installations. On some distributions the required salt\n packages or its dependencies are not available as a package for that\n distribution. Using this flag allows the script to use pip as a last\n resort method. NOTE: This only works for functions which actually\n implement pip based installations.\n -F Allow copied files to overwrite existing(config, init.d, etc)\n -U If set, fully upgrade the system prior to bootstrapping salt\n -K If set, keep the temporary files in the temporary directories specified\n with -c and -k.\n -I If set, allow insecure connections while downloading any files. For\n example, pass \'--no-check-certificate\' to \'wget\' or \'--insecure\' to \'curl\'\n -A Pass the salt-master DNS name or IP. This will be stored under\n ${_SALT_ETC_DIR}/minion.d/99-master-address.conf\n -i Pass the salt-minion id. This will be stored under\n ${_SALT_ETC_DIR}/minion_id\n -L Install the Apache Libcloud package if possible(required for salt-cloud)\n -p Extra-package to install while installing salt dependencies. One package\n per -p flag. You\'re responsible for providing the proper package name.\n -H Use the specified http proxy for the installation\n -Z Enable external software source for newer ZeroMQ(Only available for RHEL/CentOS/Fedora based distributions)\n\nEOT\n} # ---------- end of function usage ----------\n\n\nwhile getopts ":hvnDc:Gg:k:MSNXCPFUKIA:i:Lp:H:Z" opt\ndo\n case "${opt}" in\n\n h ) usage; exit 0 ;;\n\n v ) echo "$0 -- Version $__ScriptVersion"; exit 0 ;;\n n ) _COLORS=0; __detect_color_support ;;\n D ) _ECHO_DEBUG=$BS_TRUE ;;\n c ) _TEMP_CONFIG_DIR=$(__check_config_dir "$OPTARG")\n # If the configuration directory does not exist, error out\n if [ "$_TEMP_CONFIG_DIR" = "null" ]; then\n echoerror "Unsupported URI scheme for $OPTARG"\n exit 1\n fi\n if [ ! -d "$_TEMP_CONFIG_DIR" ]; then\n echoerror "The configuration directory ${_TEMP_CONFIG_DIR} does not exist."\n exit 1\n fi\n ;;\n g ) _SALT_REPO_URL=$OPTARG ;;\n G ) if [ "${_SALT_REPO_URL}" = "${_SALTSTACK_REPO_URL}" ]; then\n _SALTSTACK_REPO_URL="https://github.com/saltstack/salt.git"\n _SALT_REPO_URL=${_SALTSTACK_REPO_URL}\n else\n _SALTSTACK_REPO_URL="https://github.com/saltstack/salt.git"\n fi\n ;;\n k ) _TEMP_KEYS_DIR="$OPTARG"\n # If the configuration directory does not exist, error out\n if [ ! -d "$_TEMP_KEYS_DIR" ]; then\n echoerror "The pre-seed keys directory ${_TEMP_KEYS_DIR} does not exist."\n exit 1\n fi\n ;;\n M ) _INSTALL_MASTER=$BS_TRUE ;;\n S ) _INSTALL_SYNDIC=$BS_TRUE ;;\n N ) _INSTALL_MINION=$BS_FALSE ;;\n X ) _START_DAEMONS=$BS_FALSE ;;\n C ) _CONFIG_ONLY=$BS_TRUE ;;\n P ) _PIP_ALLOWED=$BS_TRUE ;;\n F ) _FORCE_OVERWRITE=$BS_TRUE ;;\n U ) _UPGRADE_SYS=$BS_TRUE ;;\n K ) _KEEP_TEMP_FILES=$BS_TRUE ;;\n I ) _INSECURE_DL=$BS_TRUE ;;\n A ) _SALT_MASTER_ADDRESS=$OPTARG ;;\n i ) _SALT_MINION_ID=$OPTARG ;;\n L ) _INSTALL_CLOUD=$BS_TRUE ;;\n p ) _EXTRA_PACKAGES="$_EXTRA_PACKAGES $OPTARG" ;;\n H ) _HTTP_PROXY="$OPTARG" ;;\n Z) _ENABLE_EXTERNAL_ZMQ_REPOS=$BS_TRUE ;;\n\n\n \\?) echo\n echoerror "Option does not exist : $OPTARG"\n usage\n exit 1\n ;;\n\n esac # --- end of case ---\ndone\nshift $((OPTIND-1))\n\n\n__check_unparsed_options() {\n shellopts="$1"\n # grep alternative for SunOS\n if [ -f /usr/xpg4/bin/grep ]; then\n grep=\'/usr/xpg4/bin/grep\'\n else\n grep=\'grep\'\n fi\n unparsed_options=$( echo "$shellopts" | ${grep} -E \'(^|[[:space:]])[-]+[[:alnum:]]\' )\n if [ "$unparsed_options" != "" ]; then\n usage\n echo\n echoerror "options are only allowed before install arguments"\n echo\n exit 1\n fi\n}\n\n\n# Check that we\'re actually installing one of minion/master/syndic\nif [ "$_INSTALL_MINION" -eq $BS_FALSE ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then\n echowarn "Nothing to install or configure"\n exit 0\nfi\n\nif [ "$_CONFIG_ONLY" -eq $BS_TRUE ] && [ "$_TEMP_CONFIG_DIR" = "null" ]; then\n echoerror "In order to run the script in configuration only mode you also need to provide the configuration directory."\n exit 1\nfi\n\n# Check that we\'re installing a minion if we\'re being passed a master address\nif [ "$_INSTALL_MINION" -eq $BS_FALSE ] && [ "$_SALT_MASTER_ADDRESS" != "null" ]; then\n echoerror "Don\'t pass a master address (-A) if no minion is going to be bootstrapped."\n exit 1\nfi\n\n# Check that we\'re installing a minion if we\'re being passed a master address\nif [ "$_INSTALL_MINION" -eq $BS_FALSE ] && [ "$_SALT_MINION_ID" != "null" ]; then\n echoerror "Don\'t pass a minion id (-i) if no minion is going to be bootstrapped."\n exit 1\nfi\n\n\n# Define installation type\nif [ "$#" -eq 0 ];then\n ITYPE="stable"\nelse\n __check_unparsed_options "$*"\n ITYPE=$1\n shift\nfi\n\n# Check installation type\nif [ "$(echo "$ITYPE" | egrep \'(stable|testing|daily|git)\')" = "" ]; then\n echoerror "Installation type \\"$ITYPE\\" is not known..."\n exit 1\nfi\n\n# If doing a git install, check what branch/tag/sha will be checked out\nif [ "$ITYPE" = "git" ]; then\n if [ "$#" -eq 0 ];then\n GIT_REV="develop"\n else\n __check_unparsed_options "$*"\n GIT_REV="$1"\n shift\n fi\nfi\n\n# Check for any unparsed arguments. Should be an error.\nif [ "$#" -gt 0 ]; then\n __check_unparsed_options "$*"\n usage\n echo\n echoerror "Too many arguments."\n exit 1\nfi\n\n# whoami alternative for SunOS\nif [ -f /usr/xpg4/bin/id ]; then\n whoami=\'/usr/xpg4/bin/id -un\'\nelse\n whoami=\'whoami\'\nfi\n\n# Root permissions are required to run this script\nif [ "$(${whoami})" != "root" ]; then\n echoerror "Salt requires root privileges to install. Please re-run this script as root."\n exit 1\nfi\n\n# Export the http_proxy configuration to our current environment\nif [ "${_HTTP_PROXY}" != "" ]; then\n export http_proxy="$_HTTP_PROXY"\n export https_proxy="$_HTTP_PROXY"\nfi\n\n# Let\'s discover how we\'re being called\n# shellcheck disable=SC2009\nCALLER=$(ps -a -o pid,args | grep $$ | grep -v grep | tr -s \' \' | cut -d \' \' -f 3)\n\nif [ "${CALLER}x" = "${0}x" ]; then\n CALLER="PIPED THROUGH"\nfi\n\nechoinfo "${CALLER} ${0} -- Version ${__ScriptVersion}"\n#echowarn "Running the unstable version of ${__ScriptName}"\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __exit_cleanup\n# DESCRIPTION: Cleanup any leftovers after script has ended\n#\n#\n# http://www.unix.com/man-page/POSIX/1posix/trap/\n#\n# Signal Number Signal Name\n# 1 SIGHUP\n# 2 SIGINT\n# 3 SIGQUIT\n# 6 SIGABRT\n# 9 SIGKILL\n# 14 SIGALRM\n# 15 SIGTERM\n#----------------------------------------------------------------------------------------------------------------------\n__exit_cleanup() {\n EXIT_CODE=$?\n\n if [ "$ITYPE" = "git" ] && [ -d "${__SALT_GIT_CHECKOUT_DIR}" ]; then\n if [ $_KEEP_TEMP_FILES -eq $BS_FALSE ]; then\n # Clean up the checked out repository\n echodebug "Cleaning up the Salt Temporary Git Repository"\n rm -rf "${__SALT_GIT_CHECKOUT_DIR}"\n else\n echowarn "Not cleaning up the Salt Temporary git repository on request"\n echowarn "Note that if you intend to re-run this script using the git approach, you might encounter some issues"\n fi\n fi\n\n # Remove the logging pipe when the script exits\n echodebug "Removing the logging pipe $LOGPIPE"\n rm -f "$LOGPIPE"\n\n # Kill tee when exiting, CentOS, at least requires this\n # shellcheck disable=SC2009\n TEE_PID=$(ps ax | grep tee | grep "$LOGFILE" | awk \'{print $1}\')\n\n [ "$TEE_PID" = "" ] && exit $EXIT_CODE\n\n echodebug "Killing logging pipe tee\'s with pid(s): $TEE_PID"\n\n # We need to trap errors since killing tee will cause a 127 errno\n # We also do this as late as possible so we don\'t "mis-catch" other errors\n __trap_errors() {\n echoinfo "Errors Trapped: $EXIT_CODE"\n # Exit with the "original" exit code, not the trapped code\n exit $EXIT_CODE\n }\n trap "__trap_errors" INT QUIT ABRT KILL QUIT TERM\n\n # Now we\'re "good" to kill tee\n kill -s TERM "$TEE_PID"\n\n # In case the 127 errno is not triggered, exit with the "original" exit code\n exit $EXIT_CODE\n}\ntrap "__exit_cleanup" EXIT INT\n\n\n# Define our logging file and pipe paths\nLOGFILE="/tmp/$( echo $__ScriptName | sed s/.sh/.log/g )"\nLOGPIPE="/tmp/$( echo $__ScriptName | sed s/.sh/.logpipe/g )"\n\n# Create our logging pipe\n# On FreeBSD we have to use mkfifo instead of mknod\nmknod "$LOGPIPE" p >/dev/null 2>&1 || mkfifo "$LOGPIPE" >/dev/null 2>&1\nif [ $? -ne 0 ]; then\n echoerror "Failed to create the named pipe required to log"\n exit 1\nfi\n\n# What ever is written to the logpipe gets written to the logfile\ntee < "$LOGPIPE" "$LOGFILE" &\n\n# Close STDOUT, reopen it directing it to the logpipe\nexec 1>&-\nexec 1>"$LOGPIPE"\n# Close STDERR, reopen it directing it to the logpipe\nexec 2>&-\nexec 2>"$LOGPIPE"\n\n\n# Handle the insecure flags\nif [ "$_INSECURE_DL" -eq $BS_TRUE ]; then\n _CURL_ARGS="${_CURL_ARGS} --insecure"\n _WGET_ARGS="${_WGET_ARGS} --no-check-certificate"\n _FETCH_ARGS="${_FETCH_ARGS} --no-verify-peer"\nfi\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __fetch_url\n# DESCRIPTION: Retrieves a URL and writes it to a given path\n#----------------------------------------------------------------------------------------------------------------------\n__fetch_url() {\n # shellcheck disable=SC2086\n curl $_CURL_ARGS -s -o "$1" "$2" >/dev/null 2>&1 ||\n wget $_WGET_ARGS -q -O "$1" "$2" >/dev/null 2>&1 ||\n fetch $_FETCH_ARGS -q -o "$1" "$2" >/dev/null 2>&1 ||\n fetch -q -o "$1" "$2" >/dev/null 2>&1 # Pre FreeBSD 10\n\n}\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __gather_hardware_info\n# DESCRIPTION: Discover hardware information\n#----------------------------------------------------------------------------------------------------------------------\n__gather_hardware_info() {\n if [ -f /proc/cpuinfo ]; then\n CPU_VENDOR_ID=$(awk \'/vendor_id|Processor/ {sub(/-.*$/,"",$3); print $3; exit}\' /proc/cpuinfo )\n elif [ -f /usr/bin/kstat ]; then\n # SmartOS.\n # Solaris!?\n # This has only been tested for a GenuineIntel CPU\n CPU_VENDOR_ID=$(/usr/bin/kstat -p cpu_info:0:cpu_info0:vendor_id | awk \'{print $2}\')\n else\n CPU_VENDOR_ID=$( sysctl -n hw.model )\n fi\n # shellcheck disable=SC2034\n CPU_VENDOR_ID_L=$( echo "$CPU_VENDOR_ID" | tr \'[:upper:]\' \'[:lower:]\' )\n CPU_ARCH=$(uname -m 2>/dev/null || uname -p 2>/dev/null || echo "unknown")\n CPU_ARCH_L=$( echo "$CPU_ARCH" | tr \'[:upper:]\' \'[:lower:]\' )\n\n}\n__gather_hardware_info\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __gather_os_info\n# DESCRIPTION: Discover operating system information\n#----------------------------------------------------------------------------------------------------------------------\n__gather_os_info() {\n OS_NAME=$(uname -s 2>/dev/null)\n OS_NAME_L=$( echo "$OS_NAME" | tr \'[:upper:]\' \'[:lower:]\' )\n OS_VERSION=$(uname -r)\n # shellcheck disable=SC2034\n OS_VERSION_L=$( echo "$OS_VERSION" | tr \'[:upper:]\' \'[:lower:]\' )\n}\n__gather_os_info\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __parse_version_string\n# DESCRIPTION: Parse version strings ignoring the revision.\n# MAJOR.MINOR.REVISION becomes MAJOR.MINOR\n#----------------------------------------------------------------------------------------------------------------------\n__parse_version_string() {\n VERSION_STRING="$1"\n PARSED_VERSION=$(\n echo "$VERSION_STRING" |\n sed -e \'s/^/#/\' \\\n -e \'s/^#[^0-9]*\\([0-9][0-9]*\\.[0-9][0-9]*\\)\\(\\.[0-9][0-9]*\\).*$/\\1/\' \\\n -e \'s/^#[^0-9]*\\([0-9][0-9]*\\.[0-9][0-9]*\\).*$/\\1/\' \\\n -e \'s/^#[^0-9]*\\([0-9][0-9]*\\).*$/\\1/\' \\\n -e \'s/^#.*$//\'\n )\n echo "$PARSED_VERSION"\n}\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __derive_debian_numeric_version\n# DESCRIPTION: Derive the numeric version from a Debian version string.\n#----------------------------------------------------------------------------------------------------------------------\n__derive_debian_numeric_version() {\n NUMERIC_VERSION=""\n INPUT_VERSION="$1"\n if echo "$INPUT_VERSION" | grep -q \'^[0-9]\'; then\n NUMERIC_VERSION="$INPUT_VERSION"\n elif [ -z "$INPUT_VERSION" -a -f "/etc/debian_version" ]; then\n INPUT_VERSION="$(cat /etc/debian_version)"\n fi\n if [ -z "$NUMERIC_VERSION" ]; then\n if [ "$INPUT_VERSION" = "wheezy/sid" ]; then\n # I\'ve found an EC2 wheezy image which did not tell its version\n NUMERIC_VERSION=$(__parse_version_string "7.0")\n elif [ "$INPUT_VERSION" = "jessie/sid" ]; then\n # Let\'s start detecting the upcoming Debian 8 (Jessie)\n NUMERIC_VERSION=$(__parse_version_string "8.0")\n else\n echowarn "Unable to parse the Debian Version (codename: \'$INPUT_VERSION\')"\n fi\n fi\n echo "$NUMERIC_VERSION"\n}\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __unquote_string\n# DESCRIPTION: Strip single or double quotes from the provided string.\n#----------------------------------------------------------------------------------------------------------------------\n__unquote_string() {\n echo "${@}" | sed "s/^\\([\\"\']\\)\\(.*\\)\\1\\$/\\2/g"\n}\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __camelcase_split\n# DESCRIPTION: Convert CamelCased strings to Camel_Cased\n#----------------------------------------------------------------------------------------------------------------------\n__camelcase_split() {\n echo "${@}" | sed -r \'s/([^A-Z-])([A-Z])/\\1 \\2/g\'\n}\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __strip_duplicates\n# DESCRIPTION: Strip duplicate strings\n#----------------------------------------------------------------------------------------------------------------------\n__strip_duplicates() {\n echo "${@}" | tr -s \'[:space:]\' \'\\n\' | awk \'!x[$0]++\'\n}\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __sort_release_files\n# DESCRIPTION: Custom sort function. Alphabetical or numerical sort is not\n# enough.\n#----------------------------------------------------------------------------------------------------------------------\n__sort_release_files() {\n KNOWN_RELEASE_FILES=$(echo "(arch|centos|debian|ubuntu|fedora|redhat|suse|\\\n mandrake|mandriva|gentoo|slackware|turbolinux|unitedlinux|lsb|system|\\\n oracle|os)(-|_)(release|version)" | sed -r \'s:[[:space:]]::g\')\n primary_release_files=""\n secondary_release_files=""\n # Sort know VS un-known files first\n for release_file in $(echo "${@}" | sed -r \'s:[[:space:]]:\\n:g\' | sort --unique --ignore-case); do\n match=$(echo "$release_file" | egrep -i "${KNOWN_RELEASE_FILES}")\n if [ "${match}" != "" ]; then\n primary_release_files="${primary_release_files} ${release_file}"\n else\n secondary_release_files="${secondary_release_files} ${release_file}"\n fi\n done\n\n # Now let\'s sort by know files importance, max important goes last in the max_prio list\n max_prio="redhat-release centos-release oracle-release"\n for entry in $max_prio; do\n if [ "$(echo "${primary_release_files}" | grep "$entry")" != "" ]; then\n primary_release_files=$(echo "${primary_release_files}" | sed -e "s:\\(.*\\)\\($entry\\)\\(.*\\):\\2 \\1 \\3:g")\n fi\n done\n # Now, least important goes last in the min_prio list\n min_prio="lsb-release"\n for entry in $min_prio; do\n if [ "$(echo "${primary_release_files}" | grep "$entry")" != "" ]; then\n primary_release_files=$(echo "${primary_release_files}" | sed -e "s:\\(.*\\)\\($entry\\)\\(.*\\):\\1 \\3 \\2:g")\n fi\n done\n\n # Echo the results collapsing multiple white-space into a single white-space\n echo "${primary_release_files} ${secondary_release_files}" | sed -r \'s:[[:space:]]+:\\n:g\'\n}\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __gather_linux_system_info\n# DESCRIPTION: Discover Linux system information\n#----------------------------------------------------------------------------------------------------------------------\n__gather_linux_system_info() {\n DISTRO_NAME=""\n DISTRO_VERSION=""\n\n # Let\'s test if the lsb_release binary is available\n rv=$(lsb_release >/dev/null 2>&1)\n if [ $? -eq 0 ]; then\n DISTRO_NAME=$(lsb_release -si)\n if [ "${DISTRO_NAME}" = "Scientific" ]; then\n DISTRO_NAME="Scientific Linux"\n elif [ "$(echo "$DISTRO_NAME" | grep RedHat)" != "" ]; then\n # Let\'s convert CamelCase to Camel Case\n DISTRO_NAME=$(__camelcase_split "$DISTRO_NAME")\n elif [ "${DISTRO_NAME}" = "openSUSE project" ]; then\n # lsb_release -si returns "openSUSE project" on openSUSE 12.3\n DISTRO_NAME="opensuse"\n elif [ "${DISTRO_NAME}" = "SUSE LINUX" ]; then\n if [ "$(lsb_release -sd | grep -i opensuse)" != "" ]; then\n # openSUSE 12.2 reports SUSE LINUX on lsb_release -si\n DISTRO_NAME="opensuse"\n else\n # lsb_release -si returns "SUSE LINUX" on SLES 11 SP3\n DISTRO_NAME="suse"\n fi\n elif [ "${DISTRO_NAME}" = "EnterpriseEnterpriseServer" ]; then\n # This the Oracle Linux Enterprise ID before ORACLE LINUX 5 UPDATE 3\n DISTRO_NAME="Oracle Linux"\n elif [ "${DISTRO_NAME}" = "OracleServer" ]; then\n # This the Oracle Linux Server 6.5\n DISTRO_NAME="Oracle Linux"\n elif [ "${DISTRO_NAME}" = "AmazonAMI" ]; then\n DISTRO_NAME="Amazon Linux AMI"\n elif [ "${DISTRO_NAME}" = "Arch" ]; then\n DISTRO_NAME="Arch Linux"\n return\n fi\n rv=$(lsb_release -sr)\n [ "${rv}" != "" ] && DISTRO_VERSION=$(__parse_version_string "$rv")\n elif [ -f /etc/lsb-release ]; then\n # We don\'t have the lsb_release binary, though, we do have the file it parses\n DISTRO_NAME=$(grep DISTRIB_ID /etc/lsb-release | sed -e \'s/.*=//\')\n rv=$(grep DISTRIB_RELEASE /etc/lsb-release | sed -e \'s/.*=//\')\n [ "${rv}" != "" ] && DISTRO_VERSION=$(__parse_version_string "$rv")\n fi\n\n if [ "$DISTRO_NAME" != "" ] && [ "$DISTRO_VERSION" != "" ]; then\n # We already have the distribution name and version\n return\n fi\n\n # shellcheck disable=SC2035,SC2086\n for rsource in $(__sort_release_files "$(\n cd /etc && /bin/ls *[_-]release *[_-]version 2>/dev/null | env -i sort | \\\n sed -e \'/^redhat-release$/d\' -e \'/^lsb-release$/d\'; \\\n echo redhat-release lsb-release\n )"); do\n\n [ -L "/etc/${rsource}" ] && continue # Don\'t follow symlinks\n [ ! -f "/etc/${rsource}" ] && continue # Does not exist\n\n n=$(echo "${rsource}" | sed -e \'s/[_-]release$//\' -e \'s/[_-]version$//\')\n shortname=$(echo "${n}" | tr \'[:upper:]\' \'[:lower:]\')\n if [ "$shortname" = "debian" ]; then\n rv=$(__derive_debian_numeric_version "$(cat /etc/${rsource})")\n else\n rv=$( (grep VERSION "/etc/${rsource}"; cat "/etc/${rsource}") | grep \'[0-9]\' | sed -e \'q\' )\n fi\n [ "${rv}" = "" ] && [ "$shortname" != "arch" ] && continue # There\'s no version information. Continue to next rsource\n v=$(__parse_version_string "$rv")\n case $shortname in\n redhat )\n if [ "$(egrep \'CentOS\' /etc/${rsource})" != "" ]; then\n n="CentOS"\n elif [ "$(egrep \'Scientific\' /etc/${rsource})" != "" ]; then\n n="Scientific Linux"\n elif [ "$(egrep \'Red Hat Enterprise Linux\' /etc/${rsource})" != "" ]; then\n n="<R>ed <H>at <E>nterprise <L>inux"\n else\n n="<R>ed <H>at <L>inux"\n fi\n ;;\n arch ) n="Arch Linux" ;;\n centos ) n="CentOS" ;;\n debian ) n="Debian" ;;\n ubuntu ) n="Ubuntu" ;;\n fedora ) n="Fedora" ;;\n suse ) n="SUSE" ;;\n mandrake*|mandriva ) n="Mandriva" ;;\n gentoo ) n="Gentoo" ;;\n slackware ) n="Slackware" ;;\n turbolinux ) n="TurboLinux" ;;\n unitedlinux ) n="UnitedLinux" ;;\n oracle ) n="Oracle Linux" ;;\n system )\n while read -r line; do\n [ "${n}x" != "systemx" ] && break\n case "$line" in\n *Amazon*Linux*AMI*)\n n="Amazon Linux AMI"\n break\n esac\n done < "/etc/${rsource}"\n ;;\n os )\n nn="$(__unquote_string "$(grep \'^ID=\' /etc/os-release | sed -e \'s/^ID=\\(.*\\)$/\\1/g\')")"\n rv="$(__unquote_string "$(grep \'^VERSION_ID=\' /etc/os-release | sed -e \'s/^VERSION_ID=\\(.*\\)$/\\1/g\')")"\n [ "${rv}" != "" ] && v=$(__parse_version_string "$rv") || v=""\n case $(echo "${nn}" | tr \'[:upper:]\' \'[:lower:]\') in\n amzn )\n # Amazon AMI\'s after 2014.9 match here\n n="Amazon Linux AMI"\n ;;\n arch )\n n="Arch Linux"\n v="" # Arch Linux does not provide a version.\n ;;\n debian )\n n="Debian"\n v=$(__derive_debian_numeric_version "$v")\n ;;\n * )\n n=${nn}\n ;;\n esac\n ;;\n * ) n="${n}" ;\n esac\n DISTRO_NAME=$n\n DISTRO_VERSION=$v\n break\n done\n}\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __gather_sunos_system_info\n# DESCRIPTION: Discover SunOS system info\n#----------------------------------------------------------------------------------------------------------------------\n__gather_sunos_system_info() {\n if [ -f /sbin/uname ]; then\n DISTRO_VERSION=$(/sbin/uname -X | awk \'/[kK][eE][rR][nN][eE][lL][iI][dD]/ { print $3}\')\n fi\n\n DISTRO_NAME=""\n if [ -f /etc/release ]; then\n while read -r line; do\n [ "${DISTRO_NAME}" != "" ] && break\n case "$line" in\n *OpenIndiana*oi_[0-9]*)\n DISTRO_NAME="OpenIndiana"\n DISTRO_VERSION=$(echo "$line" | sed -nr "s/OpenIndiana(.*)oi_([[:digit:]]+)(.*)/\\2/p")\n break\n ;;\n *OpenSolaris*snv_[0-9]*)\n DISTRO_NAME="OpenSolaris"\n DISTRO_VERSION=$(echo "$line" | sed -nr "s/OpenSolaris(.*)snv_([[:digit:]]+)(.*)/\\2/p")\n break\n ;;\n *Oracle*Solaris*[0-9]*)\n DISTRO_NAME="Oracle Solaris"\n DISTRO_VERSION=$(echo "$line" | sed -nr "s/(Oracle Solaris) ([[:digit:]]+)(.*)/\\2/p")\n break\n ;;\n *Solaris*)\n DISTRO_NAME="Solaris"\n # Let\'s make sure we not actually on a Joyent\'s SmartOS VM since some releases\n # don\'t have SmartOS in `/etc/release`, only `Solaris`\n uname -v | grep joyent >/dev/null 2>&1\n if [ $? -eq 0 ]; then\n DISTRO_NAME="SmartOS"\n fi\n break\n ;;\n *NexentaCore*)\n DISTRO_NAME="Nexenta Core"\n break\n ;;\n *SmartOS*)\n DISTRO_NAME="SmartOS"\n break\n ;;\n *OmniOS*)\n DISTRO_NAME="OmniOS"\n DISTRO_VERSION=$(echo "$line" | awk \'{print $3}\')\n __SIMPLIFY_VERSION=$BS_FALSE\n break\n ;;\n esac\n done < /etc/release\n fi\n\n if [ "${DISTRO_NAME}" = "" ]; then\n DISTRO_NAME="Solaris"\n DISTRO_VERSION=$(\n echo "${OS_VERSION}" |\n sed -e \'s;^4\\.;1.;\' \\\n -e \'s;^5\\.\\([0-6]\\)[^0-9]*$;2.\\1;\' \\\n -e \'s;^5\\.\\([0-9][0-9]*\\).*;\\1;\'\n )\n fi\n\n if [ "${DISTRO_NAME}" = "SmartOS" ]; then\n VIRTUAL_TYPE="smartmachine"\n if [ "$(zonename)" = "global" ]; then\n VIRTUAL_TYPE="global"\n fi\n fi\n}\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __gather_bsd_system_info\n# DESCRIPTION: Discover OpenBSD, NetBSD and FreeBSD systems information\n#----------------------------------------------------------------------------------------------------------------------\n__gather_bsd_system_info() {\n DISTRO_NAME=${OS_NAME}\n DISTRO_VERSION=$(echo "${OS_VERSION}" | sed -e \'s;[()];;\' -e \'s/-.*$//\')\n}\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __gather_system_info\n# DESCRIPTION: Discover which system and distribution we are running.\n#----------------------------------------------------------------------------------------------------------------------\n__gather_system_info() {\n case ${OS_NAME_L} in\n linux )\n __gather_linux_system_info\n ;;\n sunos )\n __gather_sunos_system_info\n ;;\n openbsd|freebsd|netbsd )\n __gather_bsd_system_info\n ;;\n * )\n echoerror "${OS_NAME} not supported.";\n exit 1\n ;;\n esac\n\n}\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __ubuntu_derivatives_translation\n# DESCRIPTION: Map Ubuntu derivatives to their Ubuntu base versions.\n# If distro has a known Ubuntu base version, use those install\n# functions by pretending to be Ubuntu (i.e. change global vars)\n#----------------------------------------------------------------------------------------------------------------------\n# shellcheck disable=SC2034\n__ubuntu_derivatives_translation() {\n UBUNTU_DERIVATIVES="(trisquel|linuxmint|linaro|elementary_os)"\n # Mappings\n trisquel_6_ubuntu_base="12.04"\n linuxmint_13_ubuntu_base="12.04"\n linuxmint_14_ubuntu_base="12.10"\n #linuxmint_15_ubuntu_base="13.04"\n # Bug preventing add-apt-repository from working on Mint 15:\n # https://bugs.launchpad.net/linuxmint/+bug/1198751\n\n linuxmint_16_ubuntu_base="13.10"\n linuxmint_17_ubuntu_base="14.04"\n linaro_12_ubuntu_base="12.04"\n elementary_os_02_ubuntu_base="12.04"\n\n # Translate Ubuntu derivatives to their base Ubuntu version\n match=$(echo "$DISTRO_NAME_L" | egrep ${UBUNTU_DERIVATIVES})\n\n if [ "${match}" != "" ]; then\n case $match in\n "elementary_os")\n _major=$(echo "$DISTRO_VERSION" | sed \'s/\\.//g\')\n ;;\n "linuxmint")\n export LSB_ETC_LSB_RELEASE=/etc/upstream-release/lsb-release\n _major=$(echo "$DISTRO_VERSION" | sed \'s/^\\([0-9]*\\).*/\\1/g\')\n ;;\n *)\n _major=$(echo "$DISTRO_VERSION" | sed \'s/^\\([0-9]*\\).*/\\1/g\')\n ;;\n esac\n\n _ubuntu_version=$(eval echo "\\$${match}_${_major}_ubuntu_base")\n\n if [ "$_ubuntu_version" != "" ]; then\n echodebug "Detected Ubuntu $_ubuntu_version derivative"\n DISTRO_NAME_L="ubuntu"\n DISTRO_VERSION="$_ubuntu_version"\n fi\n fi\n}\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __debian_derivatives_translation\n# DESCRIPTION: Map Debian derivatives to their Debian base versions.\n# If distro has a known Debian base version, use those install\n# functions by pretending to be Debian (i.e. change global vars)\n#----------------------------------------------------------------------------------------------------------------------\n# shellcheck disable=SC2034\n__debian_derivatives_translation() {\n\n # If the file does not exist, return\n [ ! -f /etc/os-release ] && return\n\n DEBIAN_DERIVATIVES="(kali|linuxmint)"\n # Mappings\n kali_1_debian_base="7.0"\n linuxmint_1_debian_base="8.0"\n\n # Detect derivates, Kali and LinuxMint *only* for now\n rv=$(grep ^ID= /etc/os-release | sed -e \'s/.*=//\')\n\n # Translate Debian derivatives to their base Debian version\n match=$(echo "$rv" | egrep ${DEBIAN_DERIVATIVES})\n\n if [ "${match}" != "" ]; then\n case $match in\n kali)\n _major=$(echo "$DISTRO_VERSION" | sed \'s/^\\([0-9]*\\).*/\\1/g\')\n _debian_derivative="kali"\n ;;\n linuxmint)\n _major=$(echo "$DISTRO_VERSION" | sed \'s/^\\([0-9]*\\).*/\\1/g\')\n _debian_derivative="linuxmint"\n ;;\n esac\n\n _debian_version=$(eval echo "\\$${_debian_derivative}_${_major}_debian_base")\n\n if [ "$_debian_version" != "" ]; then\n echodebug "Detected Debian $_debian_version derivative"\n DISTRO_NAME_L="debian"\n DISTRO_VERSION="$_debian_version"\n fi\n fi\n}\n\n__gather_system_info\n\necho\nechoinfo "System Information:"\nechoinfo " CPU: ${CPU_VENDOR_ID}"\nechoinfo " CPU Arch: ${CPU_ARCH}"\nechoinfo " OS Name: ${OS_NAME}"\nechoinfo " OS Version: ${OS_VERSION}"\nechoinfo " Distribution: ${DISTRO_NAME} ${DISTRO_VERSION}"\necho\n\nechodebug "Binaries will be searched using the following \\$PATH: ${PATH}"\n\n# Let users know that we\'ll use a proxy\nif [ "${_HTTP_PROXY}" != "" ]; then\n echoinfo "Using http proxy $_HTTP_PROXY"\nfi\n\n# Let users know what\'s going to be installed/configured\nif [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then\n if [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then\n echoinfo "Installing minion"\n else\n echoinfo "Configuring minion"\n fi\nfi\n\nif [ "$_INSTALL_MASTER" -eq $BS_TRUE ]; then\n if [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then\n echoinfo "Installing master"\n else\n echoinfo "Configuring master"\n fi\nfi\n\nif [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ]; then\n if [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then\n echoinfo "Installing syndic"\n else\n echoinfo "Configuring syndic"\n fi\nfi\n\nif [ "$_INSTALL_CLOUD" -eq $BS_TRUE ] && [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then\n echoinfo "Installing Apache-Libcloud required for salt-cloud"\nfi\n\nif [ $_START_DAEMONS -eq $BS_FALSE ]; then\n echoinfo "Daemons will not be started"\nfi\n\n# Simplify distro name naming on functions\nDISTRO_NAME_L=$(echo "$DISTRO_NAME" | tr \'[:upper:]\' \'[:lower:]\' | sed \'s/[^a-zA-Z0-9_ ]//g\' | sed -re \'s/([[:space:]])+/_/g\')\n\n# For Ubuntu derivatives, pretend to be their Ubuntu base version\n__ubuntu_derivatives_translation\n\n# For Debian derivates, pretend to be their Debian base version\n__debian_derivatives_translation\n\n# Simplify version naming on functions\nif [ "${DISTRO_VERSION}" = "" ] || [ $__SIMPLIFY_VERSION -eq $BS_FALSE ]; then\n DISTRO_MAJOR_VERSION=""\n DISTRO_MINOR_VERSION=""\n PREFIXED_DISTRO_MAJOR_VERSION=""\n PREFIXED_DISTRO_MINOR_VERSION=""\nelse\n DISTRO_MAJOR_VERSION=$(echo "$DISTRO_VERSION" | sed \'s/^\\([0-9]*\\).*/\\1/g\')\n DISTRO_MINOR_VERSION=$(echo "$DISTRO_VERSION" | sed \'s/^\\([0-9]*\\).\\([0-9]*\\).*/\\2/g\')\n PREFIXED_DISTRO_MAJOR_VERSION="_${DISTRO_MAJOR_VERSION}"\n if [ "${PREFIXED_DISTRO_MAJOR_VERSION}" = "_" ]; then\n PREFIXED_DISTRO_MAJOR_VERSION=""\n fi\n PREFIXED_DISTRO_MINOR_VERSION="_${DISTRO_MINOR_VERSION}"\n if [ "${PREFIXED_DISTRO_MINOR_VERSION}" = "_" ]; then\n PREFIXED_DISTRO_MINOR_VERSION=""\n fi\nfi\n\n# Only Ubuntu has daily packages, let\'s let users know about that\nif ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ "$ITYPE" = "daily" ]); then\n echoerror "${DISTRO_NAME} does not have daily packages support"\n exit 1\nfi\n\n# Only RedHat based distros have testing support\nif [ "${ITYPE}" = "testing" ]; then\n if [ "$(echo "${DISTRO_NAME_L}" | egrep \'(centos|red_hat|amazon|oracle)\')" = "" ]; then\n echoerror "${DISTRO_NAME} does not have testing packages support"\n exit 1\n fi\n _EPEL_REPO="epel-testing"\nfi\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __function_defined\n# DESCRIPTION: Checks if a function is defined within this scripts scope\n# PARAMETERS: function name\n# RETURNS: 0 or 1 as in defined or not defined\n#----------------------------------------------------------------------------------------------------------------------\n__function_defined() {\n FUNC_NAME=$1\n if [ "$(command -v "$FUNC_NAME")" != "" ]; then\n echoinfo "Found function $FUNC_NAME"\n return 0\n fi\n echodebug "$FUNC_NAME not found...."\n return 1\n}\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __git_clone_and_checkout\n# DESCRIPTION: (DRY) Helper function to clone and checkout salt to a\n# specific revision.\n#----------------------------------------------------------------------------------------------------------------------\n__git_clone_and_checkout() {\n\n echodebug "Installed git version: $(git --version | awk \'{ print $3 }\')"\n\n __SALT_GIT_CHECKOUT_PARENT_DIR=$(dirname "${__SALT_GIT_CHECKOUT_DIR}" 2>/dev/null)\n __SALT_GIT_CHECKOUT_PARENT_DIR="${__SALT_GIT_CHECKOUT_PARENT_DIR:-/tmp/git}"\n __SALT_CHECKOUT_REPONAME="$(basename "${__SALT_GIT_CHECKOUT_DIR}" 2>/dev/null)"\n __SALT_CHECKOUT_REPONAME="${__SALT_CHECKOUT_REPONAME:-salt}"\n [ -d "${__SALT_GIT_CHECKOUT_PARENT_DIR}" ] || mkdir "${__SALT_GIT_CHECKOUT_PARENT_DIR}"\n cd "${__SALT_GIT_CHECKOUT_PARENT_DIR}"\n if [ -d "${__SALT_GIT_CHECKOUT_DIR}" ]; then\n echodebug "Found a checked out Salt repository"\n cd "${__SALT_GIT_CHECKOUT_DIR}"\n echodebug "Fetching git changes"\n git fetch || return 1\n # Tags are needed because of salt\'s versioning, also fetch that\n echodebug "Fetching git tags"\n git fetch --tags || return 1\n\n # If we have the SaltStack remote set as upstream, we also need to fetch the tags from there\n if [ "$(git remote -v | grep $_SALTSTACK_REPO_URL)" != "" ]; then\n echodebug "Fetching upstream(SaltStack\'s Salt repository) git tags"\n git fetch --tags upstream\n else\n echoinfo "Adding SaltStack\'s Salt repository as a remote"\n git remote add upstream "$_SALTSTACK_REPO_URL"\n echodebug "Fetching upstream(SaltStack\'s Salt repository) git tags"\n git fetch --tags upstream\n fi\n\n echodebug "Hard reseting the cloned repository to ${GIT_REV}"\n git reset --hard "$GIT_REV" || return 1\n\n # Just calling `git reset --hard $GIT_REV` on a branch name that has\n # already been checked out will not update that branch to the upstream\n # HEAD; instead it will simply reset to itself. Check the ref to see\n # if it is a branch name, check out the branch, and pull in the\n # changes.\n git branch -a | grep -q "${GIT_REV}"\n if [ $? -eq 0 ]; then\n echodebug "Rebasing the cloned repository branch"\n git pull --rebase || return 1\n fi\n else\n __SHALLOW_CLONE="${BS_FALSE}"\n if [ "$(echo "$GIT_REV" | sed \'s/^.*\\(v[[:digit:]]\\{1,4\\}\\.[[:digit:]]\\{1,2\\}\\)\\(\\.[[:digit:]]\\{1,2\\}\\)\\?.*$/MATCH/\')" = "MATCH" ]; then\n echoinfo "Git revision matches a Salt version tag"\n # Let\'s try shallow cloning to speed up.\n # Test for "--single-branch" option introduced in git 1.7.10, the minimal version of git where the shallow\n # cloning we need actually works\n if [ "$(git clone --help | grep \'single-branch\')" != "" ]; then\n # The "--single-branch" option is supported, attempt shallow cloning\n echoinfo "Attempting to shallow clone $GIT_REV from Salt\'s repository ${_SALT_REPO_URL}"\n git clone --depth 1 --branch "$GIT_REV" "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME"\n if [ $? -eq 0 ]; then\n cd "${__SALT_GIT_CHECKOUT_DIR}"\n __SHALLOW_CLONE="${BS_TRUE}"\n else\n # Shallow clone above failed(missing upstream tags???), let\'s resume the old behaviour.\n echowarn "Failed to shallow clone."\n echoinfo "Resuming regular git clone and remote SaltStack repository addition procedure"\n git clone "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME" || return 1\n cd "${__SALT_GIT_CHECKOUT_DIR}"\n fi\n else\n echodebug "Shallow cloning not possible. Required git version not met."\n git clone "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME" || return 1\n cd "${__SALT_GIT_CHECKOUT_DIR}"\n fi\n else\n echowarn "The git revision being installed does not match a Salt version tag. Shallow cloning disabled"\n git clone "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME" || return 1\n cd "${__SALT_GIT_CHECKOUT_DIR}"\n fi\n\n if [ "$(echo "$_SALT_REPO_URL" | grep -c -e \'\\(\\(git\\|https\\)://github\\.com/\\|git@github\\.com:\\)saltstack/salt\\.git\')" -eq 0 ]; then\n # We need to add the saltstack repository as a remote and fetch tags for proper versioning\n echoinfo "Adding SaltStack\'s Salt repository as a remote"\n git remote add upstream "$_SALTSTACK_REPO_URL" || return 1\n echodebug "Fetching upstream(SaltStack\'s Salt repository) git tags"\n git fetch --tags upstream || return 1\n fi\n\n if [ "$__SHALLOW_CLONE" -eq "${BS_FALSE}" ]; then\n echodebug "Checking out $GIT_REV"\n git checkout "$GIT_REV" || return 1\n fi\n\n fi\n echoinfo "Cloning Salt\'s git repository succeeded"\n return 0\n}\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __apt_get_install_noinput\n# DESCRIPTION: (DRY) apt-get install with noinput options\n#----------------------------------------------------------------------------------------------------------------------\n__apt_get_install_noinput() {\n apt-get install -y -o DPkg::Options::=--force-confold "${@}"; return $?\n}\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __apt_get_upgrade_noinput\n# DESCRIPTION: (DRY) apt-get upgrade with noinput options\n#----------------------------------------------------------------------------------------------------------------------\n__apt_get_upgrade_noinput() {\n apt-get upgrade -y -o DPkg::Options::=--force-confold; return $?\n}\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __check_end_of_life_versions\n# DESCRIPTION: Check for end of life distribution versions\n#----------------------------------------------------------------------------------------------------------------------\n__check_end_of_life_versions() {\n\n case "${DISTRO_NAME_L}" in\n debian)\n # Debian versions bellow 6 are not supported\n if [ "$DISTRO_MAJOR_VERSION" -lt 6 ]; then\n echoerror "End of life distributions are not supported."\n echoerror "Please consider upgrading to the next stable. See:"\n echoerror " https://wiki.debian.org/DebianReleases"\n exit 1\n fi\n ;;\n\n ubuntu)\n # Ubuntu versions not supported\n #\n # < 10\n # = 10.10\n # = 11.04\n # = 11.10\n if ([ "$DISTRO_MAJOR_VERSION" -eq 10 ] && [ "$DISTRO_MINOR_VERSION" -eq 10 ]) || \\\n ([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$DISTRO_MINOR_VERSION" -eq 04 ]) || \\\n ([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$DISTRO_MINOR_VERSION" -eq 10 ]) || \\\n [ "$DISTRO_MAJOR_VERSION" -lt 10 ]; then\n echoerror "End of life distributions are not supported."\n echoerror "Please consider upgrading to the next stable. See:"\n echoerror " https://wiki.ubuntu.com/Releases"\n exit 1\n fi\n ;;\n\n opensuse)\n # openSUSE versions not supported\n #\n # <= 12.1\n if ([ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$DISTRO_MINOR_VERSION" -eq 1 ]) || [ "$DISTRO_MAJOR_VERSION" -lt 12 ]; then\n echoerror "End of life distributions are not supported."\n echoerror "Please consider upgrading to the next stable. See:"\n echoerror " http://en.opensuse.org/Lifetime"\n exit 1\n fi\n ;;\n\n suse)\n # SuSE versions not supported\n #\n # < 11 SP2\n SUSE_PATCHLEVEL=$(awk \'/PATCHLEVEL/ {print $3}\' /etc/SuSE-release )\n if [ "${SUSE_PATCHLEVEL}" = "" ]; then\n SUSE_PATCHLEVEL="00"\n fi\n if ([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$SUSE_PATCHLEVEL" -lt 02 ]) || [ "$DISTRO_MAJOR_VERSION" -lt 11 ]; then\n echoerror "Versions lower than SuSE 11 SP2 are not supported."\n echoerror "Please consider upgrading to the next stable"\n exit 1\n fi\n ;;\n\n fedora)\n # Fedora lower than 18 are no longer supported\n if [ "$DISTRO_MAJOR_VERSION" -lt 18 ]; then\n echoerror "End of life distributions are not supported."\n echoerror "Please consider upgrading to the next stable. See:"\n echoerror " https://fedoraproject.org/wiki/Releases"\n exit 1\n fi\n ;;\n\n centos)\n # CentOS versions lower than 5 are no longer supported\n if [ "$DISTRO_MAJOR_VERSION" -lt 5 ]; then\n echoerror "End of life distributions are not supported."\n echoerror "Please consider upgrading to the next stable. See:"\n echoerror " http://wiki.centos.org/Download"\n exit 1\n fi\n ;;\n\n red_hat*linux)\n # Red Hat (Enterprise) Linux versions lower than 5 are no longer supported\n if [ "$DISTRO_MAJOR_VERSION" -lt 5 ]; then\n echoerror "End of life distributions are not supported."\n echoerror "Please consider upgrading to the next stable. See:"\n echoerror " https://access.redhat.com/support/policy/updates/errata/"\n exit 1\n fi\n ;;\n\n freebsd)\n # FreeBSD versions lower than 9.1 are not supported.\n if ([ "$DISTRO_MAJOR_VERSION" -eq 9 ] && [ "$DISTRO_MINOR_VERSION" -lt 01 ]) || [ "$DISTRO_MAJOR_VERSION" -lt 9 ]; then\n echoerror "Versions lower than FreeBSD 9.1 are not supported."\n exit 1\n fi\n ;;\n\n *)\n ;;\n esac\n}\n# Fail soon for end of life versions\n__check_end_of_life_versions\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: copyfile\n# DESCRIPTION: Simple function to copy files. Overrides if asked.\n#----------------------------------------------------------------------------------------------------------------------\ncopyfile() {\n overwrite=$_FORCE_OVERWRITE\n if [ $# -eq 2 ]; then\n sfile=$1\n dfile=$2\n elif [ $# -eq 3 ]; then\n sfile=$1\n dfile=$2\n overwrite=$3\n else\n echoerror "Wrong number of arguments for copyfile()"\n echoinfo "USAGE: copyfile <source> <dest> OR copyfile <source> <dest> <overwrite>"\n exit 1\n fi\n\n # Does the source file exist?\n if [ ! -f "$sfile" ]; then\n echowarn "$sfile does not exist!"\n return 1\n fi\n\n # If the destination is a directory, let\'s make it a full path so the logic\n # below works as expected\n if [ -d "$dfile" ]; then\n echodebug "The passed destination($dfile) is a directory"\n dfile="${dfile}/$(basename "$sfile")"\n echodebug "Full destination path is now: $dfile"\n fi\n\n if [ ! -f "$dfile" ]; then\n # The destination file does not exist, copy\n echodebug "Copying $sfile to $dfile"\n cp "$sfile" "$dfile" || return 1\n elif [ -f "$dfile" ] && [ "$overwrite" -eq $BS_TRUE ]; then\n # The destination exist and we\'re overwriting\n echodebug "Overriding $dfile with $sfile"\n cp -f "$sfile" "$dfile" || return 1\n elif [ -f "$dfile" ] && [ "$overwrite" -ne $BS_TRUE ]; then\n echodebug "Not overriding $dfile with $sfile"\n fi\n return 0\n}\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: movefile\n# DESCRIPTION: Simple function to move files. Overrides if asked.\n#----------------------------------------------------------------------------------------------------------------------\nmovefile() {\n overwrite=$_FORCE_OVERWRITE\n if [ $# -eq 2 ]; then\n sfile=$1\n dfile=$2\n elif [ $# -eq 3 ]; then\n sfile=$1\n dfile=$2\n overwrite=$3\n else\n echoerror "Wrong number of arguments for movefile()"\n echoinfo "USAGE: movefile <source> <dest> OR movefile <source> <dest> <overwrite>"\n exit 1\n fi\n\n if [ $_KEEP_TEMP_FILES -eq $BS_TRUE ]; then\n # We\'re being told not to move files, instead copy them so we can keep\n # them around\n echodebug "Since BS_KEEP_TEMP_FILES=1 we\'re copying files instead of moving them"\n copyfile "$sfile" "$dfile" "$overwrite"\n return $?\n fi\n\n # Does the source file exist?\n if [ ! -f "$sfile" ]; then\n echowarn "$sfile does not exist!"\n return 1\n fi\n\n # If the destination is a directory, let\'s make it a full path so the logic\n # below works as expected\n if [ -d "$dfile" ]; then\n echodebug "The passed destination($dfile) is a directory"\n dfile="${dfile}/$(basename "$sfile")"\n echodebug "Full destination path is now: $dfile"\n fi\n\n if [ ! -f "$dfile" ]; then\n # The destination file does not exist, copy\n echodebug "Moving $sfile to $dfile"\n mv "$sfile" "$dfile" || return 1\n elif [ -f "$dfile" ] && [ "$overwrite" -eq $BS_TRUE ]; then\n # The destination exist and we\'re overwriting\n echodebug "Overriding $dfile with $sfile"\n mv -f "$sfile" "$dfile" || return 1\n elif [ -f "$dfile" ] && [ "$overwrite" -ne $BS_TRUE ]; then\n echodebug "Not overriding $dfile with $sfile"\n fi\n\n return 0\n}\n\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __check_services_systemd\n# DESCRIPTION: Return 0 or 1 in case the service is enabled or not\n# PARAMETERS: servicename\n#----------------------------------------------------------------------------------------------------------------------\n__check_services_systemd() {\n if [ $# -eq 0 ]; then\n echoerror "You need to pass a service name to check!"\n exit 1\n elif [ $# -ne 1 ]; then\n echoerror "You need to pass a service name to check as the single argument to the function"\n fi\n\n servicename=$1\n echodebug "Checking if service ${servicename} is enabled"\n\n if [ "$(systemctl is-enabled "${servicename}")" = "enabled" ]; then\n echodebug "Service ${servicename} is enabled"\n return 0\n else\n echodebug "Service ${servicename} is NOT enabled"\n return 1\n fi\n} # ---------- end of function __check_services_systemd ----------\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __check_services_upstart\n# DESCRIPTION: Return 0 or 1 in case the service is enabled or not\n# PARAMETERS: servicename\n#----------------------------------------------------------------------------------------------------------------------\n__check_services_upstart() {\n if [ $# -eq 0 ]; then\n echoerror "You need to pass a service name to check!"\n exit 1\n elif [ $# -ne 1 ]; then\n echoerror "You need to pass a service name to check as the single argument to the function"\n fi\n\n servicename=$1\n echodebug "Checking if service ${servicename} is enabled"\n\n # Check if service is enabled to start at boot\n initctl list | grep "${servicename}" > /dev/null 2>&1\n\n if [ $? -eq 0 ]; then\n echodebug "Service ${servicename} is enabled"\n return 0\n else\n echodebug "Service ${servicename} is NOT enabled"\n return 1\n fi\n} # ---------- end of function __check_services_upstart ----------\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __check_services_sysvinit\n# DESCRIPTION: Return 0 or 1 in case the service is enabled or not\n# PARAMETERS: servicename\n#----------------------------------------------------------------------------------------------------------------------\n__check_services_sysvinit() {\n if [ $# -eq 0 ]; then\n echoerror "You need to pass a service name to check!"\n exit 1\n elif [ $# -ne 1 ]; then\n echoerror "You need to pass a service name to check as the single argument to the function"\n fi\n\n servicename=$1\n echodebug "Checking if service ${servicename} is enabled"\n\n if [ "$(LC_ALL=C /sbin/chkconfig --list | grep salt-"$fname" | grep \'[2-5]:on\')" != "" ]; then\n echodebug "Service ${servicename} is enabled"\n return 0\n else\n echodebug "Service ${servicename} is NOT enabled"\n return 1\n fi\n} # ---------- end of function __check_services_sysvinit ----------\n\n\n#--- FUNCTION -------------------------------------------------------------------------------------------------------\n# NAME: __check_services_debian\n# DESCRIPTION: Return 0 or 1 in case the service is enabled or not\n# PARAMETERS: servicename\n#----------------------------------------------------------------------------------------------------------------------\n__check_services_debian() {\n if [ $# -eq 0 ]; then\n echoerror "You need to pass a service name to check!"\n exit 1\n elif [ $# -ne 1 ]; then\n echoerror "You need to pass a service name to check as the single argument to the function"\n fi\n\n servicename=$1\n echodebug "Checking if service ${servicename} is enabled"\n\n # shellcheck disable=SC2086,SC2046,SC2144\n if [ -f /etc/rc$(runlevel | awk \'{ print $2 }\').d/S*${servicename} ]; then\n echodebug "Service ${servicename} is enabled"\n return 0\n else\n echodebug "Service ${servicename} is NOT enabled"\n return 1\n fi\n} # ---------- end of function __check_services_debian ----------\n\n\n#######################################################################################################################\n#\n# Distribution install functions\n#\n# In order to install salt for a distribution you need to define:\n#\n# To Install Dependencies, which is required, one of:\n# 1. install_<distro>_<major_version>_<install_type>_deps\n# 2. install_<distro>_<major_version>_<minor_version>_<install_type>_deps\n# 3. install_<distro>_<major_version>_deps\n# 4 install_<distro>_<major_version>_<minor_version>_deps\n# 5. install_<distro>_<install_type>_deps\n# 6. install_<distro>_deps\n#\n# Optionally, define a salt configuration function, which will be called if\n# the -c (config-dir) option is passed. One of:\n# 1. config_<distro>_<major_version>_<install_type>_salt\n# 2. config_<distro>_<major_version>_<minor_version>_<install_type>_salt\n# 3. config_<distro>_<major_version>_salt\n# 4 config_<distro>_<major_version>_<minor_version>_salt\n# 5. config_<distro>_<install_type>_salt\n# 6. config_<distro>_salt\n# 7. config_salt [THIS ONE IS ALREADY DEFINED AS THE DEFAULT]\n#\n# Optionally, define a salt master pre-seed function, which will be called if\n# the -k (pre-seed master keys) option is passed. One of:\n# 1. preseed_<distro>_<major_version>_<install_type>_master\n# 2. preseed_<distro>_<major_version>_<minor_version>_<install_type>_master\n# 3. preseed_<distro>_<major_version>_master\n# 4 preseed_<distro>_<major_version>_<minor_version>_master\n# 5. preseed_<distro>_<install_type>_master\n# 6. preseed_<distro>_master\n# 7. preseed_master [THIS ONE IS ALREADY DEFINED AS THE DEFAULT]\n#\n# To install salt, which, of course, is required, one of:\n# 1. install_<distro>_<major_version>_<install_type>\n# 2. install_<distro>_<major_version>_<minor_version>_<install_type>\n# 3. install_<distro>_<install_type>\n#\n# Optionally, define a post install function, one of:\n# 1. install_<distro>_<major_version>_<install_type>_post\n# 2. install_<distro>_<major_version>_<minor_version>_<install_type>_post\n# 3. install_<distro>_<major_version>_post\n# 4 install_<distro>_<major_version>_<minor_version>_post\n# 5. install_<distro>_<install_type>_post\n# 6. install_<distro>_post\n#\n# Optionally, define a start daemons function, one of:\n# 1. install_<distro>_<major_version>_<install_type>_restart_daemons\n# 2. install_<distro>_<major_version>_<minor_version>_<install_type>_restart_daemons\n# 3. install_<distro>_<major_version>_restart_daemons\n# 4 install_<distro>_<major_version>_<minor_version>_restart_daemons\n# 5. install_<distro>_<install_type>_restart_daemons\n# 6. install_<distro>_restart_daemons\n#\n# NOTE: The start daemons function should be able to restart any daemons\n# which are running, or start if they\'re not running.\n#\n# Optionally, define a daemons running function, one of:\n# 1. daemons_running_<distro>_<major_version>_<install_type>\n# 2. daemons_running_<distro>_<major_version>_<minor_version>_<install_type>\n# 3. daemons_running_<distro>_<major_version>\n# 4 daemons_running_<distro>_<major_version>_<minor_version>\n# 5. daemons_running_<distro>_<install_type>\n# 6. daemons_running_<distro>\n# 7. daemons_running [THIS ONE IS ALREADY DEFINED AS THE DEFAULT]\n#\n# Optionally, check enabled Services:\n# 1. install_<distro>_<major_version>_<install_type>_check_services\n# 2. install_<distro>_<major_version>_<minor_version>_<install_type>_check_services\n# 3. install_<distro>_<major_version>_check_services\n# 4 install_<distro>_<major_version>_<minor_version>_check_services\n# 5. install_<distro>_<install_type>_check_services\n# 6. install_<distro>_check_services\n#\n#######################################################################################################################\n\n\n#######################################################################################################################\n#\n# Ubuntu Install Functions\n#\n__enable_universe_repository() {\n if [ "$(grep -R universe /etc/apt/sources.list /etc/apt/sources.list.d/ | grep -v \'#\')" != "" ]; then\n # The universe repository is already enabled\n return 0\n fi\n\n echodebug "Enabling the universe repository"\n\n # Ubuntu versions higher than 12.04 do not live in the old repositories\n if [ "$DISTRO_MAJOR_VERSION" -gt 12 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$DISTRO_MINOR_VERSION" -gt 04 ]); then\n add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1\n elif [ "$DISTRO_MAJOR_VERSION" -lt 11 ] && [ "$DISTRO_MINOR_VERSION" -lt 10 ]; then\n # Below Ubuntu 11.10, the -y flag to add-apt-repository is not supported\n add-apt-repository "deb http://old-releases.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1\n fi\n\n add-apt-repository -y "deb http://old-releases.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1\n\n return 0\n}\n\ninstall_ubuntu_deps() {\n if ([ "${__DEFAULT_SLEEP}" -eq "${__DEFAULT_SLEEP_ORIGINAL}" ] && [ "$DISTRO_MAJOR_VERSION" -lt 15 ]); then\n # The user did not pass a custom sleep value as an argument, let\'s increase the default value\n echodebug "On Ubuntu systems we increase the default sleep value to 10."\n echodebug "See https://github.com/saltstack/salt/issues/12248 for more info."\n __DEFAULT_SLEEP=10\n fi\n if [ $_START_DAEMONS -eq $BS_FALSE ]; then\n echowarn "Not starting daemons on Debian based distributions is not working mostly because starting them is the default behaviour."\n fi\n # No user interaction, libc6 restart services for example\n export DEBIAN_FRONTEND=noninteractive\n\n apt-get update\n\n # Install Keys\n __apt_get_install_noinput debian-archive-keyring && apt-get update\n\n if [ "$DISTRO_MAJOR_VERSION" -gt 12 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$DISTRO_MINOR_VERSION" -eq 10 ]); then\n # Above Ubuntu 12.04 add-apt-repository is in a different package\n __apt_get_install_noinput software-properties-common || return 1\n else\n __apt_get_install_noinput python-software-properties || return 1\n fi\n\n __enable_universe_repository || return 1\n\n if [ "$DISTRO_MAJOR_VERSION" -gt 11 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$DISTRO_MINOR_VERSION" -gt 04 ]); then\n # Above Ubuntu 11.04 add a -y flag\n add-apt-repository -y ppa:saltstack/salt || return 1\n else\n add-apt-repository ppa:saltstack/salt || return 1\n fi\n\n apt-get update\n\n # Minimal systems might not have upstart installed, install it\n __apt_get_install_noinput upstart\n\n # Need python-apt for managing packages via Salt\n __apt_get_install_noinput python-apt\n\n if ([ "$DISTRO_MAJOR_VERSION" -gt 12 ] && [ "$DISTRO_MAJOR_VERSION" -lt 15 ]) || ([ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$DISTRO_MINOR_VERSION" -gt 03 ]); then\n if [ "$_ENABLE_EXTERNAL_ZMQ_REPOS" -eq $BS_TRUE ]; then\n echoinfo "Installing ZMQ>=4/PyZMQ>=14 from Chris Lea\'s PPA repository"\n add-apt-repository -y ppa:chris-lea/zeromq || return 1\n apt-get update\n fi\n __apt_get_install_noinput python-requests\n __PIP_PACKAGES=""\n elif [ "$DISTRO_MAJOR_VERSION" -lt 15 ]; then\n check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package \'requests\'"\n __apt_get_install_noinput python-setuptools python-pip\n # shellcheck disable=SC2089\n __PIP_PACKAGES="\'requests>=$_PY_REQUESTS_MIN_VERSION\'"\n elif [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; then\n __apt_get_install_noinput python-requests\n __PIP_PACKAGES=""\n fi\n\n # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813\n __apt_get_install_noinput procps pciutils\n\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n check_pip_allowed "You need to allow pip based installations (-P) in order to install \'apache-libcloud\'"\n if [ "${__PIP_PACKAGES}" = "" ]; then\n __apt_get_install_noinput python-pip\n fi\n # shellcheck disable=SC2089\n __PIP_PACKAGES="${__PIP_PACKAGES} \'apache-libcloud>=$_LIBCLOUD_MIN_VERSION\'"\n fi\n\n if [ "${__PIP_PACKAGES}" != "" ]; then\n # shellcheck disable=SC2086,SC2090\n pip install -U ${__PIP_PACKAGES}\n fi\n\n if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then\n __apt_get_upgrade_noinput || return 1\n fi\n\n if [ "${_EXTRA_PACKAGES}" != "" ]; then\n echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"\n # shellcheck disable=SC2086\n __apt_get_install_noinput ${_EXTRA_PACKAGES} || return 1\n fi\n\n return 0\n}\n\ninstall_ubuntu_daily_deps() {\n install_ubuntu_deps || return 1\n if [ "$DISTRO_MAJOR_VERSION" -ge 12 ]; then\n # Above Ubuntu 11.10 add-apt-repository is in a different package\n __apt_get_install_noinput software-properties-common || return 1\n else\n __apt_get_install_noinput python-software-properties || return 1\n fi\n\n __enable_universe_repository || return 1\n\n # for anything up to and including 11.04 do not use the -y option\n if [ "$DISTRO_MAJOR_VERSION" -gt 11 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$DISTRO_MINOR_VERSION" -gt 04 ]); then\n # Above Ubuntu 11.04 add a -y flag\n add-apt-repository -y ppa:saltstack/salt-daily || return 1\n else\n add-apt-repository ppa:saltstack/salt-daily || return 1\n fi\n\n apt-get update\n\n if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then\n __apt_get_upgrade_noinput || return 1\n fi\n\n return 0\n}\n\ninstall_ubuntu_git_deps() {\n install_ubuntu_deps || return 1\n __apt_get_install_noinput git-core python-yaml python-m2crypto python-crypto \\\n msgpack-python python-zmq python-jinja2 || return 1\n\n __git_clone_and_checkout || return 1\n\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then\n # We\'re on the develop branch, install whichever tornado is on the requirements file\n __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"\n if [ "${__REQUIRED_TORNADO}" != "" ]; then\n check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package \'${__REQUIRED_TORNADO}\'"\n if [ "$(which pip)" = "" ]; then\n __apt_get_install_noinput python-setuptools python-pip\n fi\n pip install -U "\'${__REQUIRED_TORNADO}\'"\n fi\n fi\n\n # Let\'s trigger config_salt()\n if [ "$_TEMP_CONFIG_DIR" = "null" ]; then\n _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"\n CONFIG_SALT_FUNC="config_salt"\n fi\n\n return 0\n}\n\ninstall_ubuntu_stable() {\n __PACKAGES=""\n if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then\n __PACKAGES="${__PACKAGES} salt-minion"\n fi\n if [ "$_INSTALL_MASTER" -eq $BS_TRUE ]; then\n __PACKAGES="${__PACKAGES} salt-master"\n fi\n if [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ]; then\n __PACKAGES="${__PACKAGES} salt-syndic"\n fi\n # shellcheck disable=SC2086\n __apt_get_install_noinput ${__PACKAGES} || return 1\n return 0\n}\n\ninstall_ubuntu_daily() {\n install_ubuntu_stable || return 1\n return 0\n}\n\ninstall_ubuntu_git() {\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then\n python setup.py install --install-layout=deb --salt-config-dir="$_SALT_ETC_DIR" || return 1\n else\n python setup.py install --install-layout=deb || return 1\n fi\n return 0\n}\n\ninstall_ubuntu_git_post() {\n for fname in minion master syndic api; do\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ -f /bin/systemctl ]; then\n copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service"\n\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service)\n sleep 0.1\n systemctl daemon-reload\n elif [ -f /sbin/initctl ]; then\n _upstart_conf="/etc/init/salt-$fname.conf"\n # We have upstart support\n echodebug "There\'s upstart support"\n if [ ! -f $_upstart_conf ]; then\n # upstart does not know about our service, let\'s copy the proper file\n echowarn "Upstart does not appear to know about salt-$fname"\n echodebug "Copying ${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-$fname.upstart to $_upstart_conf"\n copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.upstart" $_upstart_conf\n fi\n # No upstart support in Ubuntu!?\n elif [ -f "${__SALT_GIT_CHECKOUT_DIR}/debian/salt-${fname}.init" ]; then\n echodebug "There\'s NO upstart support!?"\n echodebug "Copying ${__SALT_GIT_CHECKOUT_DIR}/debian/salt-${fname}.init to /etc/init.d/salt-$fname"\n copyfile "${__SALT_GIT_CHECKOUT_DIR}/debian/salt-${fname}.init" "/etc/init.d/salt-$fname"\n chmod +x /etc/init.d/salt-$fname\n\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n update-rc.d salt-$fname defaults\n else\n echoerror "Neither upstart not init.d was setup for salt-$fname"\n fi\n done\n}\n\ninstall_ubuntu_restart_daemons() {\n [ $_START_DAEMONS -eq $BS_FALSE ] && return\n\n # Ensure upstart configs are loaded\n if [ -f /bin/systemctl ]; then\n systemctl daemon-reload\n elif [ -f /sbin/initctl ]; then\n /sbin/initctl reload-configuration\n fi\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ -f /bin/systemctl ]; then\n echodebug "There\'s systemd support while checking salt-$fname"\n systemctl stop salt-$fname > /dev/null 2>&1\n systemctl start salt-$fname.service\n [ $? -eq 0 ] && continue\n # We failed to start the service, let\'s test the SysV code below\n echodebug "Failed to start salt-$fname using systemd"\n fi\n\n if [ -f /sbin/initctl ]; then\n echodebug "There\'s upstart support while checking salt-$fname"\n\n status salt-$fname 2>/dev/null | grep -q running\n if [ $? -eq 0 ]; then\n stop salt-$fname || (echodebug "Failed to stop salt-$fname" && return 1)\n fi\n\n start salt-$fname\n [ $? -eq 0 ] && continue\n # We failed to start the service, let\'s test the SysV code below\n echodebug "Failed to start salt-$fname using Upstart"\n fi\n\n if [ ! -f /etc/init.d/salt-$fname ]; then\n echoerror "No init.d support for salt-$fname was found"\n return 1\n fi\n\n /etc/init.d/salt-$fname stop > /dev/null 2>&1\n /etc/init.d/salt-$fname start\n done\n return 0\n}\n\ninstall_ubuntu_check_services() {\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ -f /bin/systemctl ]; then\n __check_services_systemd salt-$fname || return 1\n elif [ -f /sbin/initctl ] && [ -f /etc/init/salt-${fname}.conf ]; then\n __check_services_upstart salt-$fname || return 1\n elif [ -f /etc/init.d/salt-$fname ]; then\n __check_services_debian salt-$fname || return 1\n fi\n done\n return 0\n}\n#\n# End of Ubuntu Install Functions\n#\n#######################################################################################################################\n\n#######################################################################################################################\n#\n# Debian Install Functions\n#\ninstall_debian_deps() {\n if [ $_START_DAEMONS -eq $BS_FALSE ]; then\n echowarn "Not starting daemons on Debian based distributions is not working mostly because starting them is the default behaviour."\n fi\n # No user interaction, libc6 restart services for example\n export DEBIAN_FRONTEND=noninteractive\n\n apt-get update\n\n # Install Keys\n __apt_get_install_noinput debian-archive-keyring && apt-get update\n\n # Install procps and pciutils which allows for Docker bootstraps. See #366#issuecomment-39666813\n __PACKAGES="procps pciutils"\n __PIP_PACKAGES=""\n\n if [ "$DISTRO_MAJOR_VERSION" -lt 7 ]; then\n # Both python-requests which is a hard dependency and apache-libcloud which is a soft dependency, under debian < 7\n # need to be installed using pip\n check_pip_allowed "You need to allow pip based installations (-P) in order to install the python \'requests\' package"\n # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813\n __PACKAGES="${__PACKAGES} python-pip"\n # shellcheck disable=SC2089\n __PIP_PACKAGES="${__PIP_PACKAGES} \'requests>=$_PY_REQUESTS_MIN_VERSION\'"\n fi\n\n # shellcheck disable=SC2086\n __apt_get_install_noinput ${__PACKAGES}\n\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n # shellcheck disable=SC2089\n __PIP_PACKAGES="${__PIP_PACKAGES} \'apache-libcloud>=$_LIBCLOUD_MIN_VERSION\'"\n fi\n # shellcheck disable=SC2086,SC2090\n pip install -U ${__PIP_PACKAGES}\n\n if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then\n __apt_get_upgrade_noinput || return 1\n fi\n\n if [ "${_EXTRA_PACKAGES}" != "" ]; then\n echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"\n # shellcheck disable=SC2086\n __apt_get_install_noinput ${_EXTRA_PACKAGES} || return 1\n fi\n\n return 0\n}\n\ninstall_debian_6_deps() {\n if [ $_START_DAEMONS -eq $BS_FALSE ]; then\n echowarn "Not starting daemons on Debian based distributions is not working mostly because starting them is the default behaviour."\n fi\n # No user interaction, libc6 restart services for example\n export DEBIAN_FRONTEND=noninteractive\n\n apt-get update\n\n # Make sure wget is available\n __apt_get_install_noinput wget\n\n # Install Keys\n __apt_get_install_noinput debian-archive-keyring && apt-get update\n\n # Install Debian Archive Automatic Signing Key (6.0/squeeze), see #557\n if [ "$(apt-key finger | grep \'9FED 2BCB DCD2 9CDF 7626 78CB AED4 B06F 4730 41FA\')" = "" ]; then\n apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AED4B06F473041FA || return 1\n fi\n\n # shellcheck disable=SC2086\n wget $_WGET_ARGS -q http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key -O - | apt-key add - || return 1\n\n if [ "$_PIP_ALLOWED" -eq $BS_TRUE ]; then\n echowarn "PyZMQ will be installed from PyPI in order to compile it against ZMQ3"\n echowarn "This is required for long term stable minion connections to the master."\n echowarn "YOU WILL END UP WITH QUITE A FEW PACKAGES FROM DEBIAN UNSTABLE"\n echowarn "Sleeping for 5 seconds so you can cancel..."\n sleep 5\n\n if [ ! -f /etc/apt/sources.list.d/debian-unstable.list ]; then\n cat <<_eof > /etc/apt/sources.list.d/debian-unstable.list\ndeb http://ftp.debian.org/debian unstable main\ndeb-src http://ftp.debian.org/debian unstable main\n_eof\n\n cat <<_eof > /etc/apt/preferences.d/libzmq3-debian-unstable.pref\nPackage: libzmq3\nPin: release a=unstable\nPin-Priority: 800\n\nPackage: libzmq3-dev\nPin: release a=unstable\nPin-Priority: 800\n_eof\n fi\n\n apt-get update\n # We NEED to install the unstable dpkg or mime-support WILL fail to install\n __apt_get_install_noinput -t unstable dpkg liblzma5 python mime-support || return 1\n __apt_get_install_noinput -t unstable libzmq3 libzmq3-dev || return 1\n __apt_get_install_noinput build-essential python-dev python-pip || return 1\n\n # Saltstack\'s Unstable Debian repository\n if [ "$(grep -R \'debian.saltstack.com\' /etc/apt)" = "" ]; then\n echo "deb http://debian.saltstack.com/debian unstable main" >> \\\n /etc/apt/sources.list.d/saltstack.list\n fi\n return 0\n fi\n\n # Debian Backports\n if [ "$(grep -R \'squeeze-backports\' /etc/apt | grep -v "^#")" = "" ]; then\n echo "deb http://ftp.de.debian.org/debian-backports squeeze-backports main" >> \\\n /etc/apt/sources.list.d/backports.list\n fi\n\n # Saltstack\'s Stable Debian repository\n if [ "$(grep -R \'squeeze-saltstack\' /etc/apt)" = "" ]; then\n echo "deb http://debian.saltstack.com/debian squeeze-saltstack main" >> \\\n /etc/apt/sources.list.d/saltstack.list\n fi\n apt-get update || return 1\n\n # Python requests is available through Squeeze backports\n # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813\n __apt_get_install_noinput python-pip procps pciutils\n\n # Need python-apt for managing packages via Salt\n __apt_get_install_noinput python-apt\n\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud/requests"\n __apt_get_install_noinput python-pip\n pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION \'requests>=$_PY_REQUESTS_MIN_VERSION\'"\n\n fi\n\n if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then\n __apt_get_upgrade_noinput || return 1\n fi\n\n __apt_get_install_noinput python-zmq || return 1\n\n if [ "${_EXTRA_PACKAGES}" != "" ]; then\n echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"\n # shellcheck disable=SC2086\n __apt_get_install_noinput ${_EXTRA_PACKAGES} || return 1\n fi\n\n return 0\n}\n\ninstall_debian_7_deps() {\n if [ $_START_DAEMONS -eq $BS_FALSE ]; then\n echowarn "Not starting daemons on Debian based distributions is not working mostly because starting them is the default behaviour."\n fi\n # No user interaction, libc6 restart services for example\n export DEBIAN_FRONTEND=noninteractive\n\n apt-get update\n\n # Make sure wget is available\n __apt_get_install_noinput wget\n\n # Install Keys\n __apt_get_install_noinput debian-archive-keyring && apt-get update\n\n # Install Debian Archive Automatic Signing Key (7.0/wheezy), see #557\n if [ "$(apt-key finger | grep \'A1BD 8E9D 78F7 FE5C 3E65 D8AF 8B48 AD62 4692 5553\')" = "" ]; then\n apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553 || return 1\n fi\n\n # Debian Backports\n if [ "$(grep -R \'wheezy-backports\' /etc/apt | grep -v "^#")" = "" ]; then\n echo "deb http://http.debian.net/debian wheezy-backports main" >> \\\n /etc/apt/sources.list.d/backports.list\n fi\n\n # Saltstack\'s Stable Debian repository\n if [ "$(grep -R \'wheezy-saltstack\' /etc/apt)" = "" ]; then\n echo "deb http://debian.saltstack.com/debian wheezy-saltstack main" >> \\\n /etc/apt/sources.list.d/saltstack.list\n fi\n\n # shellcheck disable=SC2086\n wget $_WGET_ARGS -q http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key -O - | apt-key add - || return 1\n\n apt-get update || return 1\n __apt_get_install_noinput -t wheezy-backports libzmq3 libzmq3-dev python-zmq python-apt || return 1\n # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813\n __PACKAGES="procps pciutils"\n # shellcheck disable=SC2086\n __apt_get_install_noinput ${__PACKAGES} || return 1\n\n\n check_pip_allowed "You need to allow pip based installations (-P) in order to install requests"\n __PACKAGES="build-essential python-dev python-pip"\n # shellcheck disable=SC2086\n __apt_get_install_noinput ${__PACKAGES} || return 1\n pip install -U "requests>=$_PY_REQUESTS_MIN_VERSION"\n\n\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud"\n pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION"\n fi\n\n if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then\n __apt_get_upgrade_noinput || return 1\n fi\n\n if [ "${_EXTRA_PACKAGES}" != "" ]; then\n echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"\n # shellcheck disable=SC2086\n __apt_get_install_noinput ${_EXTRA_PACKAGES} || return 1\n fi\n\n return 0\n}\n\ninstall_debian_8_deps() {\n echodebug "install_debian_8_deps"\n\n if [ $_START_DAEMONS -eq $BS_FALSE ]; then\n echowarn "Not starting daemons on Debian based distributions is not working mostly because starting them is the default behaviour."\n fi\n # No user interaction, libc6 restart services for example\n export DEBIAN_FRONTEND=noninteractive\n\n apt-get update\n\n # Make sure wget is available\n __apt_get_install_noinput wget\n\n # Install Keys\n __apt_get_install_noinput debian-archive-keyring && apt-get update\n\n # Install Debian Archive Automatic Signing Key (8/jessie), see #557\n if [ "$(apt-key finger | grep \'126C 0D24 BD8A 2942 CC7D F8AC 7638 D044 2B90 D010\')" = "" ]; then\n apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010 || return 1\n fi\n\n # Debian Backports\n if [ "$(grep -R \'jessie-backports\' /etc/apt | grep -v "^#")" = "" ]; then\n echo "deb http://http.debian.net/debian jessie-backports main" >> \\\n /etc/apt/sources.list.d/backports.list\n fi\n\n # Saltstack\'s Stable Debian repository\n if [ "$(grep -R \'jessie-saltstack\' /etc/apt)" = "" ]; then\n echo "deb http://debian.saltstack.com/debian jessie-saltstack main" >> \\\n /etc/apt/sources.list.d/saltstack.list\n fi\n\n # shellcheck disable=SC2086\n wget $_WGET_ARGS -q http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key -O - | apt-key add - || return 1\n\n apt-get update || return 1\n __apt_get_install_noinput -t jessie-backports libzmq3 libzmq3-dev python-zmq python-requests python-apt || return 1\n\n # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813\n __PACKAGES="procps pciutils"\n # shellcheck disable=SC2086\n __apt_get_install_noinput ${__PACKAGES} || return 1\n\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud"\n __PACKAGES="build-essential python-dev python-pip"\n # shellcheck disable=SC2086\n __apt_get_install_noinput ${__PACKAGES} || return 1\n pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION"\n fi\n\n if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then\n __apt_get_upgrade_noinput || return 1\n fi\n\n if [ "${_EXTRA_PACKAGES}" != "" ]; then\n echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"\n # shellcheck disable=SC2086\n __apt_get_install_noinput ${_EXTRA_PACKAGES} || return 1\n fi\n\n return 0\n}\n\ninstall_debian_git_deps() {\n if [ $_START_DAEMONS -eq $BS_FALSE ]; then\n echowarn "Not starting daemons on Debian based distributions is not working mostly because starting them is the default behaviour."\n fi\n # No user interaction, libc6 restart services for example\n export DEBIAN_FRONTEND=noninteractive\n\n apt-get update\n\n # Install Keys\n __apt_get_install_noinput debian-archive-keyring && apt-get update\n\n if [ "$(which git)" = "" ]; then\n __apt_get_install_noinput git || return 1\n fi\n\n __apt_get_install_noinput lsb-release python python-pkg-resources python-crypto \\\n python-jinja2 python-m2crypto python-yaml msgpack-python python-pip || return 1\n\n __git_clone_and_checkout || return 1\n\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then\n # We\'re on the develop branch, install whichever tornado is on the requirements file\n __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"\n if [ "${__REQUIRED_TORNADO}" != "" ]; then\n check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package \'${__REQUIRED_TORNADO}\'"\n pip install -U "\'${__REQUIRED_TORNADO}\'"\n fi\n fi\n\n # Let\'s trigger config_salt()\n if [ "$_TEMP_CONFIG_DIR" = "null" ]; then\n _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"\n CONFIG_SALT_FUNC="config_salt"\n fi\n\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud"\n pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION"\n fi\n\n if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then\n __apt_get_upgrade_noinput || return 1\n fi\n\n if [ "${_EXTRA_PACKAGES}" != "" ]; then\n echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"\n # shellcheck disable=SC2086\n __apt_get_install_noinput ${_EXTRA_PACKAGES} || return 1\n fi\n\n return 0\n}\n\ninstall_debian_6_git_deps() {\n install_debian_6_deps || return 1\n if [ "$_PIP_ALLOWED" -eq $BS_TRUE ]; then\n easy_install -U Jinja2 || return 1\n\n if [ "$(which git)" = "" ]; then\n __apt_get_install_noinput git || return 1\n fi\n\n __apt_get_install_noinput lsb-release python python-pkg-resources python-crypto \\\n python-m2crypto python-yaml msgpack-python python-pip || return 1\n\n __git_clone_and_checkout || return 1\n\n # Let\'s trigger config_salt()\n if [ "$_TEMP_CONFIG_DIR" = "null" ]; then\n _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"\n CONFIG_SALT_FUNC="config_salt"\n fi\n else\n install_debian_git_deps || return 1 # Grab the actual deps\n fi\n\n if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then\n __apt_get_upgrade_noinput || return 1\n fi\n\n return 0\n}\n\ninstall_debian_7_git_deps() {\n install_debian_7_deps || return 1\n install_debian_git_deps || return 1 # Grab the actual deps\n return 0\n}\n\ninstall_debian_8_git_deps() {\n install_debian_8_deps || return 1\n install_debian_git_deps || return 1 # Grab the actual deps\n return 0\n}\n\n__install_debian_stable() {\n __PACKAGES=""\n if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then\n __PACKAGES="${__PACKAGES} salt-minion"\n fi\n if [ "$_INSTALL_MASTER" -eq $BS_TRUE ]; then\n __PACKAGES="${__PACKAGES} salt-master"\n fi\n if [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ]; then\n __PACKAGES="${__PACKAGES} salt-syndic"\n fi\n # shellcheck disable=SC2086\n __apt_get_install_noinput ${__PACKAGES} || return 1\n\n if [ "$_PIP_ALLOWED" -eq $BS_TRUE ]; then\n # Building pyzmq from source to build it against libzmq3.\n # Should override current installation\n # Using easy_install instead of pip because at least on Debian 6,\n # there\'s no default virtualenv active.\n easy_install -U pyzmq || return 1\n fi\n\n return 0\n}\n\n\ninstall_debian_6_stable() {\n __install_debian_stable || return 1\n return 0\n}\n\ninstall_debian_7_stable() {\n __install_debian_stable || return 1\n return 0\n}\n\ninstall_debian_8_stable() {\n __install_debian_stable || return 1\n return 0\n}\n\ninstall_debian_git() {\n if [ "$_PIP_ALLOWED" -eq $BS_TRUE ]; then\n # Building pyzmq from source to build it against libzmq3.\n # Should override current installation\n # Using easy_install instead of pip because at least on Debian 6,\n # there\'s no default virtualenv active.\n easy_install -U pyzmq || return 1\n fi\n\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then\n python setup.py install --install-layout=deb --salt-config-dir="$_SALT_ETC_DIR" || return 1\n else\n python setup.py install --install-layout=deb || return 1\n fi\n}\n\ninstall_debian_6_git() {\n install_debian_git || return 1\n return 0\n}\n\ninstall_debian_7_git() {\n install_debian_git || return 1\n return 0\n}\n\ninstall_debian_8_git() {\n install_debian_git || return 1\n return 0\n}\n\ninstall_debian_git_post() {\n for fname in minion master syndic api; do\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ -f /bin/systemctl ]; then\n if [ ! -f /etc/systemd/system/salt-${fname}.service ] || ([ -f /etc/systemd/system/salt-${fname}.service ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then\n copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" /etc/systemd/system\n fi\n\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n /bin/systemctl enable salt-${fname}.service\n SYSTEMD_RELOAD=$BS_TRUE\n\n elif [ ! -f /etc/init.d/salt-$fname ] || ([ -f /etc/init.d/salt-$fname ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init" ]; then\n copyfile "${__SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init" "/etc/init.d/salt-$fname"\n fi\n if [ ! -f "/etc/init.d/salt-$fname" ]; then\n echowarn "The init script for salt-$fname was not found, skipping it..."\n continue\n fi\n chmod +x "/etc/init.d/salt-$fname"\n\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n update-rc.d "salt-$fname" defaults\n fi\n\n done\n}\n\ninstall_debian_restart_daemons() {\n [ "$_START_DAEMONS" -eq $BS_FALSE ] && return\n\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ ! -f "/etc/init.d/salt-$fname" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n if [ -f /bin/systemctl ]; then\n # Debian 8 uses systemd\n /bin/systemctl stop salt-$fname > /dev/null 2>&1\n /bin/systemctl start salt-$fname.service\n elif [ -f /etc/init.d/salt-$fname ]; then\n # Still in SysV init\n /etc/init.d/salt-$fname stop > /dev/null 2>&1\n /etc/init.d/salt-$fname start\n fi\n done\n}\n\ninstall_debian_check_services() {\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ ! -f "/etc/init.d/salt-$fname" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n if [ -f /bin/systemctl ]; then\n __check_services_systemd salt-$fname || return 1\n elif [ -f /etc/init.d/salt-$fname ]; then\n __check_services_debian salt-$fname || return 1\n fi\n done\n return 0\n}\n#\n# Ended Debian Install Functions\n#\n#######################################################################################################################\n\n#######################################################################################################################\n#\n# Fedora Install Functions\n#\ninstall_fedora_deps() {\n if [ "$_ENABLE_EXTERNAL_ZMQ_REPOS" -eq $BS_TRUE ]; then\n __install_saltstack_copr_zeromq_repository || return 1\n fi\n\n __install_saltstack_copr_salt_repository || return 1\n\n __PACKAGES="yum-utils PyYAML libyaml m2crypto python-crypto python-jinja2 python-msgpack python-zmq python-requests"\n\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n __PACKAGES="${__PACKAGES} python-libcloud"\n fi\n\n # shellcheck disable=SC2086\n yum install -y ${__PACKAGES} || return 1\n\n if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then\n yum -y update || return 1\n fi\n\n if [ "${_EXTRA_PACKAGES}" != "" ]; then\n echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"\n # shellcheck disable=SC2086\n yum install -y ${_EXTRA_PACKAGES} || return 1\n fi\n\n return 0\n}\n\ninstall_fedora_stable() {\n __PACKAGES=""\n if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then\n __PACKAGES="${__PACKAGES} salt-minion"\n fi\n if [ "$_INSTALL_MASTER" -eq $BS_TRUE ] || [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ]; then\n __PACKAGES="${__PACKAGES} salt-master"\n fi\n # shellcheck disable=SC2086\n yum install -y ${__PACKAGES} || return 1\n return 0\n}\n\ninstall_fedora_stable_post() {\n for fname in minion master syndic api; do\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service)\n sleep 0.1\n systemctl daemon-reload\n done\n}\n\ninstall_fedora_git_deps() {\n install_fedora_deps || return 1\n\n if [ "$(which git)" = "" ]; then\n yum install -y git || return 1\n fi\n\n yum install -y systemd-python || return 1\n\n __git_clone_and_checkout || return 1\n\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then\n # We\'re on the develop branch, install whichever tornado is on the requirements file\n __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"\n if [ "${__REQUIRED_TORNADO}" != "" ]; then\n yum install -y python-tornado\n fi\n fi\n\n # Let\'s trigger config_salt()\n if [ "$_TEMP_CONFIG_DIR" = "null" ]; then\n _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"\n CONFIG_SALT_FUNC="config_salt"\n fi\n\n return 0\n}\n\ninstall_fedora_git() {\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then\n python setup.py install --salt-config-dir="$_SALT_ETC_DIR" || return 1\n else\n python setup.py install || return 1\n fi\n return 0\n}\n\ninstall_fedora_git_post() {\n for fname in minion master syndic api; do\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service"\n\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service)\n sleep 0.1\n systemctl daemon-reload\n done\n}\n\ninstall_fedora_restart_daemons() {\n [ $_START_DAEMONS -eq $BS_FALSE ] && return\n\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n systemctl stop salt-$fname > /dev/null 2>&1\n systemctl start salt-$fname.service\n done\n}\n\ninstall_fedora_check_services() {\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n __check_services_systemd salt-$fname || return 1\n done\n return 0\n}\n#\n# Ended Fedora Install Functions\n#\n#######################################################################################################################\n\n#######################################################################################################################\n#\n# CentOS Install Functions\n#\n__install_epel_repository() {\n if [ ${__EPEL_REPOS_INSTALLED} -eq $BS_TRUE ]; then\n return 0\n fi\n\n # Check if epel repo is already enabled and flag it accordingly\n yum repolist | grep -i "epel" > /dev/null 2>&1\n if [ $? -eq 0 ]; then\n __EPEL_REPOS_INSTALLED=${BS_TRUE}\n return 0\n fi\n\n # Check if epel-release is already installed and flag it accordingly\n rpm --nodigest --nosignature -q epel-release > /dev/null 2>&1\n if [ $? -eq 0 ]; then\n __EPEL_REPOS_INSTALLED=${BS_TRUE}\n return 0\n fi\n\n if [ "$CPU_ARCH_L" = "i686" ]; then\n EPEL_ARCH="i386"\n else\n EPEL_ARCH=$CPU_ARCH_L\n fi\n if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then\n # Use dl.fedoraproject.org to avoid redirect breakage:\n # https://lists.fedoraproject.org/pipermail/users/2012-February/414558.html\n rpm -Uvh --force "http://dl.fedoraproject.org/pub/epel/5/${EPEL_ARCH}/epel-release-5-4.noarch.rpm" || return 1\n elif [ "$DISTRO_MAJOR_VERSION" -eq 6 ]; then\n rpm -Uvh --force "http://download.fedoraproject.org/pub/epel/6/${EPEL_ARCH}/epel-release-6-8.noarch.rpm" || return 1\n elif [ "$DISTRO_MAJOR_VERSION" -eq 7 ]; then\n rpm -Uvh --force "http://download.fedoraproject.org/pub/epel/7/${EPEL_ARCH}/e/epel-release-7-5.noarch.rpm" || return 1\n else\n echoerror "Failed add EPEL repository support."\n return 1\n fi\n __EPEL_REPOS_INSTALLED=${BS_TRUE}\n return 0\n}\n\n__install_saltstack_copr_zeromq_repository() {\n echoinfo "Installing Zeromq >=4 and PyZMQ>=14 from SaltStack\'s COPR repository"\n if [ ! -s /etc/yum.repos.d/saltstack-zeromq4.repo ]; then\n if [ "${DISTRO_NAME_L}" = "fedora" ]; then\n __REPOTYPE="${DISTRO_NAME_L}"\n else\n __REPOTYPE="epel"\n fi\n __fetch_url /etc/yum.repos.d/saltstack-zeromq4.repo \\\n "http://copr.fedoraproject.org/coprs/saltstack/zeromq4/repo/${__REPOTYPE}-${DISTRO_MAJOR_VERSION}/saltstack-zeromq4-${__REPOTYPE}-${DISTRO_MAJOR_VERSION}.repo" || return 1\n fi\n return 0\n}\n\n__install_saltstack_copr_salt_el5_repository() {\n if [ ! -s /etc/yum.repos.d/saltstack-salt-el5-epel-5.repo ]; then\n __fetch_url /etc/yum.repos.d/saltstack-salt-el5-epel-5.repo \\\n "http://copr.fedoraproject.org/coprs/saltstack/salt-el5/repo/epel-5/saltstack-salt-el5-epel-5.repo" || return 1\n fi\n return 0\n}\n\n__install_saltstack_copr_salt_repository() {\n echoinfo "Adding SaltStack\'s COPR repository"\n\n if [ "${DISTRO_NAME_L}" = "fedora" ]; then\n __REPOTYPE="${DISTRO_NAME_L}"\n else\n __REPOTYPE="epel"\n fi\n\n __REPO_FILENAME="saltstack-salt-${__REPOTYPE}-${DISTRO_MAJOR_VERSION}.repo"\n\n if [ ! -s "/etc/yum.repos.d/${__REPO_FILENAME}" ]; then\n __fetch_url "/etc/yum.repos.d/${__REPO_FILENAME}" \\\n "http://copr.fedoraproject.org/coprs/saltstack/salt/repo/${__REPOTYPE}-${DISTRO_MAJOR_VERSION}/${__REPO_FILENAME}" || return 1\n fi\n return 0\n}\n\ninstall_centos_stable_deps() {\n __install_epel_repository || return 1\n if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then\n __install_saltstack_copr_salt_el5_repository || return 1\n fi\n\n __install_saltstack_copr_salt_repository || return 1\n\n if [ "$_ENABLE_EXTERNAL_ZMQ_REPOS" -eq $BS_TRUE ] && [ "$DISTRO_MAJOR_VERSION" -gt 5 ]; then\n yum -y install python-hashlib || return 1\n __install_saltstack_copr_zeromq_repository || return 1\n fi\n\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then\n # We\'re on the develop branch, install whichever tornado is on the requirements file\n __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"\n if [ "${__REQUIRED_TORNADO}" != "" ]; then\n yum install -y python-tornado\n fi\n fi\n\n if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then\n yum -y update || return 1\n fi\n\n __PACKAGES="yum-utils chkconfig"\n\n if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then\n __PACKAGES="${__PACKAGES} python26-PyYAML python26-m2crypto m2crypto python26 python26-requests"\n __PACKAGES="${__PACKAGES} python26-crypto python26-msgpack python26-zmq python26-jinja2"\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud"\n __PACKAGES="${__PACKAGES} python26-setuptools"\n fi\n else\n __PACKAGES="${__PACKAGES} PyYAML m2crypto python-crypto python-msgpack python-zmq python-jinja2 python-requests"\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud"\n __PACKAGES="${__PACKAGES} python-pip"\n fi\n fi\n\n if [ "$DISTRO_NAME_L" = "oracle_linux" ]; then\n # We need to install one package at a time because --enablerepo=X disables ALL OTHER REPOS!!!!\n for package in ${__PACKAGES}; do\n # shellcheck disable=SC2086\n yum -y install ${package} || yum -y install ${package} --enablerepo=${_EPEL_REPO} || return 1\n done\n else\n # shellcheck disable=SC2086\n yum -y install ${__PACKAGES} --enablerepo=${_EPEL_REPO} || return 1\n fi\n\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud"\n if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then\n easy_install-2.6 "apache-libcloud>=$_LIBCLOUD_MIN_VERSION"\n else\n pip install "apache-libcloud>=$_LIBCLOUD_MIN_VERSION"\n fi\n fi\n\n if [ "${_EXTRA_PACKAGES}" != "" ]; then\n echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"\n if [ "$DISTRO_NAME_L" = "oracle_linux" ]; then\n # We need to install one package at a time because --enablerepo=X disables ALL OTHER REPOS!!!!\n for package in ${_EXTRA_PACKAGES}; do\n # shellcheck disable=SC2086\n yum -y install ${package} || yum -y install ${package} --enablerepo=${_EPEL_REPO} || return 1\n done\n else\n # shellcheck disable=SC2086\n yum install -y ${_EXTRA_PACKAGES} --enablerepo=${_EPEL_REPO} || return 1\n fi\n fi\n\n return 0\n}\n\ninstall_centos_stable() {\n __PACKAGES=""\n if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then\n __PACKAGES="${__PACKAGES} salt-minion"\n fi\n if [ "$_INSTALL_MASTER" -eq $BS_TRUE ];then\n __PACKAGES="${__PACKAGES} salt-master"\n fi\n if [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ];then\n __PACKAGES="${__PACKAGES} salt-syndic"\n fi\n\n if [ "$DISTRO_NAME_L" = "oracle_linux" ]; then\n # We need to install one package at a time because --enablerepo=X disables ALL OTHER REPOS!!!!\n for package in ${__PACKAGES}; do\n # shellcheck disable=SC2086\n yum -y install ${package} || yum -y install ${package} --enablerepo=${_EPEL_REPO} || return 1\n done\n else\n # shellcheck disable=SC2086\n yum -y install ${__PACKAGES} --enablerepo=${_EPEL_REPO} || return 1\n fi\n return 0\n}\n\ninstall_centos_stable_post() {\n for fname in minion master syndic api; do\n # Skip if not meant to be installed\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ -f /etc/init.d/salt-$fname ]; then\n # Still in SysV init!?\n /sbin/chkconfig salt-$fname on\n elif [ -f /usr/bin/systemctl ]; then\n # Using systemd\n /usr/bin/systemctl is-enabled salt-$fname.service > /dev/null 2>&1 || (\n /usr/bin/systemctl preset salt-$fname.service > /dev/null 2>&1 &&\n /usr/bin/systemctl enable salt-$fname.service > /dev/null 2>&1\n )\n sleep 0.1\n /usr/bin/systemctl daemon-reload\n fi\n done\n}\n\ninstall_centos_git_deps() {\n install_centos_stable_deps || return 1\n if [ "$(which git)" = "" ]; then\n # git not installed - need to install it\n if [ "$DISTRO_NAME_L" = "oracle_linux" ]; then\n # try both ways --enablerepo=X disables ALL OTHER REPOS!!!!\n yum install -y git || yum install -y git --enablerepo=${_EPEL_REPO} || return 1\n else\n yum install -y git --enablerepo=${_EPEL_REPO} || return 1\n fi\n fi\n\n if [ "$DISTRO_MAJOR_VERSION" -gt 6 ]; then\n if [ "$DISTRO_NAME_L" != "oracle_linux" ]; then\n yum install -y systemd-python || yum install -y systemd-python --enablerepo=${_EPEL_REPO} || return 1\n else\n yum install -y systemd-python --enablerepo=${_EPEL_REPO} || return 1\n fi\n fi\n\n __git_clone_and_checkout || return 1\n\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then\n # We\'re on the develop branch, install whichever tornado is on the requirements file\n __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"\n if [ "${__REQUIRED_TORNADO}" != "" ]; then\n yum install -y python-tornado\n fi\n fi\n\n # Let\'s trigger config_salt()\n if [ "$_TEMP_CONFIG_DIR" = "null" ]; then\n _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"\n CONFIG_SALT_FUNC="config_salt"\n fi\n\n return 0\n}\n\ninstall_centos_git() {\n if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then\n _PYEXE=python2.6\n else\n _PYEXE=python2\n fi\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then\n $_PYEXE setup.py install --salt-config-dir="$_SALT_ETC_DIR" || return 1\n else\n $_PYEXE setup.py install || return 1\n fi\n return 0\n}\n\ninstall_centos_git_post() {\n SYSTEMD_RELOAD=$BS_FALSE\n for fname in minion master syndic api; do\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ -f /bin/systemctl ]; then\n if [ ! -f /usr/lib/systemd/system/salt-${fname}.service ] || ([ -f /usr/lib/systemd/system/salt-${fname}.service ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then\n copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" /usr/lib/systemd/system/\n fi\n\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n /bin/systemctl enable salt-${fname}.service\n SYSTEMD_RELOAD=$BS_TRUE\n\n elif [ ! -f /etc/init.d/salt-$fname ] || ([ -f /etc/init.d/salt-$fname ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then\n copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}" /etc/init.d/\n chmod +x /etc/init.d/salt-${fname}\n\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n /sbin/chkconfig salt-${fname} on\n fi\n\n #if [ -f /sbin/initctl ]; then\n # # We have upstart support\n # /sbin/initctl status salt-$fname > /dev/null 2>&1\n # if [ $? -eq 1 ]; then\n # # upstart does not know about our service, let\'s copy the proper file\n # copyfile ${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-$fname.upstart /etc/init/salt-$fname.conf\n # fi\n ## Still in SysV init?!\n #elif [ ! -f /etc/init.d/salt-$fname ] || ([ -f /etc/init.d/salt-$fname ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then\n # copyfile ${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname} /etc/init.d/\n # chmod +x /etc/init.d/salt-${fname}\n # /sbin/chkconfig salt-${fname} on\n #fi\n done\n\n if [ "$SYSTEMD_RELOAD" -eq $BS_TRUE ]; then\n /bin/systemctl daemon-reload\n fi\n}\n\ninstall_centos_restart_daemons() {\n [ $_START_DAEMONS -eq $BS_FALSE ] && return\n\n for fname in minion master syndic api; do\n # Skip if not meant to be installed\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ -f /sbin/initctl ] && [ -f /etc/init/salt-${fname}.conf ]; then\n # We have upstart support and upstart knows about our service\n /sbin/initctl status salt-$fname > /dev/null 2>&1\n if [ $? -ne 0 ]; then\n # Everything is in place and upstart gave us an error code? Fail!\n return 1\n fi\n\n # upstart knows about this service.\n # Let\'s try to stop it, and then start it\n /sbin/initctl stop salt-$fname > /dev/null 2>&1\n /sbin/initctl start salt-$fname > /dev/null 2>&1\n # Restart service\n if [ $? -ne 0 ]; then\n # Failed the restart?!\n return 1\n fi\n elif [ -f /etc/init.d/salt-$fname ]; then\n # Still in SysV init!?\n /etc/init.d/salt-$fname stop > /dev/null 2>&1\n /etc/init.d/salt-$fname start\n elif [ -f /usr/bin/systemctl ]; then\n # CentOS 7 uses systemd\n /usr/bin/systemctl stop salt-$fname > /dev/null 2>&1\n /usr/bin/systemctl start salt-$fname.service\n fi\n done\n}\n\ninstall_centos_testing_deps() {\n install_centos_stable_deps || return 1\n return 0\n}\n\ninstall_centos_testing() {\n install_centos_stable || return 1\n return 0\n}\n\ninstall_centos_testing_post() {\n install_centos_stable_post || return 1\n return 0\n}\n\ninstall_centos_check_services() {\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n if [ -f /sbin/initctl ] && [ -f /etc/init/salt-${fname}.conf ]; then\n __check_services_upstart salt-$fname || return 1\n elif [ -f /etc/init.d/salt-$fname ]; then\n __check_services_sysvinit salt-$fname || return 1\n elif [ -f /usr/bin/systemctl ]; then\n __check_services_systemd salt-$fname || return 1\n fi\n done\n return 0\n}\n\n#\n# Ended CentOS Install Functions\n#\n#######################################################################################################################\n\n#######################################################################################################################\n#\n# RedHat Install Functions\n#\n__test_rhel_optionals_packages() {\n __install_epel_repository || return 1\n\n if [ "$DISTRO_MAJOR_VERSION" -ge 7 ]; then\n yum-config-manager --enable \\*server-optional || return 1\n fi\n\n if [ "$DISTRO_MAJOR_VERSION" -ge 6 ]; then\n # Let\'s enable package installation testing, kind of, --dry-run\n echoinfo "Testing if packages usually on the optionals repository are available:"\n __YUM_CONF_DIR="$(mktemp -d)"\n __YUM_CONF_FILE="${__YUM_CONF_DIR}/yum.conf"\n cp /etc/yum.conf "${__YUM_CONF_FILE}"\n echo \'tsflags=test\' >> "${__YUM_CONF_FILE}"\n\n # Let\'s try installing the packages that usually require the optional repository\n # shellcheck disable=SC2043\n for package in python-jinja2; do\n echoinfo " - ${package}"\n if [ "$DISTRO_NAME_L" = "oracle_linux" ]; then\n yum --config "${__YUM_CONF_FILE}" install -y ${package} >/dev/null 2>&1 || \\\n yum --config "${__YUM_CONF_FILE}" install -y ${package} --enablerepo=${_EPEL_REPO} >/dev/null 2>&1\n else\n yum --config "${__YUM_CONF_FILE}" install -y ${package} --enablerepo=${_EPEL_REPO} >/dev/null 2>&1\n fi\n if [ $? -ne 0 ]; then\n echoerror "Failed to find an installable \'${package}\' package. The optional repository or its subscription might be missing."\n rm -rf "${__YUM_CONF_DIR}"\n return 1\n fi\n done\n rm -rf "${__YUM_CONF_DIR}"\n fi\n return 0\n}\n\n\ninstall_red_hat_linux_stable_deps() {\n if [ "${DISTRO_MAJOR_VERSION}" -ge 6 ]; then\n # Wait at most 60 seconds for the repository subscriptions to register\n __ATTEMPTS=6\n while [ "${__ATTEMPTS}" -gt 0 ]; do\n __test_rhel_optionals_packages\n if [ $? -eq 1 ]; then\n __ATTEMPTS=$(( __ATTEMPTS -1 ))\n if [ ${__ATTEMPTS} -lt 1 ]; then\n return 1\n fi\n echoinfo "Sleeping 10 seconds while waiting for the optional repository subscription to be externally configured"\n sleep 10\n continue\n else\n break\n fi\n done\n else\n __test_rhel_optionals_packages || return 1\n fi\n\n install_centos_stable_deps || return 1\n return 0\n}\n\ninstall_red_hat_linux_git_deps() {\n if [ "${DISTRO_MAJOR_VERSION}" -ge 6 ]; then\n # Wait at most 60 seconds for the repository subscriptions to register\n __ATTEMPTS=6\n while [ "${__ATTEMPTS}" -gt 0 ]; do\n __test_rhel_optionals_packages\n if [ $? -eq 1 ]; then\n __ATTEMPTS=$(( __ATTEMPTS -1 ))\n if [ ${__ATTEMPTS} -lt 1 ]; then\n return 1\n fi\n echoinfo "Sleeping 10 seconds while waiting for the optional repository subscription to be externally configured"\n sleep 10\n continue\n else\n break\n fi\n done\n else\n __test_rhel_optionals_packages || return 1\n fi\n install_centos_git_deps || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_linux_stable_deps() {\n install_red_hat_linux_stable_deps || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_linux_git_deps() {\n install_red_hat_linux_git_deps || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_server_stable_deps() {\n install_red_hat_linux_stable_deps || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_server_git_deps() {\n install_red_hat_linux_git_deps || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_workstation_stable_deps() {\n install_red_hat_linux_stable_deps || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_workstation_git_deps() {\n install_red_hat_linux_git_deps || return 1\n return 0\n}\n\ninstall_red_hat_linux_stable() {\n install_centos_stable || return 1\n return 0\n}\n\ninstall_red_hat_linux_git() {\n install_centos_git || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_linux_stable() {\n install_red_hat_linux_stable || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_linux_git() {\n install_red_hat_linux_git || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_server_stable() {\n install_red_hat_linux_stable || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_server_git() {\n install_red_hat_linux_git || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_workstation_stable() {\n install_red_hat_linux_stable || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_workstation_git() {\n install_red_hat_linux_git || return 1\n return 0\n}\n\n\ninstall_red_hat_linux_stable_post() {\n install_centos_stable_post || return 1\n return 0\n}\n\ninstall_red_hat_linux_restart_daemons() {\n install_centos_restart_daemons || return 1\n return 0\n}\n\ninstall_red_hat_linux_git_post() {\n install_centos_git_post || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_linux_stable_post() {\n install_red_hat_linux_stable_post || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_linux_restart_daemons() {\n install_red_hat_linux_restart_daemons || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_linux_git_post() {\n install_red_hat_linux_git_post || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_server_stable_post() {\n install_red_hat_linux_stable_post || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_server_restart_daemons() {\n install_red_hat_linux_restart_daemons || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_server_git_post() {\n install_red_hat_linux_git_post || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_workstation_stable_post() {\n install_red_hat_linux_stable_post || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_workstation_restart_daemons() {\n install_red_hat_linux_restart_daemons || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_workstation_git_post() {\n install_red_hat_linux_git_post || return 1\n return 0\n}\n\n\ninstall_red_hat_linux_testing_deps() {\n install_centos_testing_deps || return 1\n return 0\n}\n\ninstall_red_hat_linux_testing() {\n install_centos_testing || return 1\n return 0\n}\n\ninstall_red_hat_linux_testing_post() {\n install_centos_testing_post || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_server_testing_deps() {\n install_centos_testing_deps || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_server_testing() {\n install_centos_testing || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_server_testing_post() {\n install_centos_testing_post || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_workstation_testing_deps() {\n install_centos_testing_deps || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_workstation_testing() {\n install_centos_testing || return 1\n return 0\n}\n\ninstall_red_hat_enterprise_workstation_testing_post() {\n install_centos_testing_post || return 1\n return 0\n}\n#\n# Ended RedHat Install Functions\n#\n#######################################################################################################################\n\n\n#######################################################################################################################\n#\n# Oracle Linux Install Functions\n#\ninstall_oracle_linux_stable_deps() {\n __test_rhel_optionals_packages || return 1\n install_centos_stable_deps || return 1\n return 0\n}\n\ninstall_oracle_linux_git_deps() {\n __test_rhel_optionals_packages || return 1\n install_centos_git_deps || return 1\n return 0\n}\n\ninstall_oracle_linux_testing_deps() {\n install_centos_testing_deps || return 1\n return 0\n}\n\ninstall_oracle_linux_stable() {\n install_centos_stable || return 1\n return 0\n}\n\ninstall_oracle_linux_git() {\n install_centos_git || return 1\n return 0\n}\n\ninstall_oracle_linux_testing() {\n install_centos_testing || return 1\n return 0\n}\n\ninstall_oracle_linux_stable_post() {\n install_centos_stable_post || return 1\n return 0\n}\n\ninstall_oracle_linux_git_post() {\n install_centos_git_post || return 1\n return 0\n}\n\n\ninstall_oracle_linux_testing_post() {\n install_centos_testing_post || return 1\n return 0\n}\n\ninstall_oracle_linux_restart_daemons() {\n install_centos_restart_daemons || return 1\n return 0\n}\n\ninstall_oracle_linux_check_services() {\n install_centos_check_services || return 1\n return 0\n}\n#\n# Ended Oracle Linux Install Functions\n#\n#######################################################################################################################\n\n\n#######################################################################################################################\n#\n# Scientific Linux Install Functions\n#\ninstall_scientific_linux_stable_deps() {\n install_centos_stable_deps || return 1\n return 0\n}\n\ninstall_scientific_linux_git_deps() {\n install_centos_git_deps || return 1\n return 0\n}\n\ninstall_scientific_linux_testing_deps() {\n install_centos_testing_deps || return 1\n return 0\n}\n\ninstall_scientific_linux_stable() {\n install_centos_stable || return 1\n return 0\n}\n\ninstall_scientific_linux_git() {\n install_centos_git || return 1\n return 0\n}\n\ninstall_scientific_linux_testing() {\n install_centos_testing || return 1\n return 0\n}\n\ninstall_scientific_linux_stable_post() {\n install_centos_stable_post || return 1\n return 0\n}\n\ninstall_scientific_linux_git_post() {\n install_centos_git_post || return 1\n return 0\n}\n\n\ninstall_scientific_linux_testing_post() {\n install_centos_testing_post || return 1\n return 0\n}\n\ninstall_scientific_linux_restart_daemons() {\n install_centos_restart_daemons || return 1\n return 0\n}\n\ninstall_scientific_linux_check_services() {\n install_centos_check_services || return 1\n return 0\n}\n#\n# Ended Scientific Linux Install Functions\n#\n#######################################################################################################################\n\n\n#######################################################################################################################\n#\n# Amazon Linux AMI Install Functions\n#\n\ninstall_amazon_linux_ami_2010_deps() {\n # Linux Amazon AMI 2010.xx seems to use EPEL5 but the system is based on CentOS6.\n # Supporting this would be quite troublesome and we need to workaround some serious package conflicts\n echoerror "Amazon Linux AMI 2010 is not supported. Please use a more recent image (Amazon Linux AMI >= 2011.xx)"\n exit 1\n}\n\ninstall_amazon_linux_ami_2010_git_deps() {\n # Linux Amazon AMI 2010.xx seems to use EPEL5 but the system is based on CentOS6.\n # Supporting this would be quite troublesome and we need to workaround some serious package conflicts\n echoerror "Amazon Linux AMI 2010 is not supported. Please use a more recent image (Amazon Linux AMI >= 2011.xx)"\n exit 1\n}\n\ninstall_amazon_linux_ami_deps() {\n # According to http://aws.amazon.com/amazon-linux-ami/faqs/#epel we should\n\n # enable the EPEL 6 repo\n if [ "$CPU_ARCH_L" = "i686" ]; then\n EPEL_ARCH="i386"\n else\n EPEL_ARCH=$CPU_ARCH_L\n fi\n rpm -Uvh --force "http://mirrors.kernel.org/fedora-epel/6/${EPEL_ARCH}/epel-release-6-8.noarch.rpm" || return 1\n\n __REPO_FILENAME="saltstack-salt-epel-6.repo"\n\n if [ ! -s "/etc/yum.repos.d/${__REPO_FILENAME}" ]; then\n echoinfo "Adding SaltStack\'s COPR repository"\n __fetch_url /etc/yum.repos.d/${__REPO_FILENAME} \\\n "http://copr.fedoraproject.org/coprs/saltstack/salt/repo/epel-6/${__REPO_FILENAME}" || return 1\n fi\n\n if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then\n yum -y update || return 1\n fi\n\n __PACKAGES="PyYAML m2crypto python-crypto python-msgpack python-zmq python-ordereddict python-jinja2 python-requests"\n\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud"\n __PACKAGES="${__PACKAGES} python-pip"\n fi\n\n # shellcheck disable=SC2086\n yum -y install ${__PACKAGES} --enablerepo=${_EPEL_REPO}"" || return 1\n\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud"\n pip-python install "apache-libcloud>=$_LIBCLOUD_MIN_VERSION"\n fi\n\n if [ "${_EXTRA_PACKAGES}" != "" ]; then\n echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"\n # shellcheck disable=SC2086\n yum install -y ${_EXTRA_PACKAGES} --enablerepo=${_EPEL_REPO} || return 1\n fi\n\n}\n\ninstall_amazon_linux_ami_git_deps() {\n install_amazon_linux_ami_deps || return 1\n\n if [ "$(which git)" = "" ]; then\n yum -y install git --enablerepo=${_EPEL_REPO} || return 1\n fi\n\n __git_clone_and_checkout || return 1\n\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then\n # We\'re on the develop branch, install whichever tornado is on the requirements file\n __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"\n if [ "${__REQUIRED_TORNADO}" != "" ]; then\n yum install -y python-tornado\n fi\n fi\n\n\n # Let\'s trigger config_salt()\n if [ "$_TEMP_CONFIG_DIR" = "null" ]; then\n _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"\n CONFIG_SALT_FUNC="config_salt"\n fi\n\n return 0\n}\n\ninstall_amazon_linux_ami_stable() {\n install_centos_stable || return 1\n return 0\n}\n\ninstall_amazon_linux_ami_stable_post() {\n install_centos_stable_post || return 1\n return 0\n}\n\ninstall_amazon_linux_ami_restart_daemons() {\n install_centos_restart_daemons || return 1\n return 0\n}\n\ninstall_amazon_linux_ami_git() {\n install_centos_git || return 1\n return 0\n}\n\ninstall_amazon_linux_ami_git_post() {\n install_centos_git_post || return 1\n return 0\n}\n\ninstall_amazon_linux_ami_testing() {\n install_centos_testing || return 1\n return 0\n}\n\ninstall_amazon_linux_ami_testing_post() {\n install_centos_testing_post || return 1\n return 0\n}\n\n#\n# Ended Amazon Linux AMI Install Functions\n#\n#######################################################################################################################\n\n#######################################################################################################################\n#\n# Arch Install Functions\n#\ninstall_arch_linux_stable_deps() {\n\n if [ ! -f /etc/pacman.d/gnupg ]; then\n pacman-key --init && pacman-key --populate archlinux || return 1\n fi\n\n pacman -Sy --noconfirm --needed pacman || return 1\n\n if [ "$(which pacman-db-upgrade)" != "" ]; then\n pacman-db-upgrade || return 1\n fi\n\n if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then\n pacman -Syyu --noconfirm --needed || return 1\n fi\n\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n pacman -Sy --noconfirm --needed apache-libcloud || return 1\n fi\n\n if [ "${_EXTRA_PACKAGES}" != "" ]; then\n echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"\n # shellcheck disable=SC2086\n pacman -Sy --noconfirm --needed ${_EXTRA_PACKAGES} || return 1\n fi\n\n}\n\ninstall_arch_linux_git_deps() {\n install_arch_linux_stable_deps\n\n # Don\'t fail if un-installing python2-distribute threw an error\n if [ "$(which git)" = "" ]; then\n pacman -Sy --noconfirm --needed git || return 1\n fi\n pacman -R --noconfirm python2-distribute\n pacman -Sy --noconfirm --needed python2-crypto python2-setuptools python2-jinja \\\n python2-m2crypto python2-markupsafe python2-msgpack python2-psutil python2-yaml \\\n python2-pyzmq zeromq python2-requests python2-systemd || return 1\n\n __git_clone_and_checkout || return 1\n\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then\n # We\'re on the develop branch, install whichever tornado is on the requirements file\n __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"\n if [ "${__REQUIRED_TORNADO}" != "" ]; then\n pacman -Sy --noconfirm --needed python2-tornado\n fi\n fi\n\n\n # Let\'s trigger config_salt()\n if [ "$_TEMP_CONFIG_DIR" = "null" ]; then\n _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"\n CONFIG_SALT_FUNC="config_salt"\n fi\n\n return 0\n}\n\ninstall_arch_linux_stable() {\n pacman -Sy --noconfirm --needed pacman || return 1\n # See https://mailman.archlinux.org/pipermail/arch-dev-public/2013-June/025043.html\n # to know why we\'re ignoring below.\n pacman -Syu --noconfirm --ignore filesystem,bash || return 1\n pacman -S --noconfirm --needed bash || return 1\n pacman -Su --noconfirm || return 1\n # We can now resume regular salt update\n pacman -Syu --noconfirm salt-zmq || return 1\n return 0\n}\n\ninstall_arch_linux_git() {\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then\n python2 setup.py install --salt-config-dir="$_SALT_ETC_DIR" || return 1\n else\n python2 setup.py install || return 1\n fi\n return 0\n}\n\ninstall_arch_linux_post() {\n\n for fname in minion master syndic api; do\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n # Since Arch\'s pacman renames configuration files\n if [ "$_TEMP_CONFIG_DIR" != "null" ] && [ -f "$_SALT_ETC_DIR/$fname.pacorig" ]; then\n # Since a configuration directory was provided, it also means that any\n # configuration file copied was renamed by Arch, see:\n # https://wiki.archlinux.org/index.php/Pacnew_and_Pacsave_Files#.pacorig\n copyfile "$_SALT_ETC_DIR/$fname.pacorig" "$_SALT_ETC_DIR/$fname" $BS_TRUE\n fi\n\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n if [ -f /usr/bin/systemctl ]; then\n # Using systemd\n /usr/bin/systemctl is-enabled salt-$fname.service > /dev/null 2>&1 || (\n /usr/bin/systemctl preset salt-$fname.service > /dev/null 2>&1 &&\n /usr/bin/systemctl enable salt-$fname.service > /dev/null 2>&1\n )\n sleep 0.1\n /usr/bin/systemctl daemon-reload\n continue\n fi\n\n # XXX: How do we enable old Arch init.d scripts?\n done\n}\n\ninstall_arch_linux_git_post() {\n for fname in minion master syndic api; do\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ -f /usr/bin/systemctl ]; then\n copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service"\n\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n /usr/bin/systemctl is-enabled salt-${fname}.service > /dev/null 2>&1 || (\n /usr/bin/systemctl preset salt-${fname}.service > /dev/null 2>&1 &&\n /usr/bin/systemctl enable salt-${fname}.service > /dev/null 2>&1\n )\n sleep 0.1\n /usr/bin/systemctl daemon-reload\n continue\n fi\n\n # SysV init!?\n copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname" "/etc/rc.d/init.d/salt-$fname"\n chmod +x /etc/rc.d/init.d/salt-$fname\n done\n}\n\ninstall_arch_linux_restart_daemons() {\n [ $_START_DAEMONS -eq $BS_FALSE ] && return\n\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ -f /usr/bin/systemctl ]; then\n /usr/bin/systemctl stop salt-$fname.service > /dev/null 2>&1\n /usr/bin/systemctl start salt-$fname.service\n continue\n fi\n /etc/rc.d/salt-$fname stop > /dev/null 2>&1\n /etc/rc.d/salt-$fname start\n done\n}\n\ninstall_arch_check_services() {\n if [ ! -f /usr/bin/systemctl ]; then\n # Not running systemd!? Don\'t check!\n return 0\n fi\n\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n __check_services_systemd salt-$fname || return 1\n done\n return 0\n}\n#\n# Ended Arch Install Functions\n#\n#######################################################################################################################\n\n#######################################################################################################################\n#\n# FreeBSD Install Functions\n#\n__freebsd_get_packagesite() {\n if [ "$CPU_ARCH_L" = "amd64" ]; then\n BSD_ARCH="x86:64"\n elif [ "$CPU_ARCH_L" = "x86_64" ]; then\n BSD_ARCH="x86:64"\n elif [ "$CPU_ARCH_L" = "i386" ]; then\n BSD_ARCH="x86:32"\n elif [ "$CPU_ARCH_L" = "i686" ]; then\n BSD_ARCH="x86:32"\n fi\n\n # Since the variable might not be set, don\'t, momentarily treat it as a\n # failure\n set +o nounset\n\n # ABI is a std format for identifying release / architecture combos\n ABI="freebsd:${DISTRO_MAJOR_VERSION}:${BSD_ARCH}"\n _PACKAGESITE="http://pkg.freebsd.org/${ABI}/latest"\n # Awkwardly, we want the `${ABI}` to be in conf file without escaping\n PKGCONFURL="pkg+http://pkg.freebsd.org/\\${ABI}/latest"\n\n # Treat unset variables as errors once more\n set -o nounset\n}\n\n# Using a separate conf step to head for idempotent install...\n__configure_freebsd_pkg_details() {\n\n ## pkg.conf is deprecated.\n ## We use conf files in /usr/local or /etc instead\n mkdir -p /usr/local/etc/pkg/repos/\n mkdir -p /etc/pkg/\n\n ## Use new JSON-like format for pkg repo configs\n conf_file=/usr/local/etc/pkg/repos/freebsd.conf\n {\n echo "FreeBSD:{"\n echo " url: \\"${PKGCONFURL}\\","\n echo " mirror_type: \\"SRV\\","\n echo " enabled: true"\n echo "}"\n } > $conf_file\n copyfile $conf_file /etc/pkg/FreeBSD.conf\n SALT_PKG_FLAGS="-r FreeBSD"\n ## ensure future ports builds use pkgng\n echo "WITH_PKGNG= yes" >> /etc/make.conf\n}\n\ninstall_freebsd_9_stable_deps() {\n\n #make variables available even if pkg already installed\n __freebsd_get_packagesite\n\n if [ ! -x /usr/local/sbin/pkg ]; then\n\n # install new `pkg` code from its own tarball.\n fetch "${_PACKAGESITE}/Latest/pkg.txz" || return 1\n tar xf ./pkg.txz -s ",/.*/,,g" "*/pkg-static" || return 1\n ./pkg-static add ./pkg.txz || return 1\n /usr/local/sbin/pkg2ng || return 1\n fi\n\n # Configure the pkg repository using new approach\n __configure_freebsd_pkg_details || return 1\n\n # Now install swig\n # shellcheck disable=SC2086\n /usr/local/sbin/pkg install ${SALT_PKG_FLAGS} -y swig || return 1\n\n if [ "${_EXTRA_PACKAGES}" != "" ]; then\n echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"\n # shellcheck disable=SC2086\n /usr/local/sbin/pkg install ${SALT_PKG_FLAGS} -y ${_EXTRA_PACKAGES} || return 1\n fi\n\n if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then\n pkg upgrade -y || return 1\n fi\n\n return 0\n}\n\ninstall_freebsd_10_stable_deps() {\n install_freebsd_9_stable_deps\n}\n\nconfig_freebsd_salt() {\n # Set _SALT_ETC_DIR to ports default\n _SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/usr/local/etc/salt}\n # We also need to redefine the PKI directory\n _PKI_DIR=${_SALT_ETC_DIR}/pki\n\n config_salt || return 1\n\n return 0\n}\n\ninstall_freebsd_git_deps() {\n install_freebsd_9_stable_deps || return 1\n\n if [ "$(which git)" = "" ]; then\n /usr/local/sbin/pkg install -y git || return 1\n fi\n\n /usr/local/sbin/pkg install -y www/py-requests || return 1\n\n __git_clone_and_checkout || return 1\n\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then\n # We\'re on the develop branch, install whichever tornado is on the requirements file\n __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"\n if [ "${__REQUIRED_TORNADO}" != "" ]; then\n /usr/local/sbin/pkg install -y www/py-tornado || return 1\n fi\n fi\n\n echodebug "Adapting paths to FreeBSD"\n # The list of files was taken from Salt\'s BSD port Makefile\n for file in doc/man/salt-key.1 doc/man/salt-cp.1 doc/man/salt-minion.1 \\\n doc/man/salt-syndic.1 doc/man/salt-master.1 doc/man/salt-run.1 \\\n doc/man/salt.7 doc/man/salt.1 doc/man/salt-call.1; do\n [ ! -f $file ] && continue\n echodebug "Patching ${file}"\n sed -in -e "s|/etc/salt|${_SALT_ETC_DIR}|" \\\n -e "s|/srv/salt|${_SALT_ETC_DIR}/states|" \\\n -e "s|/srv/pillar|${_SALT_ETC_DIR}/pillar|" ${file}\n done\n if [ ! -f salt/syspaths.py ]; then\n # We still can\'t provide the system paths, salt 0.16.x\n # Let\'s patch salt\'s source and adapt paths to what\'s expected on FreeBSD\n echodebug "Replacing occurrences of \'/etc/salt\' with \\\'${_SALT_ETC_DIR}\\\'"\n # The list of files was taken from Salt\'s BSD port Makefile\n for file in conf/minion conf/master salt/config.py salt/client.py \\\n salt/modules/mysql.py salt/utils/parsers.py salt/modules/tls.py \\\n salt/modules/postgres.py salt/utils/migrations.py; do\n [ ! -f $file ] && continue\n echodebug "Patching ${file}"\n sed -in -e "s|/etc/salt|${_SALT_ETC_DIR}|" \\\n -e "s|/srv/salt|${_SALT_ETC_DIR}/states|" \\\n -e "s|/srv/pillar|${_SALT_ETC_DIR}/pillar|" ${file}\n done\n fi\n echodebug "Finished patching"\n\n # Let\'s trigger config_salt()\n if [ "$_TEMP_CONFIG_DIR" = "null" ]; then\n _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"\n CONFIG_SALT_FUNC="config_freebsd_salt"\n fi\n\n return 0\n}\n\ninstall_freebsd_9_stable() {\n # shellcheck disable=SC2086\n /usr/local/sbin/pkg install ${SALT_PKG_FLAGS} -y sysutils/py-salt || return 1\n return 0\n}\n\ninstall_freebsd_10_stable() {\n install_freebsd_9_stable\n}\n\ninstall_freebsd_git() {\n # shellcheck disable=SC2086\n /usr/local/sbin/pkg install ${SALT_PKG_FLAGS} -y sysutils/py-salt || return 1\n\n # Let\'s keep the rc.d files before deleting the package\n mkdir /tmp/rc-scripts || return 1\n cp /usr/local/etc/rc.d/salt* /tmp/rc-scripts || return 1\n\n # Let\'s delete the package\n /usr/local/sbin/pkg delete -y sysutils/py-salt || return 1\n\n # Install from git\n if [ ! -f salt/syspaths.py ]; then\n # We still can\'t provide the system paths, salt 0.16.x\n /usr/local/bin/python2 setup.py install || return 1\n else\n /usr/local/bin/python2 setup.py install \\\n --salt-root-dir=/usr/local \\\n --salt-config-dir="${_SALT_ETC_DIR}" \\\n --salt-cache-dir=/var/cache/salt \\\n --salt-sock-dir=/var/run/salt \\\n --salt-srv-root-dir=/srv \\\n --salt-base-file-roots-dir="${_SALT_ETC_DIR}/states" \\\n --salt-base-pillar-roots-dir="${_SALT_ETC_DIR}/pillar" \\\n --salt-base-master-roots-dir="${_SALT_ETC_DIR}/salt-master" \\\n --salt-logs-dir=/var/log/salt \\\n --salt-pidfile-dir=/var/run \\\n || return 1\n fi\n\n # Restore the rc.d scripts\n cp /tmp/rc-scripts/salt* /usr/local/etc/rc.d/ || return 1\n\n # Delete our temporary scripts directory\n rm -rf /tmp/rc-scripts || return 1\n\n # And we\'re good to go\n return 0\n}\n\ninstall_freebsd_9_stable_post() {\n for fname in minion master syndic api; do\n\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n enable_string="salt_${fname}_enable=\\"YES\\""\n grep "$enable_string" /etc/rc.conf >/dev/null 2>&1\n [ $? -eq 1 ] && echo "$enable_string" >> /etc/rc.conf\n\n [ -f "${_SALT_ETC_DIR}/${fname}.sample" ] && copyfile "${_SALT_ETC_DIR}/${fname}.sample" "${_SALT_ETC_DIR}/${fname}"\n\n if [ $fname = "minion" ] ; then\n grep "salt_minion_paths" /etc/rc.conf >/dev/null 2>&1\n [ $? -eq 1 ] && echo "salt_minion_paths=\\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin\\"" >> /etc/rc.conf\n fi\n\n done\n}\n\ninstall_freebsd_10_stable_post() {\n install_freebsd_9_stable_post\n}\n\ninstall_freebsd_git_post() {\n install_freebsd_9_stable_post || return 1\n return 0\n}\n\ninstall_freebsd_restart_daemons() {\n [ $_START_DAEMONS -eq $BS_FALSE ] && return\n\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n service salt_$fname stop > /dev/null 2>&1\n service salt_$fname start\n done\n}\n#\n# Ended FreeBSD Install Functions\n#\n#######################################################################################################################\n\n#######################################################################################################################\n#\n# SmartOS Install Functions\n#\ninstall_smartos_deps() {\n pkgin -y install zeromq py27-m2crypto py27-crypto py27-msgpack py27-yaml py27-jinja2 py27-zmq py27-requests || return 1\n\n # Let\'s trigger config_salt()\n if [ "$_TEMP_CONFIG_DIR" = "null" ]; then\n # Let\'s set the configuration directory to /tmp\n _TEMP_CONFIG_DIR="/tmp"\n CONFIG_SALT_FUNC="config_salt"\n\n # Let\'s download, since they were not provided, the default configuration files\n if [ ! -f "$_SALT_ETC_DIR/minion" ] && [ ! -f "$_TEMP_CONFIG_DIR/minion" ]; then\n # shellcheck disable=SC2086\n curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/minion" -L \\\n https://raw.githubusercontent.com/saltstack/salt/develop/conf/minion || return 1\n fi\n if [ ! -f "$_SALT_ETC_DIR/master" ] && [ ! -f $_TEMP_CONFIG_DIR/master ]; then\n # shellcheck disable=SC2086\n curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/master" -L \\\n https://raw.githubusercontent.com/saltstack/salt/develop/conf/master || return 1\n fi\n fi\n\n if [ "${_EXTRA_PACKAGES}" != "" ]; then\n echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"\n # shellcheck disable=SC2086\n pkgin -y install ${_EXTRA_PACKAGES} || return 1\n fi\n\n return 0\n\n}\n\ninstall_smartos_git_deps() {\n install_smartos_deps || return 1\n\n if [ "$(which git)" = "" ]; then\n pkgin -y install scmgit || return 1\n fi\n\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then\n # We\'re on the develop branch, install whichever tornado is on the requirements file\n __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"\n check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package \'${__REQUIRED_TORNADO}\'"\n if [ "${__REQUIRED_TORNADO}" != "" ]; then\n if [ "$(which pip)" = "" ]; then\n pkgin -y install py27-pip\n fi\n pip install -U "\'${__REQUIRED_TORNADO}\'"\n fi\n fi\n\n __git_clone_and_checkout || return 1\n # Let\'s trigger config_salt()\n if [ "$_TEMP_CONFIG_DIR" = "null" ]; then\n _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"\n CONFIG_SALT_FUNC="config_salt"\n fi\n\n return 0\n}\n\ninstall_smartos_stable() {\n pkgin -y install salt || return 1\n return 0\n}\n\ninstall_smartos_git() {\n # Use setuptools in order to also install dependencies\n USE_SETUPTOOLS=1 /opt/local/bin/python setup.py install || return 1\n return 0\n}\n\ninstall_smartos_post() {\n smf_dir="/opt/custom/smf"\n # Install manifest files if needed.\n for fname in minion master syndic api; do\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n svcs network/salt-$fname > /dev/null 2>&1\n if [ $? -eq 1 ]; then\n if [ ! -f "$_TEMP_CONFIG_DIR/salt-$fname.xml" ]; then\n # shellcheck disable=SC2086\n curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/salt-$fname.xml" -L \\\n "https://raw.githubusercontent.com/saltstack/salt/develop/pkg/smartos/salt-$fname.xml"\n fi\n svccfg import "$_TEMP_CONFIG_DIR/salt-$fname.xml"\n if [ "${VIRTUAL_TYPE}" = "global" ]; then\n if [ ! -d "$smf_dir" ]; then\n mkdir -p "$smf_dir" || return 1\n fi\n if [ ! -f "$smf_dir/salt-$fname.xml" ]; then\n copyfile "$_TEMP_CONFIG_DIR/salt-$fname.xml" "$smf_dir/" || return 1\n fi\n fi\n fi\n done\n}\n\ninstall_smartos_git_post() {\n smf_dir="/opt/custom/smf"\n # Install manifest files if needed.\n for fname in minion master syndic api; do\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n svcs "network/salt-$fname" > /dev/null 2>&1\n if [ $? -eq 1 ]; then\n svccfg import "${__SALT_GIT_CHECKOUT_DIR}/pkg/smartos/salt-$fname.xml"\n if [ "${VIRTUAL_TYPE}" = "global" ]; then\n if [ ! -d $smf_dir ]; then\n mkdir -p "$smf_dir"\n fi\n if [ ! -f "$smf_dir/salt-$fname.xml" ]; then\n copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/smartos/salt-$fname.xml" "$smf_dir/"\n fi\n fi\n fi\n done\n}\n\ninstall_smartos_restart_daemons() {\n [ $_START_DAEMONS -eq $BS_FALSE ] && return\n\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n # Stop if running && Start service\n svcadm disable salt-$fname > /dev/null 2>&1\n svcadm enable salt-$fname\n done\n}\n#\n# Ended SmartOS Install Functions\n#\n#######################################################################################################################\n\n#######################################################################################################################\n#\n# openSUSE Install Functions.\n#\n\n__ZYPPER_REQUIRES_REPLACE_FILES=-1\n\n__version_lte() {\n if [ "$(which python)" = "" ]; then\n zypper zypper --non-interactive install --replacefiles --auto-agree-with-licenses python || \\\n zypper zypper --non-interactive install --auto-agree-with-licenses python || return 1\n fi\n\n if [ "$(python -c \'import sys; V1=tuple([int(i) for i in sys.argv[1].split(".")]); V2=tuple([int(i) for i in sys.argv[2].split(".")]); print V1<=V2\' "$1" "$2")" = "True" ]; then\n __ZYPPER_REQUIRES_REPLACE_FILES=${BS_TRUE}\n else\n __ZYPPER_REQUIRES_REPLACE_FILES=${BS_FALSE}\n fi\n}\n\n__zypper() {\n zypper --non-interactive "${@}"; return $?\n}\n\n__zypper_install() {\n if [ "${__ZYPPER_REQUIRES_REPLACE_FILES}" = "-1" ]; then\n __version_lte "1.10.4" "$(zypper --version | awk \'{ print $2 }\')"\n fi\n if [ "${__ZYPPER_REQUIRES_REPLACE_FILES}" = "${BS_TRUE}" ]; then\n # In case of file conflicts replace old files.\n # Option present in zypper 1.10.4 and newer:\n # https://github.com/openSUSE/zypper/blob/95655728d26d6d5aef7796b675f4cc69bc0c05c0/package/zypper.changes#L253\n __zypper install --auto-agree-with-licenses --replacefiles "${@}"; return $?\n else\n __zypper install --auto-agree-with-licenses "${@}"; return $?\n fi\n}\n\ninstall_opensuse_stable_deps() {\n DISTRO_REPO="openSUSE_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}"\n\n # Is the repository already known\n __zypper repos | grep devel_languages_python >/dev/null 2>&1\n if [ $? -eq 1 ]; then\n # zypper does not yet know nothing about devel_languages_python\n __zypper addrepo --refresh \\\n "http://download.opensuse.org/repositories/devel:/languages:/python/${DISTRO_REPO}/devel:languages:python.repo" || return 1\n fi\n\n __zypper --gpg-auto-import-keys refresh\n if [ $? -ne 0 ] && [ $? -ne 4 ]; then\n # If the exit code is not 0, and it\'s not 4 (failed to update a\n # repository) return a failure. Otherwise continue.\n return 1\n fi\n\n if [ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$DISTRO_MINOR_VERSION" -eq 3 ]; then\n # Because patterns-openSUSE-minimal_base-conflicts conflicts with python, lets remove the first one\n __zypper remove patterns-openSUSE-minimal_base-conflicts\n fi\n\n if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then\n __zypper --gpg-auto-import-keys update || return 1\n fi\n\n # Salt needs python-zypp installed in order to use the zypper module\n __PACKAGES="python-zypp"\n __PACKAGES="${__PACKAGES} libzmq3 python python-Jinja2 python-M2Crypto python-PyYAML python-requests"\n __PACKAGES="${__PACKAGES} python-msgpack-python python-pycrypto python-pyzmq python-xml"\n\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n __PACKAGES="${__PACKAGES} python-apache-libcloud"\n fi\n\n # shellcheck disable=SC2086\n __zypper_install ${__PACKAGES} || return 1\n\n if [ "${_EXTRA_PACKAGES}" != "" ]; then\n echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"\n # shellcheck disable=SC2086\n __zypper_install ${_EXTRA_PACKAGES} || return 1\n fi\n\n return 0\n}\n\ninstall_opensuse_git_deps() {\n install_opensuse_stable_deps || return 1\n\n if [ "$(which git)" = "" ]; then\n __zypper_install git || return 1\n fi\n\n __zypper_install patch || return 1\n\n __git_clone_and_checkout || return 1\n\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/pkg/suse/use-forking-daemon.patch" ]; then\n cd "${__SALT_GIT_CHECKOUT_DIR}"\n echowarn "Applying patch to systemd service unit file"\n patch -p1 < pkg/suse/use-forking-daemon.patch || return 1\n fi\n\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then\n # We\'re on the develop branch, install whichever tornado is on the requirements file\n __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"\n if [ "${__REQUIRED_TORNADO}" != "" ]; then\n __zypper_install python-tornado\n fi\n\n fi\n\n # Let\'s trigger config_salt()\n if [ "$_TEMP_CONFIG_DIR" = "null" ]; then\n _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"\n CONFIG_SALT_FUNC="config_salt"\n fi\n\n return 0\n}\n\ninstall_opensuse_stable() {\n __PACKAGES=""\n if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then\n __PACKAGES="${__PACKAGES} salt-minion"\n fi\n if [ "$_INSTALL_MASTER" -eq $BS_TRUE ]; then\n __PACKAGES="${__PACKAGES} salt-master"\n fi\n if [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ]; then\n __PACKAGES="${__PACKAGES} salt-syndic"\n fi\n # shellcheck disable=SC2086\n __zypper_install $__PACKAGES || return 1\n return 0\n}\n\ninstall_opensuse_git() {\n python setup.py install --prefix=/usr || return 1\n return 0\n}\n\ninstall_opensuse_stable_post() {\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ -f /bin/systemctl ]; then\n systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service)\n sleep 0.1\n systemctl daemon-reload\n continue\n fi\n\n /sbin/chkconfig --add salt-$fname\n /sbin/chkconfig salt-$fname on\n\n done\n}\n\ninstall_opensuse_git_post() {\n for fname in minion master syndic api; do\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ -f /bin/systemctl ]; then\n if [ "${DISTRO_MAJOR_VERSION}" -gt 13 ] || ([ "${DISTRO_MAJOR_VERSION}" -eq 13 ] && [ "${DISTRO_MINOR_VERSION}" -ge 2 ]); then\n copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" "/usr/lib/systemd/system/salt-${fname}.service"\n else\n copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service"\n fi\n continue\n fi\n\n copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname" "/etc/init.d/salt-$fname"\n chmod +x /etc/init.d/salt-$fname\n\n done\n\n install_opensuse_stable_post\n}\n\ninstall_opensuse_restart_daemons() {\n [ $_START_DAEMONS -eq $BS_FALSE ] && return\n\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ -f /bin/systemctl ]; then\n systemctl stop salt-$fname > /dev/null 2>&1\n systemctl start salt-$fname.service\n continue\n fi\n\n service salt-$fname stop > /dev/null 2>&1\n service salt-$fname start\n\n done\n}\n\ninstall_opensuse_check_services() {\n if [ ! -f /bin/systemctl ]; then\n # Not running systemd!? Don\'t check!\n return 0\n fi\n\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n __check_services_systemd salt-$fname > /dev/null 2>&1 || __check_services_systemd salt-$fname.service > /dev/null 2>&1 || return 1\n done\n return 0\n}\n\n#\n# End of openSUSE Install Functions.\n#\n#######################################################################################################################\n\n#######################################################################################################################\n#\n# SuSE Install Functions.\n#\ninstall_suse_11_stable_deps() {\n SUSE_PATCHLEVEL=$(awk \'/PATCHLEVEL/ {print $3}\' /etc/SuSE-release )\n if [ "${SUSE_PATCHLEVEL}" != "" ]; then\n DISTRO_PATCHLEVEL="_SP${SUSE_PATCHLEVEL}"\n fi\n DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}${DISTRO_PATCHLEVEL}"\n\n # Is the repository already known\n __zypper repos | grep devel_languages_python >/dev/null 2>&1\n if [ $? -eq 1 ]; then\n # zypper does not yet know nothing about devel_languages_python\n __zypper addrepo --refresh \\\n "http://download.opensuse.org/repositories/devel:/languages:/python/${DISTRO_REPO}/devel:languages:python.repo" || return 1\n fi\n\n __zypper --gpg-auto-import-keys refresh || return 1\n\n if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then\n __zypper --gpg-auto-import-keys update || return 1\n fi\n\n # Salt needs python-zypp installed in order to use the zypper module\n __PACKAGES="python-zypp"\n # shellcheck disable=SC2089\n __PACKAGES="${__PACKAGES} libzmq3 python python-Jinja2 python-msgpack-python"\n __PACKAGES="${__PACKAGES} python-pycrypto python-pyzmq python-pip python-xml python-requests"\n\n if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then\n check_pip_allowed\n echowarn "PyYaml will be installed using pip"\n else\n __PACKAGES="${__PACKAGES} python-PyYAML"\n fi\n\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n __PACKAGES="${__PACKAGES} python-apache-libcloud"\n fi\n\n # SLES 11 SP3 ships with both python-M2Crypto-0.22.* and python-m2crypto-0.21 and we will be asked which\n # we want to install, even with --non-interactive.\n # Let\'s try to install the higher version first and then the lower one in case of failure\n __zypper_install \'python-M2Crypto>=0.22\' || __zypper_install \'python-M2Crypto>=0.21\' || return 1\n # shellcheck disable=SC2086,SC2090\n __zypper_install ${__PACKAGES} || return 1\n\n if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then\n # There\'s no python-PyYaml in SP1, let\'s install it using pip\n pip install PyYaml || return 1\n fi\n\n # PIP based installs need to copy configuration files "by hand".\n if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then\n # Let\'s trigger config_salt()\n if [ "$_TEMP_CONFIG_DIR" = "null" ]; then\n # Let\'s set the configuration directory to /tmp\n _TEMP_CONFIG_DIR="/tmp"\n CONFIG_SALT_FUNC="config_salt"\n\n for fname in minion master syndic api; do\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n # Syndic uses the same configuration file as the master\n [ $fname = "syndic" ] && fname=master\n\n # Let\'s download, since they were not provided, the default configuration files\n if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then\n # shellcheck disable=SC2086\n curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/$fname" -L \\\n "https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1\n fi\n done\n fi\n fi\n\n if [ "${_EXTRA_PACKAGES}" != "" ]; then\n echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"\n # shellcheck disable=SC2086\n __zypper_install ${_EXTRA_PACKAGES} || return 1\n fi\n\n return 0\n}\n\ninstall_suse_11_git_deps() {\n install_suse_11_stable_deps || return 1\n\n if [ "$(which git)" = "" ]; then\n __zypper_install git || return 1\n fi\n\n __git_clone_and_checkout || return 1\n\n if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then\n # We\'re on the develop branch, install whichever tornado is on the requirements file\n __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"\n if [ "${__REQUIRED_TORNADO}" != "" ]; then\n __zypper_install python-tornado\n fi\n fi\n\n # Let\'s trigger config_salt()\n if [ "$_TEMP_CONFIG_DIR" = "null" ]; then\n _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"\n CONFIG_SALT_FUNC="config_salt"\n fi\n\n return 0\n}\n\ninstall_suse_11_stable() {\n if [ "$SUSE_PATCHLEVEL" -gt 1 ]; then\n install_opensuse_stable || return 1\n else\n # USE_SETUPTOOLS=1 To work around\n # error: option --single-version-externally-managed not recognized\n USE_SETUPTOOLS=1 pip install salt || return 1\n fi\n return 0\n}\n\ninstall_suse_11_git() {\n install_opensuse_git || return 1\n return 0\n}\n\ninstall_suse_11_stable_post() {\n if [ "$SUSE_PATCHLEVEL" -gt 1 ]; then\n install_opensuse_stable_post || return 1\n else\n for fname in minion master syndic api; do\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ -f /bin/systemctl ]; then\n # shellcheck disable=SC2086\n curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \\\n -o "/lib/systemd/system/salt-$fname.service" || return 1\n continue\n fi\n\n # shellcheck disable=SC2086\n curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/rpm/salt-$fname" \\\n -o "/etc/init.d/salt-$fname" || return 1\n chmod +x "/etc/init.d/salt-$fname"\n\n done\n fi\n return 0\n}\n\ninstall_suse_11_git_post() {\n install_opensuse_git_post || return 1\n return 0\n}\n\ninstall_suse_11_restart_daemons() {\n install_opensuse_restart_daemons || return 1\n return 0\n}\n\ninstall_suse_check_services() {\n if [ ! -f /bin/systemctl ]; then\n # Not running systemd!? Don\'t check!\n return 0\n fi\n\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n __check_services_systemd salt-$fname || return 1\n done\n return 0\n}\n#\n# End of SuSE Install Functions.\n#\n#######################################################################################################################\n\n#######################################################################################################################\n#\n# Gentoo Install Functions.\n#\n__emerge() {\n if [ "$_GENTOO_USE_BINHOST" -eq $BS_TRUE ]; then\n emerge --autounmask-write --getbinpkg "${@}"; return $?\n fi\n emerge --autounmask-write "${@}"; return $?\n}\n\n__gentoo_config_protection() {\n # usually it\'s a good thing to have config files protected by portage, but\n # in this case this would require to interrupt the bootstrapping script at\n # this point, manually merge the changes using etc-update/dispatch-conf/\n # cfg-update and then restart the bootstrapping script, so instead we allow\n # at this point to modify certain config files directly\n export CONFIG_PROTECT_MASK="$CONFIG_PROTECT_MASK /etc/portage/package.keywords /etc/portage/package.unmask /etc/portage/package.use /etc/portage/package.license"\n}\n\n__gentoo_pre_dep() {\n if [ "$_ECHO_DEBUG" -eq $BS_TRUE ]; then\n if [ "$(which eix)" != "" ]; then\n eix-sync\n else\n emerge --sync\n fi\n else\n if [ "$(which eix)" != "" ]; then\n eix-sync -q\n else\n emerge --sync --quiet\n fi\n fi\n if [ ! -d /etc/portage ]; then\n mkdir /etc/portage\n fi\n}\n__gentoo_post_dep() {\n # ensures dev-lib/crypto++ compiles happily\n __emerge --oneshot \'sys-devel/libtool\'\n # the -o option asks it to emerge the deps but not the package.\n __gentoo_config_protection\n\n if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then\n check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud"\n __emerge -v \'dev-python/pip\'\n pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION"\n fi\n\n __emerge -vo \'dev-python/requests\'\n __emerge -vo \'app-admin/salt\'\n\n if [ "${_EXTRA_PACKAGES}" != "" ]; then\n echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"\n # shellcheck disable=SC2086\n __emerge -v ${_EXTRA_PACKAGES} || return 1\n fi\n\n}\n\ninstall_gentoo_deps() {\n __gentoo_pre_dep || return 1\n __gentoo_post_dep || return 1\n}\n\ninstall_gentoo_git_deps() {\n __gentoo_pre_dep || return 1\n __gentoo_post_dep || return 1\n}\n\ninstall_gentoo_stable() {\n __gentoo_config_protection\n __emerge -v \'app-admin/salt\' || return 1\n}\n\ninstall_gentoo_git() {\n __gentoo_config_protection\n __emerge -v \'=app-admin/salt-9999\' || return 1\n}\n\ninstall_gentoo_post() {\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ -d "/run/systemd/system" ]; then\n systemctl enable salt-$fname.service\n systemctl start salt-$fname.service\n else\n rc-update add salt-$fname default\n /etc/init.d/salt-$fname start\n fi\n done\n}\n\ninstall_gentoo_restart_daemons() {\n [ $_START_DAEMONS -eq $BS_FALSE ] && return\n\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ -d "/run/systemd/system" ]; then\n systemctl stop salt-$fname > /dev/null 2>&1\n systemctl start salt-$fname.service\n else\n /etc/init.d/salt-$fname stop > /dev/null 2>&1\n /etc/init.d/salt-$fname start\n fi\n done\n}\n\ninstall_gentoo_check_services() {\n if [ ! -d "/run/systemd/system" ]; then\n # Not running systemd!? Don\'t check!\n return 0\n fi\n\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n __check_services_systemd salt-$fname || return 1\n done\n return 0\n}\n#\n# End of Gentoo Install Functions.\n#\n#######################################################################################################################\n\n\n#######################################################################################################################\n#\n# Default minion configuration function. Matches ANY distribution as long as\n# the -c options is passed.\n#\nconfig_salt() {\n # If the configuration directory is not passed, return\n [ "$_TEMP_CONFIG_DIR" = "null" ] && return\n\n CONFIGURED_ANYTHING=$BS_FALSE\n\n # Let\'s create the necessary directories\n [ -d "$_SALT_ETC_DIR" ] || mkdir "$_SALT_ETC_DIR" || return 1\n [ -d "$_PKI_DIR" ] || (mkdir -p "$_PKI_DIR" && chmod 700 "$_PKI_DIR") || return 1\n\n # Copy the grains file if found\n if [ -f "$_TEMP_CONFIG_DIR/grains" ]; then\n echodebug "Moving provided grains file from $_TEMP_CONFIG_DIR/grains to $_SALT_ETC_DIR/grains"\n movefile "$_TEMP_CONFIG_DIR/grains" "$_SALT_ETC_DIR/grains" || return 1\n CONFIGURED_ANYTHING=$BS_TRUE\n fi\n\n if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then\n # Create the PKI directory\n [ -d "$_PKI_DIR/minion" ] || (mkdir -p "$_PKI_DIR/minion" && chmod 700 "$_PKI_DIR/minion") || return 1\n\n # Copy the minions configuration if found\n if [ -f "$_TEMP_CONFIG_DIR/minion" ]; then\n movefile "$_TEMP_CONFIG_DIR/minion" "$_SALT_ETC_DIR" || return 1\n CONFIGURED_ANYTHING=$BS_TRUE\n fi\n\n # Copy the minion\'s keys if found\n if [ -f "$_TEMP_CONFIG_DIR/minion.pem" ]; then\n movefile "$_TEMP_CONFIG_DIR/minion.pem" "$_PKI_DIR/minion/" || return 1\n chmod 400 "$_PKI_DIR/minion/minion.pem" || return 1\n CONFIGURED_ANYTHING=$BS_TRUE\n fi\n if [ -f "$_TEMP_CONFIG_DIR/minion.pub" ]; then\n movefile "$_TEMP_CONFIG_DIR/minion.pub" "$_PKI_DIR/minion/" || return 1\n chmod 664 "$_PKI_DIR/minion/minion.pub" || return 1\n CONFIGURED_ANYTHING=$BS_TRUE\n fi\n # For multi-master-pki, copy the master_sign public key if found\n if [ -f "$_TEMP_CONFIG_DIR/master_sign.pub" ]; then\n movefile "$_TEMP_CONFIG_DIR/master_sign.pub" "$_PKI_DIR/minion/" || return 1\n chmod 664 "$_PKI_DIR/minion/master_sign.pub" || return 1\n CONFIGURED_ANYTHING=$BS_TRUE\n fi\n fi\n\n\n if [ "$_INSTALL_MASTER" -eq $BS_TRUE ] || [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ]; then\n # Create the PKI directory\n [ -d "$_PKI_DIR/master" ] || (mkdir -p "$_PKI_DIR/master" && chmod 700 "$_PKI_DIR/master") || return 1\n\n # Copy the masters configuration if found\n if [ -f "$_TEMP_CONFIG_DIR/master" ]; then\n movefile "$_TEMP_CONFIG_DIR/master" "$_SALT_ETC_DIR" || return 1\n CONFIGURED_ANYTHING=$BS_TRUE\n fi\n\n # Copy the master\'s keys if found\n if [ -f "$_TEMP_CONFIG_DIR/master.pem" ]; then\n movefile "$_TEMP_CONFIG_DIR/master.pem" "$_PKI_DIR/master/" || return 1\n chmod 400 "$_PKI_DIR/master/master.pem" || return 1\n CONFIGURED_ANYTHING=$BS_TRUE\n fi\n if [ -f "$_TEMP_CONFIG_DIR/master.pub" ]; then\n movefile "$_TEMP_CONFIG_DIR/master.pub" "$_PKI_DIR/master/" || return 1\n chmod 664 "$_PKI_DIR/master/master.pub" || return 1\n CONFIGURED_ANYTHING=$BS_TRUE\n fi\n fi\n\n if [ "$_CONFIG_ONLY" -eq $BS_TRUE ] && [ $CONFIGURED_ANYTHING -eq $BS_FALSE ]; then\n echowarn "No configuration or keys were copied over. No configuration was done!"\n exit 0\n fi\n return 0\n}\n#\n# Ended Default Configuration function\n#\n#######################################################################################################################\n\n\n#######################################################################################################################\n#\n# Default salt master minion keys pre-seed function. Matches ANY distribution\n# as long as the -k option is passed.\n#\npreseed_master() {\n # Create the PKI directory\n\n if [ "$(find "$_TEMP_KEYS_DIR" -maxdepth 1 -type f | wc -l)" -lt 1 ]; then\n echoerror "No minion keys were uploaded. Unable to pre-seed master"\n return 1\n fi\n\n SEED_DEST="$_PKI_DIR/master/minions"\n [ -d "$SEED_DEST" ] || (mkdir -p "$SEED_DEST" && chmod 700 "$SEED_DEST") || return 1\n\n for keyfile in $_TEMP_KEYS_DIR/*; do\n keyfile=$(basename "${keyfile}")\n src_keyfile="${_TEMP_KEYS_DIR}/${keyfile}"\n dst_keyfile="${SEED_DEST}/${keyfile}"\n\n # If it\'s not a file, skip to the next\n [ ! -f "$src_keyfile" ] && continue\n\n movefile "$src_keyfile" "$dst_keyfile" || return 1\n chmod 664 "$dst_keyfile" || return 1\n done\n\n return 0\n}\n#\n# Ended Default Salt Master Pre-Seed minion keys function\n#\n#######################################################################################################################\n\n\n#######################################################################################################################\n#\n# This function checks if all of the installed daemons are running or not.\n#\ndaemons_running() {\n [ "$_START_DAEMONS" -eq $BS_FALSE ] && return\n\n FAILED_DAEMONS=0\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n # shellcheck disable=SC2009\n if [ "${DISTRO_NAME}" = "SmartOS" ]; then\n if [ "$(svcs -Ho STA salt-$fname)" != "ON" ]; then\n echoerror "salt-$fname was not found running"\n FAILED_DAEMONS=$((FAILED_DAEMONS + 1))\n fi\n elif [ "$(ps wwwaux | grep -v grep | grep salt-$fname)" = "" ]; then\n echoerror "salt-$fname was not found running"\n FAILED_DAEMONS=$((FAILED_DAEMONS + 1))\n fi\n done\n return $FAILED_DAEMONS\n}\n#\n# Ended daemons running check function\n#\n#######################################################################################################################\n\n\n#======================================================================================================================\n# LET\'S PROCEED WITH OUR INSTALLATION\n#======================================================================================================================\n# Let\'s get the dependencies install function\nDEP_FUNC_NAMES="install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}_deps"\nDEP_FUNC_NAMES="$DEP_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}_deps"\nDEP_FUNC_NAMES="$DEP_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_deps"\nDEP_FUNC_NAMES="$DEP_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_deps"\nDEP_FUNC_NAMES="$DEP_FUNC_NAMES install_${DISTRO_NAME_L}_${ITYPE}_deps"\nDEP_FUNC_NAMES="$DEP_FUNC_NAMES install_${DISTRO_NAME_L}_deps"\n\nDEPS_INSTALL_FUNC="null"\nfor FUNC_NAME in $(__strip_duplicates "$DEP_FUNC_NAMES"); do\n if __function_defined "$FUNC_NAME"; then\n DEPS_INSTALL_FUNC="$FUNC_NAME"\n break\n fi\ndone\nechodebug "DEPS_INSTALL_FUNC=${DEPS_INSTALL_FUNC}"\n\n# Let\'s get the minion config function\nCONFIG_SALT_FUNC="null"\nif [ "$_TEMP_CONFIG_DIR" != "null" ]; then\n\n CONFIG_FUNC_NAMES="config_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}_salt"\n CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}_salt"\n CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_salt"\n CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_salt"\n CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}_${ITYPE}_salt"\n CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}_salt"\n CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_salt"\n\n for FUNC_NAME in $(__strip_duplicates "$CONFIG_FUNC_NAMES"); do\n if __function_defined "$FUNC_NAME"; then\n CONFIG_SALT_FUNC="$FUNC_NAME"\n break\n fi\n done\nfi\nechodebug "CONFIG_SALT_FUNC=${CONFIG_SALT_FUNC}"\n\n# Let\'s get the pre-seed master function\nPRESEED_MASTER_FUNC="null"\nif [ "$_TEMP_KEYS_DIR" != "null" ]; then\n\n PRESEED_FUNC_NAMES="preseed_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}_master"\n PRESEED_FUNC_NAMES="$PRESEED_FUNC_NAMES preseed_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}_master"\n PRESEED_FUNC_NAMES="$PRESEED_FUNC_NAMES preseed_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_master"\n PRESEED_FUNC_NAMES="$PRESEED_FUNC_NAMES preseed_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_master"\n PRESEED_FUNC_NAMES="$PRESEED_FUNC_NAMES preseed_${DISTRO_NAME_L}_${ITYPE}_master"\n PRESEED_FUNC_NAMES="$PRESEED_FUNC_NAMES preseed_${DISTRO_NAME_L}_master"\n PRESEED_FUNC_NAMES="$PRESEED_FUNC_NAMES preseed_master"\n\n for FUNC_NAME in $(__strip_duplicates "$PRESEED_FUNC_NAMES"); do\n if __function_defined "$FUNC_NAME"; then\n PRESEED_MASTER_FUNC="$FUNC_NAME"\n break\n fi\n done\nfi\nechodebug "PRESEED_MASTER_FUNC=${PRESEED_MASTER_FUNC}"\n\n# Let\'s get the install function\nINSTALL_FUNC_NAMES="install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}"\nINSTALL_FUNC_NAMES="$INSTALL_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}"\nINSTALL_FUNC_NAMES="$INSTALL_FUNC_NAMES install_${DISTRO_NAME_L}_${ITYPE}"\n\nINSTALL_FUNC="null"\nfor FUNC_NAME in $(__strip_duplicates "$INSTALL_FUNC_NAMES"); do\n if __function_defined "$FUNC_NAME"; then\n INSTALL_FUNC="$FUNC_NAME"\n break\n fi\ndone\nechodebug "INSTALL_FUNC=${INSTALL_FUNC}"\n\n# Let\'s get the post install function\nPOST_FUNC_NAMES="install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}_post"\nPOST_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}_post"\nPOST_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_post"\nPOST_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_post"\nPOST_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}_${ITYPE}_post"\nPOST_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}_post"\n\nPOST_INSTALL_FUNC="null"\nfor FUNC_NAME in $(__strip_duplicates "$POST_FUNC_NAMES"); do\n if __function_defined "$FUNC_NAME"; then\n POST_INSTALL_FUNC="$FUNC_NAME"\n break\n fi\ndone\nechodebug "POST_INSTALL_FUNC=${POST_INSTALL_FUNC}"\n\n\n# Let\'s get the start daemons install function\nSTARTDAEMONS_FUNC_NAMES="install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}_restart_daemons"\nSTARTDAEMONS_FUNC_NAMES="$STARTDAEMONS_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}_restart_daemons"\nSTARTDAEMONS_FUNC_NAMES="$STARTDAEMONS_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_restart_daemons"\nSTARTDAEMONS_FUNC_NAMES="$STARTDAEMONS_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_restart_daemons"\nSTARTDAEMONS_FUNC_NAMES="$STARTDAEMONS_FUNC_NAMES install_${DISTRO_NAME_L}_${ITYPE}_restart_daemons"\nSTARTDAEMONS_FUNC_NAMES="$STARTDAEMONS_FUNC_NAMES install_${DISTRO_NAME_L}_restart_daemons"\n\nSTARTDAEMONS_INSTALL_FUNC="null"\nfor FUNC_NAME in $(__strip_duplicates "$STARTDAEMONS_FUNC_NAMES"); do\n if __function_defined "$FUNC_NAME"; then\n STARTDAEMONS_INSTALL_FUNC="$FUNC_NAME"\n break\n fi\ndone\nechodebug "STARTDAEMONS_INSTALL_FUNC=${STARTDAEMONS_INSTALL_FUNC}"\n\n\n# Let\'s get the daemons running check function.\nDAEMONS_RUNNING_FUNC="null"\nDAEMONS_RUNNING_FUNC_NAMES="daemons_running_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}"\nDAEMONS_RUNNING_FUNC_NAMES="$DAEMONS_RUNNING_FUNC_NAMES daemons_running_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}"\nDAEMONS_RUNNING_FUNC_NAMES="$DAEMONS_RUNNING_FUNC_NAMES daemons_running_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}"\nDAEMONS_RUNNING_FUNC_NAMES="$DAEMONS_RUNNING_FUNC_NAMES daemons_running_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}"\nDAEMONS_RUNNING_FUNC_NAMES="$DAEMONS_RUNNING_FUNC_NAMES daemons_running_${DISTRO_NAME_L}_${ITYPE}"\nDAEMONS_RUNNING_FUNC_NAMES="$DAEMONS_RUNNING_FUNC_NAMES daemons_running_${DISTRO_NAME_L}"\nDAEMONS_RUNNING_FUNC_NAMES="$DAEMONS_RUNNING_FUNC_NAMES daemons_running"\n\nfor FUNC_NAME in $(__strip_duplicates "$DAEMONS_RUNNING_FUNC_NAMES"); do\n if __function_defined "$FUNC_NAME"; then\n DAEMONS_RUNNING_FUNC="$FUNC_NAME"\n break\n fi\ndone\nechodebug "DAEMONS_RUNNING_FUNC=${DAEMONS_RUNNING_FUNC}"\n\n# Let\'s get the check services function\nCHECK_SERVICES_FUNC_NAMES="install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}_check_services"\nCHECK_SERVICES_FUNC_NAMES="$CHECK_SERVICES_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}_check_services"\nCHECK_SERVICES_FUNC_NAMES="$CHECK_SERVICES_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_check_services"\nCHECK_SERVICES_FUNC_NAMES="$CHECK_SERVICES_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_check_services"\nCHECK_SERVICES_FUNC_NAMES="$CHECK_SERVICES_FUNC_NAMES install_${DISTRO_NAME_L}_${ITYPE}_check_services"\nCHECK_SERVICES_FUNC_NAMES="$CHECK_SERVICES_FUNC_NAMES install_${DISTRO_NAME_L}_check_services"\n\nCHECK_SERVICES_FUNC="null"\nfor FUNC_NAME in $(__strip_duplicates "$CHECK_SERVICES_FUNC_NAMES"); do\n if __function_defined "$FUNC_NAME"; then\n CHECK_SERVICES_FUNC="$FUNC_NAME"\n break\n fi\ndone\nechodebug "CHECK_SERVICES_FUNC=${CHECK_SERVICES_FUNC}"\n\n\nif [ "$DEPS_INSTALL_FUNC" = "null" ]; then\n echoerror "No dependencies installation function found. Exiting..."\n exit 1\nfi\n\nif [ "$INSTALL_FUNC" = "null" ]; then\n echoerror "No installation function found. Exiting..."\n exit 1\nfi\n\n\n# Install dependencies\nif [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then\n # Only execute function is not in config mode only\n echoinfo "Running ${DEPS_INSTALL_FUNC}()"\n $DEPS_INSTALL_FUNC\n if [ $? -ne 0 ]; then\n echoerror "Failed to run ${DEPS_INSTALL_FUNC}()!!!"\n exit 1\n fi\nfi\n\n\n# Configure Salt\nif [ "$_TEMP_CONFIG_DIR" != "null" ] && [ "$CONFIG_SALT_FUNC" != "null" ]; then\n echoinfo "Running ${CONFIG_SALT_FUNC}()"\n $CONFIG_SALT_FUNC\n if [ $? -ne 0 ]; then\n echoerror "Failed to run ${CONFIG_SALT_FUNC}()!!!"\n exit 1\n fi\nfi\n\n\n# Pre-Seed master keys\nif [ "$_TEMP_KEYS_DIR" != "null" ] && [ "$PRESEED_MASTER_FUNC" != "null" ]; then\n echoinfo "Running ${PRESEED_MASTER_FUNC}()"\n $PRESEED_MASTER_FUNC\n if [ $? -ne 0 ]; then\n echoerror "Failed to run ${PRESEED_MASTER_FUNC}()!!!"\n exit 1\n fi\nfi\n\n\n# Install Salt\nif [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then\n # Only execute function is not in config mode only\n echoinfo "Running ${INSTALL_FUNC}()"\n $INSTALL_FUNC\n if [ $? -ne 0 ]; then\n echoerror "Failed to run ${INSTALL_FUNC}()!!!"\n exit 1\n fi\nfi\n\n# Ensure that the cachedir exists\n# (Workaround for https://github.com/saltstack/salt/issues/6502)\nif [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then\n if [ ! -d /var/cache/salt/minion/proc ]; then\n echodebug "Creating salt\'s cachedir"\n mkdir -p /var/cache/salt/minion/proc\n fi\nfi\n\n# Drop the master address if passed\nif [ "$_SALT_MASTER_ADDRESS" != "null" ]; then\n [ ! -d "$_SALT_ETC_DIR/minion.d" ] && mkdir -p "$_SALT_ETC_DIR/minion.d"\n cat <<_eof > $_SALT_ETC_DIR/minion.d/99-master-address.conf\nmaster: $_SALT_MASTER_ADDRESS\n_eof\nfi\n\n# Drop the minion id if passed\nif [ "$_SALT_MINION_ID" != "null" ]; then\n [ ! -d "$_SALT_ETC_DIR" ] && mkdir -p "$_SALT_ETC_DIR"\n echo "$_SALT_MINION_ID" > "$_SALT_ETC_DIR/minion_id"\nfi\n\n# Run any post install function. Only execute function if not in config mode only\nif [ "$_CONFIG_ONLY" -eq $BS_FALSE ] && [ "$POST_INSTALL_FUNC" != "null" ]; then\n echoinfo "Running ${POST_INSTALL_FUNC}()"\n $POST_INSTALL_FUNC\n if [ $? -ne 0 ]; then\n echoerror "Failed to run ${POST_INSTALL_FUNC}()!!!"\n exit 1\n fi\nfi\n\n# Run any check services function, Only execute function if not in config mode only\nif [ "$_CONFIG_ONLY" -eq $BS_FALSE ] && [ "$CHECK_SERVICES_FUNC" != "null" ]; then\n echoinfo "Running ${CHECK_SERVICES_FUNC}()"\n $CHECK_SERVICES_FUNC\n if [ $? -ne 0 ]; then\n echoerror "Failed to run ${CHECK_SERVICES_FUNC}()!!!"\n exit 1\n fi\nfi\n\n\n# Run any start daemons function\nif [ "$STARTDAEMONS_INSTALL_FUNC" != "null" ]; then\n echoinfo "Running ${STARTDAEMONS_INSTALL_FUNC}()"\n echodebug "Waiting ${__DEFAULT_SLEEP} seconds for processes to settle before checking for them"\n sleep ${__DEFAULT_SLEEP}\n $STARTDAEMONS_INSTALL_FUNC\n if [ $? -ne 0 ]; then\n echoerror "Failed to run ${STARTDAEMONS_INSTALL_FUNC}()!!!"\n exit 1\n fi\nfi\n\n# Check if the installed daemons are running or not\nif [ "$DAEMONS_RUNNING_FUNC" != "null" ] && [ $_START_DAEMONS -eq $BS_TRUE ]; then\n echoinfo "Running ${DAEMONS_RUNNING_FUNC}()"\n echodebug "Waiting ${__DEFAULT_SLEEP} seconds for processes to settle before checking for them"\n sleep ${__DEFAULT_SLEEP} # Sleep a little bit to let daemons start\n $DAEMONS_RUNNING_FUNC\n if [ $? -ne 0 ]; then\n echoerror "Failed to run ${DAEMONS_RUNNING_FUNC}()!!!"\n\n for fname in minion master syndic api; do\n # Skip salt-api since the service should be opt-in and not necessarily started on boot\n [ $fname = "api" ] && continue\n\n # Skip if not meant to be installed\n [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue\n [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue\n #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue\n [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue\n\n if [ "$_ECHO_DEBUG" -eq $BS_FALSE ]; then\n echoerror "salt-$fname was not found running. Pass \'-D\' to $__ScriptName when bootstrapping for additional debugging information..."\n continue\n fi\n\n\n [ ! "$_SALT_ETC_DIR/$fname" ] && [ $fname != "syndic" ] && echodebug "$_SALT_ETC_DIR/$fname does not exist"\n\n echodebug "Running salt-$fname by hand outputs: $(nohup salt-$fname -l debug)"\n\n [ ! -f /var/log/salt/$fname ] && echodebug "/var/log/salt/$fname does not exist. Can\'t cat its contents!" && continue\n\n echodebug "DAEMON LOGS for $fname:"\n echodebug "$(cat /var/log/salt/$fname)"\n echo\n done\n\n echodebug "Running Processes:"\n echodebug "$(ps auxwww)"\n\n exit 1\n fi\nfi\n\n\n# Done!\nif [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then\n echoinfo "Salt installed!"\nelse\n echoinfo "Salt configured"\nfi\nexit 0', 'conf_file': '/etc/salt/master', 'port': '22', 'username': 'root', 'sudo': False, 'keep_tmp': False, 'minion_conf': {'ioflo_realtime': True, 'acceptance_wait_time': 10, 'recon_default': 1000, 'master_port': '4506', 'whitelist_modules': [], 'tcp_keepalive_intvl': -1, 'utils_dirs': [], 'states_dirs': [], 'fileserver_backend': ['roots'], 'outputter_dirs': [], 'sls_list': [], 'module_dirs': [], 'environment': None, 'state_auto_order': True, 'master_alive_interval': 0, 'disable_modules': [], 'backup_mode': '', 'recon_randomize': True, 'file_ignore_glob': None, 'auto_accept': True, 'cache_jobs': False, 'state_verbose': True, 'verify_master_pubkey_sign': False, 'password': None, 'startup_states': '', 'grains': {}, 'always_verify_signature': False, 'tcp_pull_port': 4511, 'gitfs_pubkey': '', 'fileserver_ignoresymlinks': False, 'retry_dns': 30, 'pillar_roots': {'base': ['/srv/pillar']}, 'master_shuffle': False, 'multiprocessing': True, 'file_roots': {'base': ['/srv/salt']}, 'root_dir': '/', 'log_granular_levels': {}, 'returner_dirs': [], 'gitfs_privkey': '', 'tcp_keepalive': True, 'grains_dirs': [], 'random_reauth_delay': 10, 'autosign_timeout': 120, 'gitfs_base': 'master', 'render_dirs': [], 'gitfs_user': '', 'fileserver_limit_traversal': False, 'ioflo_console_logdir': '', 'conf_file': '/etc/salt/minion', 'top_file': '', 'zmq_monitor': False, 'file_recv_max_size': 100, 'pidfile': '/var/run/salt-minion.pid', 'range_server': 'range:80', 'raet_mutable': False, 'log_datefmt_logfile': '%Y-%m-%d %H:%M:%S', 'file_ignore_regex': None, 'raet_main': False, 'cachedir': '/var/cache/salt/minion', 'interface': '0.0.0.0', 'update_restart_services': [], 'recon_max': 10000, 'default_include': 'minion.d/*.conf', 'rejected_retry': False, 'state_events': False, 'win_repo_cachefile': 'salt://win/repo/winrepo.p', 'ipc_mode': 'ipc', 'keysize': 2048, 'extension_modules': '', 'master_sign_key_name': 'master_sign', 'cython_enable': False, 'raet_port': 4510, 'ext_job_cache': '', 'hash_type': 'md5', 'state_output': 'full', 'modules_max_memory': -1, 'renderer': 'yaml_jinja', 'state_top': 'top.sls', 'gitfs_env_whitelist': [], 'auth_tries': 7, 'gitfs_insecure_auth': False, 'mine_interval': 60, 'grains_cache': False, 'file_recv': False, 'log_level_logfile': 'info', 'ipv6': False, 'master': 'salt.awsdev.openlane.com', 'username': None, 'master_finger': '', 'failhard': False, 'tcp_keepalive_idle': 300, 'gitfs_passphrase': '', 'fileserver_followsymlinks': True, 'verify_env': True, 'ioflo_period': 0.10000000000000001, 'ping_interval': 0, 'auth_timeout': 60, 'tcp_keepalive_cnt': -1, 'raet_alt_port': 4511, 'state_aggregate': False, 'update_url': False, 'grains_refresh_every': 0, 'transport': 'zeromq', 'providers': {}, 'autoload_dynamic_modules': True, 'file_buffer_size': 262144, 'log_fmt_console': '[%(levelname)-8s] %(message)s', 'random_master': False, 'log_datefmt': '%H:%M:%S', 'grains_cache_expiration': 300, 'minion_floscript': '/usr/lib/python2.6/site-packages/salt/daemons/flo/minion.flo', 'id': 'centos6-web-debug2', 'caller_floscript': '/usr/lib/python2.6/site-packages/salt/daemons/flo/caller.flo', 'loop_interval': 1, 'log_level': 'info', 'gitfs_env_blacklist': [], 'auth_safemode': False, 'clean_dynamic_modules': True, 'disable_returners': [], 'cache_sreqs': True, 'minion_id_caching': True, 'gitfs_root': '', 'test': False, 'gitfs_password': '', 'syndic_finger': '', 'raet_clear_remotes': True, 'file_client': 'remote', 'user': 'root', 'use_master_when_local': False, 'acceptance_wait_time_max': 0, 'open_mode': False, 'permissive_pki_access': False, 'cmd_safe': True, 'zmq_filtering': False, 'master_type': 'str', 'pki_dir': '/etc/salt/pki/minion', 'max_event_size': 1048576, 'ioflo_verbose': 0, 'sock_dir': '/var/run/salt/minion', 'tcp_pub_port': 4510, 'log_fmt_logfile': '%(asctime)s,%(msecs)03.0f [%(name)-17s][%(levelname)-8s][%(process)d] %(message)s', 'log_file': '/var/log/salt/minion', 'gitfs_remotes': [], 'gitfs_mountpoint': ''}, 'file_map': None, 'host': '10.139.1.233', 'preseed_minion_keys': None, 'parallel': False, 'display_ssh_output': True, 'name': 'centos6-web-debug2', 'script_env': None, 'has_ssh_agent': False, 'known_hosts_file': '/dev/null', 'sock_dir': '/var/run/salt/master', 'script_args': None, 'salt_host': '10.139.1.233', 'master_sign_pub_file': None}}
[DEBUG ] Deploying 10.139.1.233 at 1431446844.0
[DEBUG ] Attempting connection to host 10.139.1.233 on port 22
[DEBUG ] SSH port 22 on 10.139.1.233 is available
[DEBUG ] Using /etc/salt/cloud.providers.d/karpoc.pem as the key_filename
[DEBUG ] Attempting to authenticate as root (try 1 of 15)
[DEBUG ] SSH command: 'ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 date'
[DEBUG ] Child Forked! PID: 11471 STDOUT_FD: 5 STDERR_FD: 7
[DEBUG ] Terminal Command: /bin/sh -c ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 date
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
[DEBUG ] Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
Tue May 12 16:07:22 UTC 2015
[DEBUG ] Tue May 12 16:07:22 UTC 2015
[DEBUG ] Logging into 10.139.1.233:22 as root
[DEBUG ] Using /etc/salt/cloud.providers.d/karpoc.pem as the key_filename
[DEBUG ] SSH command: 'ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 \'test -e \'"\'"\'/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca\'"\'"\'\''
[DEBUG ] Child Forked! PID: 11497 STDOUT_FD: 5 STDERR_FD: 7
[DEBUG ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 'test -e '"'"'/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca'"'"''
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
Connection to 10.139.1.233 closed.
[DEBUG ] Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
Connection to 10.139.1.233 closed.
[DEBUG ] SSH command: 'ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 \'sh -c "( mkdir -p \'"\'"\'/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca\'"\'"\' && chmod 700 \'"\'"\'/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca\'"\'"\' )"\''
[DEBUG ] Child Forked! PID: 11513 STDOUT_FD: 5 STDERR_FD: 7
[DEBUG ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 'sh -c "( mkdir -p '"'"'/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca'"'"' && chmod 700 '"'"'/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca'"'"' )"'
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
Connection to 10.139.1.233 closed.
[DEBUG ] Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
Connection to 10.139.1.233 closed.
[DEBUG ] Uploading /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pem to 10.139.1.233 (sfcp)
[DEBUG ] SFTP command: 'echo "put /tmp/tmpsFEf2K /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pem" | sftp -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -oIdentityFile=/etc/salt/cloud.providers.d/karpoc.pem -oPort=22 root@10.139.1.233'
[DEBUG ] Child Forked! PID: 11539 STDOUT_FD: 6 STDERR_FD: 8
[DEBUG ] Terminal Command: /bin/sh -c echo "put /tmp/tmpsFEf2K /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pem" | sftp -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -oIdentityFile=/etc/salt/cloud.providers.d/karpoc.pem -oPort=22 root@10.139.1.233
Connecting to 10.139.1.233...
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
[DEBUG ] Connecting to 10.139.1.233...
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
sftp> put /tmp/tmpsFEf2K /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pem
Uploading /tmp/tmpsFEf2K to /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pem
/tmp/tmpsFEf2K 0% 0 0.0KB/s --:-- ETA
/tmp/tmpsFEf2K 100% 1679 1.6KB/s 00:00
[DEBUG ] sftp> put /tmp/tmpsFEf2K /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pem
Uploading /tmp/tmpsFEf2K to /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pem
/tmp/tmpsFEf2K 0% 0 0.0KB/s --:-- ETA
/tmp/tmpsFEf2K 100% 1679 1.6KB/s 00:00
[DEBUG ] SSH command: 'ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 \'chmod 600 \'"\'"\'/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pem\'"\'"\'\''
[DEBUG ] Child Forked! PID: 11568 STDOUT_FD: 6 STDERR_FD: 8
[DEBUG ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 'chmod 600 '"'"'/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pem'"'"''
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
Connection to 10.139.1.233 closed.
[DEBUG ] Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
Connection to 10.139.1.233 closed.
[DEBUG ] Uploading /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pub to 10.139.1.233 (sfcp)
[DEBUG ] SFTP command: 'echo "put /tmp/tmp1kcKpk /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pub" | sftp -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -oIdentityFile=/etc/salt/cloud.providers.d/karpoc.pem -oPort=22 root@10.139.1.233'
[DEBUG ] Child Forked! PID: 11579 STDOUT_FD: 7 STDERR_FD: 9
[DEBUG ] Terminal Command: /bin/sh -c echo "put /tmp/tmp1kcKpk /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pub" | sftp -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -oIdentityFile=/etc/salt/cloud.providers.d/karpoc.pem -oPort=22 root@10.139.1.233
Connecting to 10.139.1.233...
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
[DEBUG ] Connecting to 10.139.1.233...
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
sftp> put /tmp/tmp1kcKpk /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pub
Uploading /tmp/tmp1kcKpk to /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pub
/tmp/tmp1kcKpk 0% 0 0.0KB/s --:-- ETA
/tmp/tmp1kcKpk 100% 451 0.4KB/s 00:00
[DEBUG ] sftp> put /tmp/tmp1kcKpk /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pub
Uploading /tmp/tmp1kcKpk to /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion.pub
/tmp/tmp1kcKpk 0% 0 0.0KB/s --:-- ETA
/tmp/tmp1kcKpk 100% 451 0.4KB/s 00:00
[DEBUG ] Uploading /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion to 10.139.1.233 (sfcp)
[DEBUG ] SFTP command: 'echo "put /tmp/tmpEN5V2K /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion" | sftp -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -oIdentityFile=/etc/salt/cloud.providers.d/karpoc.pem -oPort=22 root@10.139.1.233'
[DEBUG ] Child Forked! PID: 11607 STDOUT_FD: 8 STDERR_FD: 10
[DEBUG ] Terminal Command: /bin/sh -c echo "put /tmp/tmpEN5V2K /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion" | sftp -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -oIdentityFile=/etc/salt/cloud.providers.d/karpoc.pem -oPort=22 root@10.139.1.233
Connecting to 10.139.1.233...
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
[DEBUG ] Connecting to 10.139.1.233...
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
sftp> put /tmp/tmpEN5V2K /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion
Uploading /tmp/tmpEN5V2K to /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion
/tmp/tmpEN5V2K 0% 0 0.0KB/s --:-- ETA
/tmp/tmpEN5V2K 100% 3339 3.3KB/s 00:00
[DEBUG ] sftp> put /tmp/tmpEN5V2K /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion
Uploading /tmp/tmpEN5V2K to /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/minion
/tmp/tmpEN5V2K 0% 0 0.0KB/s --:-- ETA
/tmp/tmpEN5V2K 100% 3339 3.3KB/s 00:00
[DEBUG ] Uploading /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/deploy.sh to 10.139.1.233 (sfcp)
[DEBUG ] SFTP command: 'echo "put /tmp/tmpbJv0Xt /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/deploy.sh" | sftp -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -oIdentityFile=/etc/salt/cloud.providers.d/karpoc.pem -oPort=22 root@10.139.1.233'
[DEBUG ] Child Forked! PID: 11635 STDOUT_FD: 9 STDERR_FD: 11
[DEBUG ] Terminal Command: /bin/sh -c echo "put /tmp/tmpbJv0Xt /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/deploy.sh" | sftp -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -oIdentityFile=/etc/salt/cloud.providers.d/karpoc.pem -oPort=22 root@10.139.1.233
Connecting to 10.139.1.233...
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
[DEBUG ] Connecting to 10.139.1.233...
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
sftp> put /tmp/tmpbJv0Xt /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/deploy.sh
Uploading /tmp/tmpbJv0Xt to /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/deploy.sh
/tmp/tmpbJv0Xt 0% 0 0.0KB/s --:-- ETA
/tmp/tmpbJv0Xt 100% 199KB 199.3KB/s 00:00
[DEBUG ] sftp> put /tmp/tmpbJv0Xt /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/deploy.sh
Uploading /tmp/tmpbJv0Xt to /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/deploy.sh
/tmp/tmpbJv0Xt 0% 0 0.0KB/s --:-- ETA
/tmp/tmpbJv0Xt 100% 199KB 199.3KB/s 00:00
[DEBUG ] SSH command: 'ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 \'sh -c "( chmod +x \'"\'"\'/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/deploy.sh\'"\'"\' )";exit $?\''
[DEBUG ] Child Forked! PID: 11663 STDOUT_FD: 9 STDERR_FD: 11
[DEBUG ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 'sh -c "( chmod +x '"'"'/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/deploy.sh'"'"' )";exit $?'
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
Connection to 10.139.1.233 closed.
[DEBUG ] Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
Connection to 10.139.1.233 closed.
[DEBUG ] SSH command: 'ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 \'/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/deploy.sh -c \'"\'"\'/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca\'"\'"\'\''
[DEBUG ] Child Forked! PID: 11694 STDOUT_FD: 9 STDERR_FD: 11
[DEBUG ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 '/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/deploy.sh -c '"'"'/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca'"'"''
Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
[DEBUG ] Warning: Permanently added '10.139.1.233' (RSA) to the list of known hosts.
 * INFO: /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/deploy.sh -- Version 2015.05.04
 * INFO: System Information:
 * INFO: CPU: GenuineIntel
 * INFO: CPU Arch: x86_64
 * INFO: OS Name: Linux
 * INFO: OS Version: 2.6.32-431.29.2.el6.x86_64
 * INFO: Distribution: CentOS 6.5
 * INFO: Installing minion
 * INFO: Found function install_centos_stable_deps
 * INFO: Found function config_salt
 * INFO: Found function install_centos_stable
 * INFO: Found function install_centos_stable_post
 * INFO: Found function install_centos_restart_daemons
 * INFO: Found function daemons_running
[DEBUG ]  * INFO: /tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/deploy.sh -- Version 2015.05.04
 * INFO: System Information:
 * INFO: CPU: GenuineIntel
 * INFO: CPU Arch: x86_64
 * INFO: OS Name: Linux
 * INFO: OS Version: 2.6.32-431.29.2.el6.x86_64
 * INFO: Distribution: CentOS 6.5
 * INFO: Installing minion
 * INFO: Found function install_centos_stable_deps
 * INFO: Found function config_salt
 * INFO: Found function install_centos_stable
 * INFO: Found function install_centos_stable_post
 * INFO: Found function install_centos_restart_daemons
 * INFO: Found function daemons_running
 * INFO: Found function install_centos_check_services
 * INFO: Running install_centos_stable_deps()
[DEBUG ]  * INFO: Found function install_centos_check_services
 * INFO: Running install_centos_stable_deps()
Connection to 10.139.1.233 closed.
[DEBUG ] Connection to 10.139.1.233 closed.
curl: (7) Failed to connect to 2604:1580:fe00:0:5054:ff:feae:702c: Network is unreachable
error: skipping http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm - transfer failed
Retrieving http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
 * ERROR: Failed to run install_centos_stable_deps()!!!
[DEBUG ] curl: (7) Failed to connect to 2604:1580:fe00:0:5054:ff:feae:702c: Network is unreachable
error: skipping http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm - transfer failed
Retrieving http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
 * ERROR: Failed to run install_centos_stable_deps()!!!
Error: There was a profile error: Command 'ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /etc/salt/cloud.providers.d/karpoc.pem -p 22 root@10.139.1.233 \'/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca/deploy.sh -c \'"\'"\'/tmp/.saltcloud-5da45f3a-ac0b-40d2-99cc-b131db7d67ca\'"\'"\'\'' failed. Exit code: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment