Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic support for Solaris #510

Merged
merged 1 commit into from
Jun 26, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions library/setup
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ def get_virtual_facts(facts):
facts = get_linux_virtual_facts(facts)

# get list of interfaces that are up
def get_interfaces():
def get_interfaces(facts):
if facts['system'] == 'SunOS':
return []
length = 4096
offset = 32
step = 32
Expand All @@ -236,7 +238,7 @@ def get_iface_hwaddr(iface):
def get_network_facts(facts):
facts['fqdn'] = socket.getfqdn()
facts['hostname'] = facts['fqdn'].split('.')[0]
facts['interfaces'] = get_interfaces()
facts['interfaces'] = get_interfaces(facts)
for iface in facts['interfaces']:
facts[iface] = { 'macaddress': get_iface_hwaddr(iface) }
# This is lame, but there doesn't appear to be a good way
Expand Down Expand Up @@ -309,6 +311,10 @@ def ansible_facts():
get_service_facts(facts)
return facts

def md5_sum(f):
md5sum = os.popen("/usr/bin/md5sum %(file)s 2> /dev/null || /sbin/md5 -q %(file)s 2> /dev/null || /usr/bin/digest -a md5 -v %(file)s" % {"file": f}).read().split()[0]
return md5sum

# load config & template variables

if len(sys.argv) == 1:
Expand Down Expand Up @@ -345,7 +351,7 @@ md5sum = None
if not os.path.exists(ansible_file):
changed = True
else:
md5sum = os.popen("/usr/bin/md5sum %(file)s 2> /dev/null || /sbin/md5 -q %(file)s" % {"file": ansible_file}).read().split()[0]
md5sum = md5_sum(ansible_file)

# Get some basic facts in case facter or ohai are not installed
for (k, v) in ansible_facts().items():
Expand Down Expand Up @@ -394,7 +400,7 @@ reformat = json.dumps(setup_options, sort_keys=True, indent=4)
f.write(reformat)
f.close()

md5sum2 = os.popen("/usr/bin/md5sum %(file)s 2> /dev/null || /sbin/md5 -q %(file)s" % {"file": ansible_file}).read().split()[0]
md5sum2 = md5_sum(ansible_file)

if md5sum != md5sum2:
changed = True
Expand Down